Sign in to follow this  
Followers 0
DaProgrammer

Function wont run, why ?

4 posts in this topic

#1 ·  Posted (edited)

i made a gui, whick calls a child gui and from that gui i have a button that runs a func but it wont work, plz help me find my prob.

run it and click new task, then nither of the 2 buttons work ? why is that ?

i seperated the part of the 2 buttons

Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
#include <GuiConstants.au3>
#include <GuiList.au3>
$Hide=1
$New_Task = 0
#region - Tray
$Tray_Hide = TrayCreateItem("Hide/Show")
TrayItemSetOnEvent($Tray_Hide,"Hide")
$Tray_Exit = TrayCreateItem("Exit")
TrayItemSetOnEvent($Tray_Exit,"Exitt")
Func Exitt()
    Exit
EndFunc
#endregion
;
#region -  Main
$Main=GuiCreate("KJ's Alarm Clock", 250, 390,-1, -1 ,"",$WS_EX_TOOLWINDOW)

GuiCtrlCreateLabel("Date: "&@MDAY&"/"&@MON&"/"&@YEAR, 10, 10, 100, 15,$ss_center)
$Label_Time = GuiCtrlCreateLabel("Time: "&@HOUR&":"&@MIN&":"&@SEC, 120, 10, 100, 15,$ss_center)
$List = GuiCtrlCreateList("", 10, 30, 230, 300)
$Button_new = GuiCtrlCreateButton("New Task", 20, 330, 80, 30)
GUICtrlSetOnEvent($Button_new,"NewTask")
$Button_Del = GuiCtrlCreateButton("Delete Task", 150, 330, 80, 30)
GUICtrlSetOnEvent($Button_Del,"Delete")[/size]

GuiSetState()
While 1
Sleep(1000)
GUICtrlSetData($Label_Time,"Time: "&@HOUR&":"&@MIN&":"&@SEC)
WEnd
#endregion
;

#region - New Task
Func NewTask()
GUISetState(@SW_HIDE,$Main)
$New_Task = GuiCreate("New Task", 250, 390,-1, -1 ,"",$WS_EX_TOOLWINDOW,$Main)

GuiCtrlCreateLabel("Date:", 10, 12, 30, 15)
$Input_Day = GuiCtrlCreateInput(@MDAY, 50, 10, 20, 20)
$Input_Month = GuiCtrlCreateInput(@MON, 75, 10, 20, 20)
$Input_Year = GuiCtrlCreateInput(@YEAR, 100, 10, 40, 20)

GuiCtrlCreateLabel("Time:", 10, 37, 30, 15)
$Input_Hour = GuiCtrlCreateInput(@HOUR, 50, 35, 25, 20)
$Input_Min = GuiCtrlCreateInput(@MIN, 82.5, 35, 25, 20)
$Input_Sec = GuiCtrlCreateInput(@SEC, 115, 35, 25, 20)









$Button_Save = GuiCtrlCreateButton("Save", 100, 330, 60, 30)
GUICtrlSetOnEvent($Button_Save,"Save")
$Button_File = GuiCtrlCreateButton("Add File", 20, 330, 60, 30)
GUICtrlSetOnEvent($Button_File,"file")












GuiSetState()
While 1
Sleep(100)
WEnd
EndFunc
#endregion
;

#region - Functions
Func file()
;~  $file = FileOpenDialog("", "", "Music (*.mp3;*.wav)", 1 + 2 )
    Exit
EndFunc

Func Save()
    GUIDelete($New_Task)
    GUISetState(@SW_SHOW,$Main)
EndFunc

Func Hide()
    If $Hide=1 Then
        GUISetState(@SW_HIDE,$Main)
        $Hide=0
        Return
    Else
        GUISetState(@SW_SHOW,$Main)
        $Hide=1
        Return
    EndIf   
EndFunc
;
Func Delete()
    _GUICtrlListDeleteItem ($List,_GUICtrlListGetCaretIndex($List))
EndFunc
;
#endregion
;
Edited by DaProgrammer

Share this post


Link to post
Share on other sites



You have 2 loops.

and... ? whats the problem ? the gui's are based on event not on getmsg.


Share this post


Link to post
Share on other sites

You have 2 loops.

OMFG !!! Thank you Volly, why the hell does it matter i dont know but it works :whistle:


Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0