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

How to detect resize event of screen ?

Status
Not open for further replies.

viettla

Programmer
Jul 19, 2002
34
VN
Hi,
I want to resize child form when screen is rezized. How can do this ?
thank's

Viet
 
If I understand your question correctly, wcgs has posted an example of this in thread184-687849.

Brian
 
Viet,

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.

Mike


Mike Lewis
Edinburgh, Scotland
 
Thank to Brian, Mike
I found best answer from Wcgs's example.
Viet

Viet
 
Mike

In the root of main.prg put

DO ScreenResizeClass

Then create a procedure :-

* *********************************
* Procedure: ScreenResizeClass
* Syntax: DO ScreenResizeClass
* *********************************
PROC ScreenResizeClass

DEFINE CLASS Resizer AS Custom
oScreen = _SCREEN

PROCEDURE oScreen.Resize
WITH _SCREEN
.LockScreen = .T.
&& Code
.LockScreen = .F.
ENDW

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.

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top