Jump to content

@gui_ macros


Recommended Posts

I reported this not working but never got a response. #77254

Can someone explain hwo they are supposed to work. I keep getting 'Unknown macro' errors. Thanks.

#include <guiconstants.au3>

GUICreate("test")
$btn = GUICtrlCreateButton("test", 10, 10)
GUISetState()

Do
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $btn
            _btn()
    EndSelect
    
Until $msg = $gui_event_close

Func _btn()
    MsgBox(0, "test", @GUI_WinHandle)
    MsgBox(0, "test", @GUI_CtrlId)
    MsgBox(0, "test", @GUI_CtrlHandle)
EndFunc;==>_btn
Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

I reported this not working but never got a response. #77254

Can someone explain hwo they are supposed to work. I keep getting 'Unknown macro' errors. Thanks.

#include <guiconstants.au3>

GUICreate("test")
$btn = GUICtrlCreateButton("test", 10, 10)
GUISetState()

Do
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $btn
            _btn()
    EndSelect
    
Until $msg = $gui_event_close

Func _btn()
    MsgBox(0, "test", @GUI_WinHandle)
    MsgBox(0, "test", @GUI_CtrlId)
    MsgBox(0, "test", @GUI_CtrlHandle)
EndFunc;==>_btn

<{POST_SNAPBACK}>

They do not exist until you have something for them. Your script has no gui handle. So how can you use a macro, that reports the last Gui handle used ?

The same goes for the others.

These macro's are generated , once you have supplied the events and handles associated for them.

Link to comment
Share on other sites

Example returns:

Opt("GUIOnEventMode", 1)
_a()

Func _a()
    Global $one = GUICreate('1')
    $but1 = GUICtrlCreateButton('button', 5, 5)
    GUICtrlSetOnEvent(-1, 'fake')
    GUISetState()
    Sleep(5000)
    GUISetState(@SW_MINIMIZE)
    _b()
EndFunc

Func _b()
    Global $two = GUICreate('2')
    $but2 = GUICtrlCreateButton('button', 10, 10)
    GUICtrlSetOnEvent(-1, 'click')
    GUISetState()
EndFunc

While 1
    Sleep(100)
WEnd

Func click()
    MsgBox(0, '', 'Last clicked handle is for Gui switching etc: ' & @GUI_WinHandle)
    MsgBox(0, '', 'and last clicked Control ctrlid:' & @GUI_CtrlId)
    MsgBox(0, '', 'and last clicked Control handle:' & @GUI_CtrlHandle)
    Exit
EndFunc

Func fake()
    MsgBox(0, '', 'Nice try')
EndFunc

Click the buttons. :(

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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