Sign in to follow this  
Followers 0
c.haslam

$DTS_SHORTDATECENTURYFORMAT

13 posts in this topic

With the following code, Syntax Check reports WARNING: $DTS_SHORTDATECENTURYFORMAT: possibly used before declaration:

CODE
#include

#include

#include

Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1,-1) ; centred

Global $inpDate = _GUICtrlDTP_Create($dlgXCopy,144, 232,120,25,$DTS_SHORTDATECENTURYFORMAT)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

WEnd

GUIDelete()

What am I missing?

...chris


...chris

Share this post


Link to post
Share on other sites



Your kidding right?

Hey, that's my line... :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

No, I'm not kidding. It seems that $DTS_SHORTDATECENTURYFORMAT is not in any of the included files, but it shown in the help for _GUICtrlDTP_Create.

And how do I disable the DTP control. (I realize that $inpDate is a handle.)

Edited by c.haslam

...chris

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

No, I'm not kidding. It seems that $DTS_SHORTDATECENTURYFORMAT is not in any of the included files, but it shown in the help for _GUICtrlDTP_Create.

Considering your example shows no #include file what so ever... guess we are left to assume you've either "A" lost your mind, or "B" think by leaving it blank it will just find the right #include such as:

#Include <GuiDateTimePicker.au3>

Edit:

Just for clarification, I'm a bit behind the times, they may have moved the Beta include from where I have it in version 3.2.9.4 (Yeah I know, just to lazy to update).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Sorry about that. I copied and pasted from SciTe. Somehow the names of the included files went missing. I try again (and manually enter filenames):

CODE
#include <GUIConstants.au3>

#include <GuiDateTimePicker.au3>

#include <WindowsConstants.au3>

Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1,-1) ; centred

Global $hndInpDate = _GUICtrlDTP_Create($dlgXCopy,144, 232,120,25,$DTS_SHORTDATECENTURYFORMAT)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

WEnd

GUIDelete()

Off-topic: I used Insert Codebox. SHould I be using something else to put code into a topic?


...chris

Share this post


Link to post
Share on other sites

Sorry about that. I copied and pasted from SciTe. Somehow the names of the included files went missing. I try again (and manually enter filenames):

CODE
#include <GUIConstants.au3>

#include <GuiDateTimePicker.au3>

#include <WindowsConstants.au3>

Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1,-1) ; centred

Global $hndInpDate = _GUICtrlDTP_Create($dlgXCopy,144, 232,120,25,$DTS_SHORTDATECENTURYFORMAT)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

WEnd

GUIDelete()

Off-topic: I used Insert Codebox. SHould I be using something else to put code into a topic?
You can use [autoit ]insert code[ /autoit](without space) or the code brackets you used for the code.

The value is 0xC for DTS_SHORTDATECENTURYFORMAT

As I said, I have an old beta... mine doesn't have a value and no reference to it in GUI Styles, just a reference to the value on line 61 of the suggested #include... I don't know if it's in either of the 2 other releases or not.

I did read that Comctl32.dll must be older than 5.8 for this style, so if it was omitted for any reason, that is why I would assume.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Looks like either a type-o in the help or the include, I'll have to figure it out.

What is declared in the include is $DTS_SHORTDATECENTFORMAT


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Thanks.

How do I disable the DTP control?


...chris

Share this post


Link to post
Share on other sites

Thanks.

How do I disable the DTP control?

#include <GUIConstantsEx.au3>
#include <DateTimeConstants.au3>

Opt('MustDeclareVars', 1)

Example1()

; example1
Func Example1()
    Local $date, $msg

    GUICreate("My GUI get date", 200, 200, 800, 200)
    $date = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
    GUICtrlSetState($date, $GUI_DISABLE)
    GUISetState()

    ; Run the GUI until the dialog is closed
    Do
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

    MsgBox(0, "Date", GUICtrlRead($date))
    GUIDelete()
EndFunc   ;==>Example1

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

I clarify: how do I disable a _GUICtrlDTP_Create() control? (I need locale independence.)

...chris


...chris

Share this post


Link to post
Share on other sites

I clarify: how do I disable a _GUICtrlDTP_Create() control? (I need locale independence.)

...chris

local independence should be the same for built-in and UDF created control.

#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>

Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1, -1) ; centred
;~ Global $inpDate = GUICtrlCreateDate("", 144, 232, 81, 25, BitOR($WS_TABSTOP,$DTS_SHORTDATECENTURYFORMAT))
;~ GUICtrlSetState($inpDate, $GUI_DISABLE)
Global $inpDate = _GUICtrlDTP_Create($dlgXCopy, 144, 232, 81, 25, BitOR($WS_TABSTOP,$DTS_SHORTDATECENTURYFORMAT))
WinSetState($inpDate, "", @SW_DISABLE)
Global $btnExecute = GUICtrlCreateButton("Execute", 520, 672, 57, 25, 0)
Global $btnCancel = GUICtrlCreateButton("Cancel", 434, 672, 57, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $btnCancel
            ExitLoop
        Case $btnExecute
            DoExecute()
    EndSwitch
WEnd
GUIDelete()

Func DoExecute()
    $aDate = _GUICtrlDTP_GetSystemTime(GUICtrlGetHandle($inpDate))
    $mon = $aDate[1]
    $day = $aDate[2]
    $yr = $aDate[0]
    MsgBox(0, "", "mon " & $mon & " day " & $day & " year " & $yr)
EndFunc   ;==>DoExecute

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Thanks. I had forgotten about WinSetState().

On my PC, both GUICtrlCreateDate() and _GUICtrlDTP_Create() show the date in yyyy-mm-dd format.

I see that _GUICtrlDTP_GetSystemTime(GUICtrlGetHandle(...)) can be used with GUICtrlCreateDate().


...chris

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