AHK GUI DateTime default setting

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
davesexcel
Posts: 5
Joined: 02 Jan 2019, 13:23
Contact:

AHK GUI DateTime default setting

09 Jan 2019, 11:50

Hello,
Can DefaultOptions := "ChooseNone" for the datetime control to Blank? The problem is when I transfer the info to excel worksheet, the values still shows up, even if the checkbox is not checked.

Code: Select all

            class DateTime extends Tabs.Tab.Workspace.GenericControl
            {
                ControlType := "DateTime"
                DefaultOptions := "ChooseNone"
                New()
                {
				MsgBox, % this.GuiControlGet() ;remove later
				 }
                DateTimeChanged(_CtrlHwnd, _GuiEvent, _EventInfo, _ErrorLevel:="")
                {
				 MsgBox, % this.GuiControlGet() ;remove later
                }
                Clear()
                {
                    this.GuiControl("", A_Now)
                    this.GuiControl("", "")
					this.GuiControl("", "")
                }

Code to worksheet, it loops through all the controls and places the values into the worksheet.

Code: Select all

WorkbookPopulate(MyWorkbook, TabsObj) {
    for TabNumber, ThisTab in TabsObj.TabList {
        for ControlType, ThisControlType in ThisTab.Workspace.Controls {
            ; Special case: skip the TabOrder object TODO maybe this should be rethought? On
            ; the other hand, this simplifies adding controls to the TabOrder
            if (ControlType = "TabOrder")
                    continue
            for ControlName, ThisControl in ThisControlType {
                if (ThisControl.ExcelCell != "") {
                    MyValue := ThisControl.GuiControlGet()
                    ; Change MyValue as a special case for Checkboxes
                    if (ControlType = "Checkbox") {
                        ;~ MyValue := MyValue = 1 ? "a" : "c" ; Use "Marlett" font in template
                        MyValue := MyValue = 1 ? Chr(0x2713) : "" ;Chr(0x2610)
                                                ;Chr(0x2610) - BALLOT BOX
                                                ;Chr(0x2611) - BALLOT BOX WITH CHECK
                                                ;Chr(0x2612) - BALLOT BOX WITH X
                                                ;Chr(0x2713) - CHECK MARK
                                                ;Chr(0x2714) - HEAVY CHECK MARK
                    }
                    if (ControlType = "DateTime")
					FormatTime, MyValue, %MyValue%, MMMM dd, yyyy
                    MyWorkbook.Sheets(ThisControl.ExcelSheet).Range(ThisControl.ExcelCell).Value
                        := MyValue
                }
            }
        }
    }
}
If more code is required, please let me know.
Results
-
transfers dates.jpg
transfers dates.jpg (85.04 KiB) Viewed 1181 times
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: AHK GUI DateTime default setting

12 May 2019, 19:58

Does this belong in the v2 subforum? This is not valid v2 code.

Pretty sure it doesn't, so to Ask for Help it goes.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AHK_user and 222 guests