Jump to content

Recommended Posts

Posted (edited)

I've encountered something I don't really understand my self.

i have a function to create a new gui

Func edit()
$winopen= GUICreate("Redigera text", 145, 173, -1, -1, BitOR ($WS_POPUP, $WS_BORDER), -1) 
 GUISetState(@sw_show, $winopen)
    $myedit = GUICtrlCreateEdit("Text", 5, 5, 135, 135)
$save = GUICtrlCreateButton("Spara", 5, 145)
$abort = GUICtrlCreateButton("Avbryt", 50, 145)
;//put the $sExit =  GUICtrlCreateButton("Exit", nn, nn) here
   
    
    While 1
 $msg2 = GUIGetMsg()
        
If $msg2 = $GUI_EVENT_CLOSE Or $msg2 = $abort Then 
            GUIdelete($winopen)
            ;GUISwitch ($main)
            $msg2 = 0
            ExitLoop
        EndIf
        
    wend
EndFunc

before I added the while 1 loop the gui where written as it should but now it stops right after it has created the gui window. the controls in the window are never written!

Have a look at this code

Func _Edit()
    While 1
        $GUICreate("Redigera text", 145, 173, -1, -1, BitOR ($WS_POPUP, $WS_BORDER), -1) 
        GUISetState()
        $myedit = GUICtrlCreateEdit("Text", 5, 5, 135, 135)
        $save = GUICtrlCreateButton("Spara", 5, 145)
        $abort = GUICtrlCreateButton("Avbryt", 50, 145)         
        While 1         
            $msg2 = GUIGetMsg()         
            Select
                Case $msg = $GUI_EVENT_CLOSE Or $msg = $sExit
                    GUIDelete()
                    ExitLoop (2)
                Case $msg = $save
                    GUIDelete()
                    ;//Your Code for Save
                    ExitLoop
                Case $msg = $myEdit
                    GUIDelete()
                    ;//Your Code for Edit
                    ExitLoop                    
            EndSelect
        WEnd
    WEnd
EndFunc
Edited by anixon

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...