TheGOG Posted May 28, 2006 Share Posted May 28, 2006 I created a test script and can't get the script to recognize the buttons clicked. This time I'm including the code Thank you. #include <Array.au3> #include <GUIConstants.au3> #include <Color.au3> ;Opt("GUICoordMode",1) Opt("GUIOnEventMode", 1) Dim $I=0 Dim $J=0 Dim $T=0 Dim $PrevPageNo=1 Dim $CurrentPageNo=1 Dim $NextPageNo=1 Dim $LastPage="N" Dim $CountEmpty = 0 Dim $StartNo = 0 Dim $NP = 0 Dim $PP = 0 Dim $EXE = 0 Dim $RKN = "" Dim $RKD = "" Dim $Skip = "" $I = 0 $J = 0 Dim $RowDisplay[22] $RowDisplay[0] = 0 $RowDisplay[1] = 55 For $I = 2 To 20 $RowDisplay[$I] = $RowDisplay[$I-1] + 25 Next Dim $Refresh = "Y" ;If $Refresh = "Y" Then ; $Refresh = "N" Create_Main_Window() ;EndIf GUISetState(@SW_SHOW) While 1 ;GUISetState(@SW_SHOW) Sleep(10) Wend Func Create_Main_Window() $Main_Window = GUICreate("Tesing buttons", 850, 600) GUISetOnEvent($GUI_EVENT_CLOSE, "CC") ; ; Setup Headers ; $GUIRKN = GUICtrlCreateLabel ("Testing Header 1", 35, 15, 210) ; first cell 50 width GUICtrlSetFont($GUIRKN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRKN,0x0000ff) ; Blue $GUIRDN = GUICtrlCreateLabel ("Testing Header 2", 315, 15, 400) GUICtrlSetFont($GUIRDN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRDN,0x0000ff) ; Blue ; ; Setup Main Data Lines ; SETUP_Main_Data_Lines() ; ; Setup Footers(Buttons) ; $NP = GUICtrlCreateButton ("NewPage", 700, $RowDisplay[19]+28, 100, 35) GUICtrlSetState($NP, $GUI_ENABLE) GUISetOnEvent($NP, "NewPage") $PP = GUICtrlCreateButton ("PrevPage", 50, $RowDisplay[19]+28, 100, 35) GUICtrlSetState($PP, $GUI_ENABLE) GUISetOnEvent($PP, "PrevPage") ;If $CurrentPageNo = 1 Then ; GUICtrlDelete($PP) ;Else ; If $LastPage = "Y" Then ;GUICtrlDelete($NP) ; EndIf ;EndIf ;GUICtrlCreateButton ("Exit", 275, $RowDisplay[19]+28, 100, 35) $EXE = GUICtrlCreateButton ("Proc", 290, $RowDisplay[19]+28, 225, 35) GUICtrlSetState($EXE, $GUI_ENABLE) GUISetOnEvent($EXE, "Proc") ;GUISetState(@SW_SHOW) EndFunc Func SETUP_Main_Data_Lines() $J = 0 For $I = ( ( ($CurrentPageNo - 1) * 18) + 1) To $CurrentPageNo + 18 $J = $J + 1 GUICtrlCreateLabel ("Testing Label # " & String($I), 40, $RowDisplay[$J], 275) ; first cell 50 width GUICtrlCreateLabel ("Testing Row # " & String($J), 315, $RowDisplay[$J], 350) Next EndFunc Func NewPage() MsgBox(0, "Next Page", "OK!") EndFunc Func PrevPage() MsgBox(0, "Previous Page", "OK!") EndFunc Func Proc() MsgBox(0, "Execute", "OK!") EndFunc Func CC() Exit EndFuncTbutt2.txt Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 28, 2006 Moderators Share Posted May 28, 2006 Instead of GUISetOnEvent(), you are trying to set Control Events so it would be GUICtrlSetOnEvent(). Also please use [ code] [ /code] tags without the spaces when posting your scripts, makes it easier to read instead of having to put in SciTe to read it.expandcollapse popup#include <Array.au3> #include <GUIConstants.au3> #include <Color.au3> ;Opt("GUICoordMode",1) Opt("GUIOnEventMode", 1) Dim $I=0 Dim $J=0 Dim $T=0 Dim $PrevPageNo=1 Dim $CurrentPageNo=1 Dim $NextPageNo=1 Dim $LastPage="N" Dim $CountEmpty = 0 Dim $StartNo = 0 Dim $NP = 0 Dim $PP = 0 Dim $EXE = 0 Dim $RKN = "" Dim $RKD = "" Dim $Skip = "" $I = 0 $J = 0 Dim $RowDisplay[22] $RowDisplay[0] = 0 $RowDisplay[1] = 55 For $I = 2 To 20 $RowDisplay[$I] = $RowDisplay[$I-1] + 25 Next Dim $Refresh = "Y" ;If $Refresh = "Y" Then ; $Refresh = "N" Create_Main_Window() ;EndIf GUISetState(@SW_SHOW) While 1 ;GUISetState(@SW_SHOW) Sleep(10) WEnd Func Create_Main_Window() $Main_Window = GUICreate("Tesing buttons", 850, 600) GUISetOnEvent($GUI_EVENT_CLOSE, "CC") $GUIRKN = GUICtrlCreateLabel("Testing Header 1", 35, 15, 210) ; first cell 50 width GUICtrlSetFont($GUIRKN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRKN,0x0000ff) ; Blue $GUIRDN = GUICtrlCreateLabel("Testing Header 2", 315, 15, 400) GUICtrlSetFont($GUIRDN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRDN,0x0000ff) ; Blue SETUP_Main_Data_Lines() $NP = GUICtrlCreateButton("NewPage", 700, $RowDisplay[19]+28, 100, 35) GUICtrlSetOnEvent($NP, "NewPage") $PP = GUICtrlCreateButton("PrevPage", 50, $RowDisplay[19]+28, 100, 35) GUICtrlSetOnEvent($PP, "PrevPage") $EXE = GUICtrlCreateButton("Proc", 290, $RowDisplay[19]+28, 225, 35) GUICtrlSetOnEvent($EXE, "Proc") EndFunc ;==>Create_Main_Window Func SETUP_Main_Data_Lines() $J = 0 For $I = ((($CurrentPageNo - 1) * 18) + 1) To $CurrentPageNo + 18 $J = $J + 1 GUICtrlCreateLabel("Testing Label # " & String($I), 40, $RowDisplay[$J], 275) ; first cell 50 width GUICtrlCreateLabel("Testing Row # " & String($J), 315, $RowDisplay[$J], 350) Next EndFunc ;==>SETUP_Main_Data_Lines Func NewPage() MsgBox(0, "Next Page", "OK!") EndFunc ;==>NewPage Func PrevPage() MsgBox(0, "Previous Page", "OK!") EndFunc ;==>PrevPage Func Proc() MsgBox(0, "Execute", "OK!") EndFunc ;==>Proc Func CC() Exit EndFunc ;==>CC Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
TheGOG Posted May 28, 2006 Author Share Posted May 28, 2006 Instead of GUISetOnEvent(), you are trying to set Control Events so it would be GUICtrlSetOnEvent(). Also please use [ code] [ /code] tags without the spaces when posting your scripts, makes it easier to read instead of having to put in SciTe to read it.expandcollapse popup#include <Array.au3> #include <GUIConstants.au3> #include <Color.au3> ;Opt("GUICoordMode",1) Opt("GUIOnEventMode", 1) Dim $I=0 Dim $J=0 Dim $T=0 Dim $PrevPageNo=1 Dim $CurrentPageNo=1 Dim $NextPageNo=1 Dim $LastPage="N" Dim $CountEmpty = 0 Dim $StartNo = 0 Dim $NP = 0 Dim $PP = 0 Dim $EXE = 0 Dim $RKN = "" Dim $RKD = "" Dim $Skip = "" $I = 0 $J = 0 Dim $RowDisplay[22] $RowDisplay[0] = 0 $RowDisplay[1] = 55 For $I = 2 To 20 $RowDisplay[$I] = $RowDisplay[$I-1] + 25 Next Dim $Refresh = "Y" ;If $Refresh = "Y" Then ; $Refresh = "N" Create_Main_Window() ;EndIf GUISetState(@SW_SHOW) While 1 ;GUISetState(@SW_SHOW) Sleep(10) WEnd Func Create_Main_Window() $Main_Window = GUICreate("Tesing buttons", 850, 600) GUISetOnEvent($GUI_EVENT_CLOSE, "CC") $GUIRKN = GUICtrlCreateLabel("Testing Header 1", 35, 15, 210) ; first cell 50 width GUICtrlSetFont($GUIRKN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRKN,0x0000ff) ; Blue $GUIRDN = GUICtrlCreateLabel("Testing Header 2", 315, 15, 400) GUICtrlSetFont($GUIRDN, 14, 800, 0, "Arial Bold") GUICtrlSetColor($GUIRDN,0x0000ff) ; Blue SETUP_Main_Data_Lines() $NP = GUICtrlCreateButton("NewPage", 700, $RowDisplay[19]+28, 100, 35) GUICtrlSetOnEvent($NP, "NewPage") $PP = GUICtrlCreateButton("PrevPage", 50, $RowDisplay[19]+28, 100, 35) GUICtrlSetOnEvent($PP, "PrevPage") $EXE = GUICtrlCreateButton("Proc", 290, $RowDisplay[19]+28, 225, 35) GUICtrlSetOnEvent($EXE, "Proc") EndFunc ;==>Create_Main_Window Func SETUP_Main_Data_Lines() $J = 0 For $I = ((($CurrentPageNo - 1) * 18) + 1) To $CurrentPageNo + 18 $J = $J + 1 GUICtrlCreateLabel("Testing Label # " & String($I), 40, $RowDisplay[$J], 275) ; first cell 50 width GUICtrlCreateLabel("Testing Row # " & String($J), 315, $RowDisplay[$J], 350) Next EndFunc ;==>SETUP_Main_Data_Lines Func NewPage() MsgBox(0, "Next Page", "OK!") EndFunc ;==>NewPage Func PrevPage() MsgBox(0, "Previous Page", "OK!") EndFunc ;==>PrevPage Func Proc() MsgBox(0, "Execute", "OK!") EndFunc ;==>Proc Func CC() Exit EndFunc ;==>CC Dohhhhh Thank you very much. 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