In addition to Wcgs' method, if you have VFP 8.0, you can use the new BindEvent() function to tie the screen's resize to the form's resize. For more details, see Bindevent() in the Help.
In the root of main.prg put
DO ScreenResizeClass
Then create a procedure :-
* *********************************
* Procedure: ScreenResizeClass
* Syntax: DO ScreenResizeClass
* *********************************
PROC ScreenResizeClass
IF VARTYPE(oMain) = [O]
WITH oMain
.LockScreen = .T. && Code
.LockScreen = .F.
ENDW
ENDI
IF VARTYPE(oStatusBar) = [O]
WITH oMain
.LockScreen = .T. && Code
.LockScreen = .F.
ENDW
ENDI
ENDPROC
ENDDEFINE
In the .Load() event of your main form put :-
WITH _SCREEN
.AddObject([oResizer],[Resizer]) && .AddObject([oScreenMoved],[ScreenMoved])
ENDW
As you can see, you can also add a .Moved() method which enables you to write the coordinates of _SCREEN to a table so that the app always starts in the last position.
In the .SCREEN.Resize() method, you can also write the coordinates of the child forms to a table for the same reason.
Thanks for that code. I should have guessed that's what you had in mind. I thought you meant that he should somehow write code directly into the _SCREEN event handler.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.