Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expanding an object on app maximize 1

Status
Not open for further replies.

reisende

Programmer
Mar 16, 2004
74
US
Hello everyone, I just had a quick question.

I am working on a simple web browser as a learning exercise and I am trying to figure out how to make the TWebBrowser object expand from its default width property when the app is either maximized or otherwise expanded contracted.

I believe it will have something to do with manipulating the x and y axes or width and height properties (I'm just not sure how to do it :)

Any responses will be greatly appreciated.
 
reisende,

Typically, you let Delphi handle this by setting an object's Anchor properties. Unfortunately, TWebBrowser doesn't implement Anchor properties.

To work around this:

1. Place your TWebBrowser component inside a TPanel

2. Set the TWebBrowser's Align property to alClient.

3. Set the TPanel's Anchor property to [akLeft,akTop,akRight,akBottom].

4. Resize the TPanel's corners to the screen locations you want it to fill, relative to the form size.

5. Resize your form at will.

Hope this helps...

-- Lance
 
Thanks for the quick reply, Lance.

I tried what you suggested and it resizes everything correctly inside the development environment (the form) but when I compile it the web browser window resizes relative to the width or height of the app window (when I maximize it or drag a corner).

What I'd like it to do is similar to IE or Netscape where the browser window takes up the whole with of the app (except scroll bar) when the app window is resized manually or maximized.

Maybe I just missed something, but it looks like it doing it correctly in the development environment, but not when I compile it.
 
OK Lance, I worked with it a little more and I think I got it to work. I put the align of the panel to alClient as well and that took care of it. Thanks again for your help.

Tony
 
Tony,

Whoops, sorry for not telling you about setting the Panel's Align property.

Mea culpa,

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top