Jump to content
Sign in to follow this  
jonny1234

GUICtrlCreateDate

Recommended Posts

jonny1234

Hi,

When I run the following date control example from the help file using AutoIt 3.2.3.14, the date does not display in the specified format. On my PC, it just shows "1953" in the date control.

#include <GUIConstants.au3>

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

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

Does anyone else have the same problem?

Regards,

Jonny

Share this post


Link to post
Share on other sites
jonny1234

I have just tried the help file example with the latest beta (v3.2.4.0), and the same thing happens.

Please could someone test this. Thanks.

Regards,

Jonny

Share this post


Link to post
Share on other sites
i542

Works fine at my. I have Win 2000.

i542


I can do signature me.

Share this post


Link to post
Share on other sites
jonny1234

Works fine at my. I have Win 2000.

i542

Thanks for testing it.

I am still having the problem on both Windows 2000 and Windows XP. It happened when I moved from AutoIt 3.2.3.2 to 3.2.3.14. If I go back to 3.2.3.2, the problem goes away.

Regards,

Jonny

Share this post


Link to post
Share on other sites
jonny1234

The problem is with GUICtrlSendMsg. If I send the $DTM_SETFORMAT message using DllCall and the SendMessage API function, then it works.

Solution:

#include <GUIConstants.au3>

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

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
DllCall("user32.dll", _
        "int", "SendMessage", _
        "hwnd", ControlGetHandle($form, "", $date), _
        "int", $DTM_SETFORMAT, _
        "int", 0, _
        "str", $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Regards,

Jonny

Share this post


Link to post
Share on other sites
martin

The problem is with GUICtrlSendMsg. If I send the $DTM_SETFORMAT message using DllCall and the SendMessage API function, then it works.

Solution:

#include <GUIConstants.au3>

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

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "yyyy/MM/dd HH:mm:s"
DllCall("user32.dll", _
        "int", "SendMessage", _
        "hwnd", ControlGetHandle($form, "", $date), _
        "int", $DTM_SETFORMAT, _
        "int", 0, _
        "str", $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Regards,

Jonny

Yes, looks like a bug. Have you tried reporting it?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Lord Maim

I have this issue as well with 3.2.4.7 (and the new 3.2.4.8 released today) under Windows XP. Has this issue been reported yet?

Share this post


Link to post
Share on other sites
Holger

As I wrote in the bug-forum.

Use the unicode function value then you will be happy:

#include <GUIConstants.au3>

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

; to select a specific default format
$DTM_SETFORMATW = 0x1032
$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMATW, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

Maybe the most forgot that from beta version 3.2.3.3 on the default Autoit.exe is compiled in unicode...

Share this post


Link to post
Share on other sites
Jon

This works fine on unicode and ansi versions.

#include <GUIConstants.au3>

If @UNICODE Then
 const $DTM_SETFORMAT = 0x1032
Else
 const $DTM_SETFORMAT = 0x1005
Endif

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

$style = "yyyy/MM/dd HH:mm:s"
GuiCtrlSendMsg($date, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

MsgBox(0,"Time", GUICtrlRead($date))

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.