Jump to content

Recommended Posts

Posted (edited)

Hi,

what is the best way to tackle this
for some reason can't wrap my head about it too much at this time or investigate ..

#include <GUIConstantsEx.au3>

Global $bReturn = 0
Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example")
    Local $idOK1 = GUICtrlCreateButton("OK", 310, 370, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idOK1
                If $bReturn <> 0 Then
                    $bReturn = 2  ;<--------
                    ContinueLoop
                EndIf
                _function()     
;~          Case $idOK2
;~              If $bReturn <> 0 Then
;~                  $bReturn = 3  <--------
;~                  ContinueLoop
;~              EndIf
;~              _function2()
        EndSwitch
        Sleep(10)
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

Func _function()
    $bReturn = 99
    ; wait for button evaluation ..
    While 1
        If $bReturn <> 99 Then ExitLoop
        Sleep(1000)
    WEnd
    MsgBox(0, '', $bReturn)
    $bReturn = 0
EndFunc   ;==>function

Thanks

Deye

Edit : never mind ..got it working with using something like :

Func _function()
    Local $sread
    $bReturn = 99
    ; wait for button evaluation ..
    While 1
        $sread = ControlGetFocus($hGUI)
        If StringInStr($sread, "Button", "") Then
            $sread = StringReplace($sread, "Button", "")
            Sleep(100)
            ExitLoop
        EndIf
        Sleep(100)
    WEnd
    ConsoleWrite($sread & @CRLF)
    $bReturn = 0
EndFunc   ;==>_function

 

Edited by Deye

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...