ashley Posted October 14, 2007 Share Posted October 14, 2007 ok i saw justinrenos OS shell and it gave me the idea to make my own, i have came across a problem tho the start button flickers like mad and when clicked nothing happends any ideas? here my code expandcollapse popup#include <GUIConstants.au3> Global $List1, $Close, $Open, $Start, $Form1, $startmenu #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("OS shell", 633, 430, 193, 115) GUISetBkColor(0x808080) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Startmenu() Case $Close CloseStartmenu() Case $Open EndSwitch WEnd Func Startmenu() GUICtrlDelete($Start) $Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0) $startmenu = GUICtrlCreateList("", 8, 305, 121, 97) GUICtrlSetData(-1, "Notepad") $Close = GUICtrlCreateButton("X", 83, 409, 35, 17, 0) EndFunc Func CloseStartmenu() GUICtrlDelete($startmenu) GUICtrlDelete($Close) GUICtrlDelete($Open) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) EndFunc i cant find anyting wrong with it!!! Free icons for your programs Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 The problem is here. There's no control called "$close" so it's calling CloseStartmenu() every loop. Case $Close CloseStartmenu() Link to comment Share on other sites More sharing options...
ashley Posted October 14, 2007 Author Share Posted October 14, 2007 The problem is here. There's no control called "$close" so it's calling CloseStartmenu() every loop. Case $Close CloseStartmenu()and i can fix this how? Free icons for your programs Link to comment Share on other sites More sharing options...
Paulie Posted October 14, 2007 Share Posted October 14, 2007 Nahuel is right. At the top of your code, you declare $Close, but that makes it by default equal to what is returned by GUIGetMsg when nothing is pressed Perhaps you should look into OnEventMode. Link to comment Share on other sites More sharing options...
Paulie Posted October 14, 2007 Share Posted October 14, 2007 and i can fix this how?Replace your Global Variables line with this: Global $List1, $Close=1, $Open=1, $Start, $Form1, $startmenu Link to comment Share on other sites More sharing options...
ashley Posted October 14, 2007 Author Share Posted October 14, 2007 (edited) perfect thanks, nvm mind found the time func Edited October 14, 2007 by ashley Free icons for your programs Link to comment Share on other sites More sharing options...
Paulie Posted October 14, 2007 Share Posted October 14, 2007 @Hour @Min @Sec Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 (edited) How's this? expandcollapse popup#include <GUIConstants.au3> Global $List1, $Close, $Open, $Start, $Form1, $startmenu #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("OS shell", 633, 430, 193, 115) GUISetBkColor(0x808080) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) $Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $startmenu = GUICtrlCreateList("", 8, 305, 121, 97) GUICtrlSetData(-1, "Notepad") GUICtrlSetState(-1, $GUI_HIDE) $Close = GUICtrlCreateButton("X", 83, 409, 35, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Startmenu() Case $Close CloseStartmenu() Case $Open EndSwitch WEnd Func Startmenu() GUIctrlSetState($Start,$GUI_HIDE) GUICtrlSetState($Open, $GUI_SHOW) GUICtrlSetState($Startmenu, $GUI_SHOW) GUICtrlSetState($Close, $GUI_SHOW) EndFunc Func CloseStartmenu() GUICtrlSetState($Open, $GUI_HIDE) GUICtrlSetState($Startmenu, $GUI_HIDE) GUICtrlSetState($Close, $GUI_HIDE) GUIctrlSetState($Start,$GUI_SHOW) EndFunc I think it'll be a bit more efficient this way, since you won't be creating and deleting controls like mad. Edited October 14, 2007 by Nahuel Link to comment Share on other sites More sharing options...
ashley Posted October 14, 2007 Author Share Posted October 14, 2007 @Hour @Min @Sectyvm is this the best way to do this it flickes ALOT expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> Global $List1, $Close=1, $Open=1, $Start, $Form1, $startmenu, $date, $Closedate #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("OS shell", 633, 430, 193, 115) GUISetBkColor(0x808080) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) $Time = GUICtrlCreateButton(@Hour & ":" & @Min, 544, 409, 75, 17, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() GUICtrlSetData($Time, @Hour & ":" & @Min) Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Startmenu() Case $Close CloseStartmenu() Case $Open Case $Time $date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161) $Closedate = GUICtrlCreateButton("X", 504, 409, 35, 17, 0) Case $Closedate GUICtrlDelete($date) EndSwitch WEnd Func Startmenu() GUICtrlDelete($Start) $Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0) $startmenu = GUICtrlCreateList("", 8, 305, 121, 97) GUICtrlSetData(-1, "Notepad") $Close = GUICtrlCreateButton("X", 83, 409, 35, 17, 0) EndFunc Func CloseStartmenu() GUICtrlDelete($startmenu) GUICtrlDelete($Close) GUICtrlDelete($Open) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) EndFunc Free icons for your programs Link to comment Share on other sites More sharing options...
Paulie Posted October 14, 2007 Share Posted October 14, 2007 Try this: If GuiCtrlRead($Time) <> @Hour & ":" & @Min then GUICtrlSetData($Time, @Hour & ":" & @Min) Link to comment Share on other sites More sharing options...
Nahuel Posted October 14, 2007 Share Posted October 14, 2007 expandcollapse popup#include <GUIConstants.au3> Global $List1, $Close, $Open, $Start, $Form1, $startmenu #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("OS shell", 633, 430, 193, 115) GUISetBkColor(0x808080) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) $Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $startmenu = GUICtrlCreateList("", 8, 305, 121, 97) GUICtrlSetData(-1, "Notepad") GUICtrlSetState(-1, $GUI_HIDE) $Close = GUICtrlCreateButton("X", 83, 409, 35, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161) GUICtrlSetState(-1, $GUI_HIDE) $Closedate = GUICtrlCreateButton("X", 504, 409, 35, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $Time = GUICtrlCreateButton(@Hour & ":" & @Min, 544, 409, 75, 17, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### AdlibEnable("refresh_time",2000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Startmenu() Case $Close CloseStartmenu() Case $Open Case $Time GUICtrlSetState($date, $GUI_SHOW) GUICtrlSetState($Closedate, $GUI_SHOW) Case $Closedate GUICtrlSetState($date, $GUI_HIDE) GUICtrlSetState($Closedate, $GUI_HIDE) EndSwitch WEnd Func Startmenu() GUIctrlSetState($Start,$GUI_HIDE) GUICtrlSetState($Open, $GUI_SHOW) GUICtrlSetState($Startmenu, $GUI_SHOW) GUICtrlSetState($Close, $GUI_SHOW) EndFunc Func CloseStartmenu() GUICtrlSetState($Open, $GUI_HIDE) GUICtrlSetState($Startmenu, $GUI_HIDE) GUICtrlSetState($Close, $GUI_HIDE) GUIctrlSetState($Start,$GUI_SHOW) EndFunc Func refresh_time() GUICtrlSetData($Time,@Hour & ":" & @Min) EndFunc Link to comment Share on other sites More sharing options...
ashley Posted October 14, 2007 Author Share Posted October 14, 2007 Try this: If GuiCtrlRead($Time) <> @Hour & ":" & @Min then GUICtrlSetData($Time, @Hour & ":" & @Min)tyvm Free icons for your programs Link to comment Share on other sites More sharing options...
Paulie Posted October 14, 2007 Share Posted October 14, 2007 So if you are seriously creating an OS shell OnEvent mode is probably going to be more efficient. Link to comment Share on other sites More sharing options...
ashley Posted October 14, 2007 Author Share Posted October 14, 2007 expandcollapse popup#include <GUIConstants.au3> Global $List1, $Close, $Open, $Start, $Form1, $startmenu #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("OS shell", 633, 430, 193, 115) GUISetBkColor(0x808080) $Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0) $Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $startmenu = GUICtrlCreateList("", 8, 305, 121, 97) GUICtrlSetData(-1, "Notepad") GUICtrlSetState(-1, $GUI_HIDE) $Close = GUICtrlCreateButton("X", 83, 409, 35, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161) GUICtrlSetState(-1, $GUI_HIDE) $Closedate = GUICtrlCreateButton("X", 504, 409, 35, 17, 0) GUICtrlSetState(-1, $GUI_HIDE) $Time = GUICtrlCreateButton(@Hour & ":" & @Min, 544, 409, 75, 17, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### AdlibEnable("refresh_time",2000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Startmenu() Case $Close CloseStartmenu() Case $Open Case $Time GUICtrlSetState($date, $GUI_SHOW) GUICtrlSetState($Closedate, $GUI_SHOW) Case $Closedate GUICtrlSetState($date, $GUI_HIDE) GUICtrlSetState($Closedate, $GUI_HIDE) EndSwitch WEnd Func Startmenu() GUIctrlSetState($Start,$GUI_HIDE) GUICtrlSetState($Open, $GUI_SHOW) GUICtrlSetState($Startmenu, $GUI_SHOW) GUICtrlSetState($Close, $GUI_SHOW) EndFunc Func CloseStartmenu() GUICtrlSetState($Open, $GUI_HIDE) GUICtrlSetState($Startmenu, $GUI_HIDE) GUICtrlSetState($Close, $GUI_HIDE) GUIctrlSetState($Start,$GUI_SHOW) EndFunc Func refresh_time() GUICtrlSetData($Time,@Hour & ":" & @Min) EndFunctyvm but it fixed now. Free icons for your programs 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