Jump to content

GUICtrlCreateDate with $DTS_SHOWNONE


DW1
 Share

Recommended Posts

Using the Date style $DTS_SHOWNONE, makes a little checkbox next to the date.

$DueDate = GUICtrlCreateDate("", 520, 54, 95, 17, $DTS_SHOWNONE)

How can I tell if this is checked or not. I can see it, but on a GuiCtrlRead I only see the date, doesn't matter if its checked or not.

I need to be able to know if this was checked or not.

Thank you in advance.

---Side note---

Sorry I haven't been helping/posting in a while, I just finished training for my new position :)

Link to comment
Share on other sites

Auto3Library is answer.

In Auto3Library's _DTP_GetSystemTimeEx($hWnd) returns this flag in @error and @extended

_DTP_GetSystemTimeEx($hWnd)
if @error = $GDT_NONE Then ...

#include <GUIConstants.au3>
#include <A3LDateTimePick.au3>

GUICreate("My GUI get date", 200, 200)
$Datum = GUICtrlCreateDate("", 1, "test", 190, 20, BitOR($DTS_SHORTDATEFORMAT, $DTS_SHOWNONE))
$Datum_hwnd = GUICtrlGetHandle($Datum)
$b = GUICtrlCreateButton('Check', 10, 50, 100, 20)
GUISetState()

Do
    $msg = GUIGetMsg()
    If $msg = $b Then
        _DTP_GetSystemTimeEx($Datum_hwnd)
        If @error = $GDT_NONE Then 
            $state = 'unchecked'
        Else
            $state = 'checked'
        EndIf
        MsgBox(0, GUICtrlRead($Datum, 1), $state)
;~         MsgBox(0, GUICtrlRead($Datum, 1), GUICtrlGetState($Datum) & @CRLF)
    EndIf
Until $msg = $GUI_EVENT_CLOSE
Edited by Zedna
Link to comment
Share on other sites

From MSDN

DTS_SHOWNONE

It is possible to have no date currently selected in the control. With this style, the control displays a check box that is automatically selected whenever a date is picked or entered. If the check box is subsequently deselected, the application cannot retrieve the date from the control because, in essence, the control has no date. The state of the check box can be set with the DTM_SETSYSTEMTIME message or queried with the DTM_GETSYSTEMTIME message.

So in the beta help

_GUICtrlDTP_GetSystemTime

or

_GUICtrlDTP_GetSystemTimeEx

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Auto3Library is answer.

In Auto3Library's _DTP_GetSystemTimeEx($hWnd) returns this flag in @error and @extended

_DTP_GetSystemTimeEx($hWnd)
if @error = $GDT_NONE Then ...

#include <GUIConstants.au3>
#include <A3LDateTimePick.au3>

GUICreate("My GUI get date", 200, 200)
$Datum = GUICtrlCreateDate("", 1, "test", 190, 20, BitOR($DTS_SHORTDATEFORMAT, $DTS_SHOWNONE))
$Datum_hwnd = GUICtrlGetHandle($Datum)
$b = GUICtrlCreateButton('Check', 10, 50, 100, 20)
GUISetState()

Do
    $msg = GUIGetMsg()
    If $msg = $b Then
        _DTP_GetSystemTimeEx($Datum_hwnd)
        If @error = $GDT_NONE Then 
            $state = 'unchecked'
        Else
            $state = 'checked'
        EndIf
        MsgBox(0, GUICtrlRead($Datum, 1), $state)
;~         MsgBox(0, GUICtrlRead($Datum, 1), GUICtrlGetState($Datum) & @CRLF)
;~         GUICtrlSetState($Datum, $gui_disable)
    EndIf
Until $msg = $GUI_EVENT_CLOSE
No need for external library install for many of these functions Zedna, beta now has most of them

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 11 months later...

If I have it checked or not it always it returns as "checked". (I simply replaced Zedna's example with Gary's suggestion) :)

#include <GUIConstants.au3>
#Include <GuiDateTimePicker.au3>

GUICreate("My GUI get date", 200, 200)
$Datum = GUICtrlCreateDate("", 1, "test", 190, 20, BitOR($DTS_SHORTDATEFORMAT, $DTS_SHOWNONE))
$Datum_hwnd = GUICtrlGetHandle($Datum)
$b = GUICtrlCreateButton('Check', 10, 50, 100, 20)
GUISetState()

Do
    $msg = GUIGetMsg()
    If $msg = $b Then
        _GUICtrlDTP_GetSystemTime($Datum_hwnd)
        If @error = $GDT_NONE Then
            $state = 'unchecked'
        Else
            $state = 'checked'
        EndIf
        MsgBox(0, GUICtrlRead($Datum, 1), $state)
    EndIf
Until $msg = $GUI_EVENT_CLOSE
Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Ok.. _GUICtrlDTP_GetSystemTime doesn't work, and _GUICtrlDTP_GetSystemTimeEx does. (I didn't pay attention to the example) :)

#include <GUIConstants.au3>
#Include <GuiDateTimePicker.au3>

GUICreate("My GUI get date", 200, 200)
$Datum = GUICtrlCreateDate("", 1, "test", 190, 20, BitOR($DTS_SHORTDATEFORMAT, $DTS_SHOWNONE))
$Datum_hwnd = GUICtrlGetHandle($Datum)
$b = GUICtrlCreateButton('Check', 10, 50, 100, 20)
GUISetState()

Do
    $msg = GUIGetMsg()
    If $msg = $b Then
        _GUICtrlDTP_GetSystemTimeEx($Datum_hwnd )
        If @error = $GDT_NONE Then
            $state = 'unchecked'
        Else
            $state = 'checked'
        EndIf
        MsgBox(0, GUICtrlRead($Datum, 1), $state)
    EndIf
Until $msg = $GUI_EVENT_CLOSE
Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
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...