Franco,
I'm not seeing the problem you're reporting in either VFP8SP1 or VFP9. Here's some code to show how I tested it. Just run this code and click the Grow button. A second form will appear and maximize. I have 3 lines commented out. Uncomment one of them and run it again. Do that for each line. You should see that the second form maximizes in each case. What *may* be causing your problems is the possibility of class code firing in the setfocus that stops the form from resizing.
LOCAL loForm AS frmMaximize
loForm = NEWOBJECT('frmMaximize')
loForm.Show()
READ EVENTS
loForm = null
DEFINE CLASS frmMaximize AS Form
oForm = null
ADD OBJECT cmdMax AS CommandButton WITH ;
Top = 10, ;
Left = 10, ;
Height = 27, ;
Caption = 'Grow'
PROCEDURE cmdMax.Click
thisform.oForm = NEWOBJECT('frmMaximize2')
WITH thisform.oForm
.AutoCenter = .t.
.Show()
.WindowState = 2
ENDWITH
ENDPROC
PROCEDURE Destroy
this.oForm = null
CLEAR EVENTS
ENDPROC
ENDDEFINE
DEFINE CLASS frmMaximize2 AS Form
ADD OBJECT txtTest AS TextBox
ENDDEFINE
HTH,
Chad
>Hi
>
>I'm having a problem with maximising a form.
>
>If I setfocus() after setting windowstate = 2, the form does not maximize.
>
>If I comment the setfocus() code, it works fine.
>
>Do you know why this happens ? and how to overcome it maybe ?
>
>Thanks.
_________________________________
There are 2 types of people in the world: