I noticed some odd behaviour with the forms moved method that I can't explain.
When I minimize a form with the MinButton I want VFP to go to the taskbar, not above the taskbar, with the instruction
_screen.windowstate=thisform.windowstate in the Resize method. That works fine.
But when I put a command, any command, in the forms Moved method and I click on the taskbar to go back to Normal windowstate the objects (labels, textboxes etc.) on the form are invisible. The form is blank. A Refresh method repaints only some objects but not the labels.
When I comment out the Moved method or the _screen.windowstate command in the Resize method the objects stay visible. So for some reason the combination of the _screen.windowstate and the Moved method is causing this problem. Why?
Example form for testing:
When I minimize a form with the MinButton I want VFP to go to the taskbar, not above the taskbar, with the instruction
_screen.windowstate=thisform.windowstate in the Resize method. That works fine.
But when I put a command, any command, in the forms Moved method and I click on the taskbar to go back to Normal windowstate the objects (labels, textboxes etc.) on the form are invisible. The form is blank. A Refresh method repaints only some objects but not the labels.
When I comment out the Moved method or the _screen.windowstate command in the Resize method the objects stay visible. So for some reason the combination of the _screen.windowstate and the Moved method is causing this problem. Why?
Example form for testing:
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 02/26/21 01:26:05 PM
*
DEFINE CLASS form1 AS form
Height = 214
Width = 426
Desktop = .T.
DoCreate = .T.
Caption = "Form1"
WindowType = 1
Name = "Form1"
ADD OBJECT label1 AS label WITH ;
Caption = "Label1", ;
Height = 25, ;
Left = 24, ;
Top = 24, ;
Width = 97, ;
Name = "Label1"
ADD OBJECT label2 AS label WITH ;
Caption = "Label2", ;
Height = 25, ;
Left = 24, ;
Top = 48, ;
Width = 97, ;
Name = "Label2"
ADD OBJECT text1 AS textbox WITH ;
Height = 25, ;
Left = 156, ;
Top = 24, ;
Width = 85, ;
Name = "Text1"
ADD OBJECT text2 AS textbox WITH ;
Height = 25, ;
Left = 156, ;
Top = 48, ;
Width = 85, ;
Name = "Text2"
ADD OBJECT command2 AS commandbutton WITH ;
Top = 96, ;
Left = 156, ;
Height = 37, ;
Width = 85, ;
Caption = "OK", ;
Name = "Command2"
PROCEDURE Moved
a=1 && just some code
ENDPROC
PROCEDURE Resize
_screen.windowstate=thisform.windowstate
* thisform.refresh repaints only the textboxes not the labels.
ENDPROC
PROCEDURE Unload
_screen.visible=.t.
ENDPROC
PROCEDURE Load
_screen.visible=.f.
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1