[DELPHI] If statement problem

Newbie Spellweaver
Joined
Apr 13, 2009
Messages
88
Reaction score
0
Hi, I'm messing about in Delphi 7 out of boredom anyways, I tried to do a basic If statement... the IDE stops right where the If starts which makes next to no sense to me the statement is inside a timer and it basically is :

If frmMain.Height <> 477 Then
WebBrowser1.Height := NewHeight
end;

I declared NewHeight as an integer in the Vars bit, and defined it above the If statement just shown :

NewHeight := frmMain.Height - 40

anyways, this is my first attempt at Delphi, what I'm trying to do is simple, when I resize my form I want it to resize my WebBrowser1 component (which I should really rename, but I'm too lazy atm) I thought it would be as simple as making a simple 'formula' for substracting the forms height by 40 (the height difference between the form and the webbrowser component) and declaring the variable of NewHeight as an Int, then doing a simple if statement, OH and since I didn't know where to put the code, I made a Timer (lol) since idk where the hell else I could put in it, if needed I'll upload full source (but I don't think anyone here even has Delphi...) which brings me to my other issue, I doubt anyone here does delphi (unless by some divine miracle someone does) anyways, any help would be appreciated, and sorry for my sloppyness I'm rather tired, and I get sloppy when tired.
 
I officially love RZ, and check the attachment, as I said its in Delphi 7.2 (I think I forgot to add the .2 bit) but you can prob look at it through notepad or something if anything :P

Edit :

Excuse my rudeness, I forgot to say THANK YOU for your time! ;D and thanks for your help (in advanced)

Edit :

Figured it out LOL apparently it works if I do it in 1 line like so :

If 420 <> 417 then WebBrowser1.Height := frmMain.Height - 40;
 
It looks to me like you're trying to anchor the control so it changes size when you resize the form

Why not just use the Anchors property? You can anchor it to left top AND bottom (and right, if you want)

Either set the property in the object properties editor, or you can do it in your code like:

WebBrowser1.Anchors := [akLeft, akTop, akBottom];
 
It looks to me like you're trying to anchor the control so it changes size when you resize the form

Why not just use the Anchors property? You can anchor it to left top AND bottom (and right, if you want)

Either set the property in the object properties editor, or you can do it in your code like:

WebBrowser1.Anchors := [akLeft, akTop, akBottom];

Because I didn't know it existed =[ SO THATS the function I wanted, I kept trying to figure out why it happened on another project :P thanks for the tip I really appreciate it, by the way mind sharing any good links to learn delphi from? :P
 
Back