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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help to center form on maximize

Status
Not open for further replies.

kenb0921

Programmer
Oct 18, 2010
3
US
I have an exe that opens another exe and immediately sends it to the system tray. The client wants the form to be centered when the application is maximized. It is centered when you bring up from the system tray but does not center on the maximize. When you run the exe by itself it does auto center as expected. I have this.autocenter =.t. in the init of the form, but this doesnt seem to help.

Any suggestions?
 
I have not tried that. The form is inside the main fox window and is the only form there.

What event would fire when maximize is clicked?
 
Thats just the thing, the resize event is only fired when I arrow over and drag. This does not get fired on the maximize
 
You would have to bind the screen's resize event to a function or procedure or to the form's resize event. When you maximize the application that uses the screen as the top-level it's the screen's resize event that is getting fired .... not the form inside the main fox window.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
If the form is inside the _screen, then what maximizes is rather the _screen, isn't it? The form in it never changed from normal or maximized to minimized, only the _screen.

SnyAc has a good advice to use Bindevent to be able to react on _screen.resize events.

One easy thing you can do is set autocenter to .T. again, even if it's already .T. - at the moment you set it .T. it will center the form again. Simply check that with o = createobject("form") / o.visble = .t. / o.autocenter = .T. / move the form then again do o.autocenter = .T.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top