Jump to content

Recommended Posts

Posted

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

#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!!!

Posted

The problem is here. There's no control called "$close" so it's calling CloseStartmenu() every loop.

Case $Close
            CloseStartmenu()
Posted

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.

Posted

and i can fix this how?

Replace your Global Variables line with this:

Global $List1, $Close=1, $Open=1, $Start, $Form1, $startmenu
Posted (edited)

How's this?

#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 by Nahuel
Posted

@Hour

@Min

@Sec

tyvm is this the best way to do this it flickes ALOT

#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
Posted

#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

Posted

#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
tyvm but it fixed now.

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
×
×
  • Create New...