Sign in to follow this  
Followers 0
natiun

Calendar

9 posts in this topic

Hi!

i have a problem with a making calendar in user form that i already have is like gui in gui, well the problem that i have is that i made some code for picking a date by double click but nothing happend and the programe is freezed.

i would like some help with general idea for how to do it

Share this post


Link to post
Share on other sites



Without seeing your code it is hard to help ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I am realy just start to learn coding, i know that is realy not the best to  do it but any way it is not working, for now i just write to the consol but i want to use it for other things, if i am seperate it and i run only the calendar code it work perfect, just the way that i want it.  

#include <GUIConstantsEx.au3>


Opt("GuiOnEventMode", 1)
$Form1_1 = GUICreate("My Way To Make It", 300, 200, 400, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$Input1 = GUICtrlCreateInput("", 72, 64, 113, 24)
GUICtrlSetFont(-1, 10, 800, 0, "Biondi")
$Label2 = GUICtrlCreateLabel("Date", 10, 64, 48, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Biondi")

$Button1 = GUICtrlCreateButton("Calendar", 72, 128, 161, 41)
GUICtrlSetOnEvent($Button1, "Calendar_Open")
$Button2 = GUICtrlCreateButton("Terminate", 1208, 520, 161, 73)
GUICtrlSetOnEvent($Button2, "Terminate")

GUISetState(@SW_SHOW)


Global $guiCal

Func Calendar_Open()
    Local $Calendar, $msg, $begin, $DblClk = 0, $Output = ""
    $guiCal = GUICreate("Calender", 271, 201, -1, -1, -1, 0, $Form1_1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")
    $Calendar = GUICtrlCreateMonthCal(@YDAY & "-" & @MON & "-" & @YEAR, 1, 1, 270, 200, 0x0004) ; $MCS_WEEKNUMBERS)
    GUISetState(@SW_SHOW, $guiCal)
    GUISwitch($Calendar)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $Calendar
                ; Check for double click
                $begin = TimerInit()
                While 1
                    $msg = GUIGetMsg()
                    If $msg = $Calendar Then $DblClk = 1
                    If TimerDiff($begin) > 500 Then ExitLoop
                WEnd
                If $DblClk = 1 Then
                    $Output = GUICtrlRead($Calendar)
                    $Output = StringRight($Output, 2) & "/" & StringMid($Output, 6, 2) & "/" & StringLeft($Output, 4)
                ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sOutput = ' & $Output & @CRLF & @CRLF)
                EndIf
        EndSwitch
    WEnd
    GUIDelete($guiCal)
EndFunc

Func Terminate()
Exit 0
EndFunc ;==>Terminate

Func _Close()
   GUIDelete($guiCal)
EndFunc

Func _Exit()
    GUIDelete($Form1_1)
    Exit
EndFunc ;==>_Exit


While 1
    $nMsg = GUIGetMsg()
    Sleep(1000)
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
        Calendar_Open()
    EndSwitch


WEnd

Share this post


Link to post
Share on other sites

You are mixing event and message mode.

"OnEvent functions are only called when the option GUIOnEventMode is set to 1 - when in this mode GUIGetMsg is NOT used at all.".

You have to decide to use one or the other.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

how can i do it i tried but still it doesn't work!

Share this post


Link to post
Share on other sites

You try to work with 2 GUIs at the same time. The wiki has a good tutorial on this subject.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks it help, 

but there is no way to use them both?

Share this post


Link to post
Share on other sites

As I understand it event and message mode can't be mixed.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks

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