Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pickup _screen windowstate change?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00085679
Message ID:
00085704
Views:
25
>>>I want to reposition forms from top/left to center based on whether _screen is normal or maximized. Is there a (hopefully easy) way to do this?
>>
>>There is no natural way because _SCREEN doesn't have events. One more solution is timer to check _SCREEN.Left,Width and so on. Another way is to disable(remove) real _SCREEN buttons (e.g. _SCREEN.Maxbutton=.f.) and provide toolbar or even separate buttons imitating regular ones. Now you have Button.Click events.
>
>Thanks, Edward...I was afraid of hearing that ("no natural way")...you've got me started on some ideas, anyway...I guess another would be to go with SCREEN=OFF and a top-level to act as the main screen, so that I can get control of the events. This may be a little tricky in such a large app, however...

Bruce, try this small VCX, first
**************************************************
*-- Class: screnbox (d:\vfp5test\test.vcx)
*-- ParentClass: form
*-- BaseClass: form
*
DEFINE CLASS screnbox AS form
Top = 0
Left = 0
Height = 27
Width = 112
Desktop = .T.
DoCreate = .T.
BorderStyle = 0
Caption = ""
ControlBox = .F.
Closable = .F.
MaxButton = .F.
MinButton = .F.
Movable = .F.
Name = "screnbox"
ADD OBJECT cmdminimize AS commandbutton WITH ;
Top = 0, ;
Left = 64, ;
Height = 15, ;
Width = 15, ;
Caption = "", ;
Name = "cmdMinimize"
ADD OBJECT cmdmaximize AS commandbutton WITH ;
Top = 0, ;
Left = 79, ;
Height = 15, ;
Width = 15, ;
Caption = "", ;
Name = "cmdMaximize"
ADD OBJECT cmdexit AS commandbutton WITH ;
Top = 0, ;
Left = 97, ;
Height = 15, ;
Width = 15, ;
Caption = "", ;
Name = "cmdExit"
PROCEDURE Init
this.reset()
ENDPROC
PROCEDURE reset
this.top=_screen.top+2
this.left=_screen.left+_screen.width-this.width
ENDPROC
PROCEDURE cmdminimize.Click
_screen.windowstate=1
thisform.reset()
ENDPROC
PROCEDURE cmdmaximize.Click
if _screen.windowstate=2
_screen.windowstate=0
else
_screen.windowstate=2
endif
thisform.reset()
ENDPROC
PROCEDURE cmdexit.Click
clear events
ENDPROC
ENDDEFINE
*
*-- EndDefine: screnbox
**************************************************
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform