Jump to content

Calendar


 Share

Recommended Posts

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

Link to comment
Share on other sites

Without seeing your code it is hard to help ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...