steveR Posted May 8, 2005 Share Posted May 8, 2005 (edited) I reported this not working but never got a response. #77254Can 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 May 8, 2005 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 More sharing options...
layer Posted May 8, 2005 Share Posted May 8, 2005 Hmmm... I do too. Anyone know? Why? FootbaG Link to comment Share on other sites More sharing options...
MHz Posted May 8, 2005 Share Posted May 8, 2005 I reported this not working but never got a response. #77254Can 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 More sharing options...
MHz Posted May 8, 2005 Share Posted May 8, 2005 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 More sharing options...
steveR Posted May 8, 2005 Author Share Posted May 8, 2005 (edited) Cool thanks. I didn't realize these only worked with GuiOnEventMode. Maybe this should be added to the help file: These macro's are used with GuiOnEventMode Edited May 8, 2005 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now