WTS Posted June 22, 2006 Share Posted June 22, 2006 Hi there! me again.. you guys been very helpful, I can't figure out why this doesn't work.. I want to set a function for all controls instead of multiple functions for one control.. expandcollapse popup#include <GUIConstants.au3> Opt('GUIOnEventMode',1) Opt("GUICoordMode",2) $Form1 = GUICreate("AForm1", 622, 447, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP)) $Button1 = GUICtrlCreateButton("AButton1", 78, 86, 151, 28) $Button2 = GUICtrlCreateButton("AButton2", 83, 157, 147, 29) $Button3 = GUICtrlCreateButton("AButton3", 80, 206, 151, 28) $Radio1 = GUICtrlCreateRadio("ARadio1", 126, 290, 94, 22) GUISetOnEvent($GUI_EVENT_CLOSE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_RESTORE, "_FuncGUI") GUISetOnEvent($Button1,'_FuncGUI') GUISetOnEvent($Button2,'_FuncGUI') GUISetOnEvent($Button3,'_FuncGUI') GUISetState(@SW_SHOW) While 1 WEnd Func _FuncGUI() Select Case @GUI_CTRLID = $Button1 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $Button2 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $Button3 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc Link to comment Share on other sites More sharing options...
GaryFrost Posted June 22, 2006 Share Posted June 22, 2006 expandcollapse popup#include <GUIConstants.au3> Opt('GUIOnEventMode', 1) $Form1 = GUICreate("AForm1", 622, 447, 192, 125, BitOR($WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_TABSTOP)) $Button1 = GUICtrlCreateButton("AButton1", 10, 86, 151, 28) $Button2 = GUICtrlCreateButton("AButton2", 10, 157, 147, 29) $Button3 = GUICtrlCreateButton("AButton3", 10, 206, 151, 28) $Radio1 = GUICtrlCreateRadio("ARadio1", 10, 290, 94, 22) GUISetOnEvent($GUI_EVENT_CLOSE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_RESTORE, "_FuncGUI") GUICtrlSetOnEvent($Button1, '_FuncGUI'); use GuiCtrlSetOnEvent for controls GUICtrlSetOnEvent($Button2, '_FuncGUI') GUICtrlSetOnEvent($Button3, '_FuncGUI') GUICtrlSetOnEvent($Radio1, '_FuncGUI') GUISetState(@SW_SHOW) While 1 WEnd Func _FuncGUI() Select Case @GUI_CtrlId = $Button1 MsgBox(0, 'Button Clicked', 'Button 1') Case @GUI_CtrlId = $Button2 MsgBox(0, 'Button Clicked', 'Button 2') Case @GUI_CtrlId = $Radio1 MsgBox(0, 'Radio1 Clicked', 'Radio 1') Case @GUI_CtrlId = $Button3 MsgBox(0, 'Button Clicked', 'Button 3') Case @GUI_CtrlId = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) Case @GUI_CtrlId = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) EndSelect EndFunc ;==>_FuncGUI SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Nomad Posted June 22, 2006 Share Posted June 22, 2006 Hi there! me again.. you guys been very helpful, I can't figure out why this doesn't work.. I want to set a function for all controls instead of multiple functions for one control.. expandcollapse popup#include <GUIConstants.au3> Opt('GUIOnEventMode',1) Opt("GUICoordMode",2) $Form1 = GUICreate("AForm1", 622, 447, 192, 125, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_TABSTOP)) $Button1 = GUICtrlCreateButton("AButton1", 78, 86, 151, 28) $Button2 = GUICtrlCreateButton("AButton2", 83, 157, 147, 29) $Button3 = GUICtrlCreateButton("AButton3", 80, 206, 151, 28) $Radio1 = GUICtrlCreateRadio("ARadio1", 126, 290, 94, 22) GUISetOnEvent($GUI_EVENT_CLOSE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_FuncGUI") GUISetOnEvent($GUI_EVENT_RESTORE, "_FuncGUI") GUISetOnEvent($Button1,'_FuncGUI') GUISetOnEvent($Button2,'_FuncGUI') GUISetOnEvent($Button3,'_FuncGUI') GUISetState(@SW_SHOW) While 1 WEnd Func _FuncGUI() Select Case @GUI_CTRLID = $Button1 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $Button2 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $Button3 Msgbox(0,'Button Clicked','Button 1') Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Exit Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE) EndSelect EndFunc What about it doesn't work? What have you tried? What does work? Be more specific when asking questions. Does @GUI_CTRLID work with $GUI_EVENT_MINIMIZE, $GUI_EVENT_CLOSE, and $GUI_EVENT_RESTORE? I've never tried to use it on them, but I see no reason why your buttons should not be working. Nomad Link to comment Share on other sites More sharing options...
GaryFrost Posted June 22, 2006 Share Posted June 22, 2006 What about it doesn't work? What have you tried? What does work? Be more specific when asking questions. Does @GUI_CTRLID work with $GUI_EVENT_MINIMIZE, $GUI_EVENT_CLOSE, and $GUI_EVENT_RESTORE? I've never tried to use it on them, but I see no reason why your buttons should not be working.Nomad Then you might want to look at what I posted as to why it wasn't working!!! SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
WTS Posted June 22, 2006 Author Share Posted June 22, 2006 DOH!!! I had GUISetOnEvent instead of GUICtrlSetOnEvent.. thanks!! Link to comment Share on other sites More sharing options...
Nomad Posted June 22, 2006 Share Posted June 22, 2006 Then you might want to look at what I posted as to why it wasn't working!!! oops Nomad 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