>Finally I have found the error. Setting the windowstate-property at designtime or in the init of the form does not worh because at the end of the init-code is a setfocus-command to a control which shall be active when the program starts. When I remove this line, it works
>
>Best regards
>
>Thomas
Interesting. The .SetFocus() of a form's control has the side effect of making the form visible, but it seems that it does not care for the Window State, in such cases.
You can move your SetFocus to the form's GotFocus, and the problem does not occur.
#DEFINE SET_FOCUS_IN_INIT .F.
LOCAL MaxForm AS MaxForm
m.MaxForm = CREATEOBJECT("MaxForm")
m.MaxForm.Show()
READ EVENTS
DEFINE CLASS MaxForm AS Form
WindowState = 2
Shown = .F.
ADD OBJECT UnfocusedText AS TextBox WITH Top = 10, Left = 10
ADD OBJECT FocusedText AS TextBox WITH Top = 40, Left = 10
#IF SET_FOCUS_IN_INIT
FUNCTION Init
This.FocusedText.SetFocus()
ENDFUNC
#ELSE
FUNCTION GotFocus
IF !This.Shown
This.Shown = .T.
This.FocusedText.SetFocus()
ENDIF
DODEFAULT()
ENDFUNC
#ENDIF
FUNCTION Destroy
CLEAR EVENTS
ENDFUNC
ENDDEFINE
----------------------------------
António Tavares Lopes