Jump to content
Sign in to follow this  
loud

GUICtrlCreateDate and GUICtrlSetData

Recommended Posts

loud

Hello guys, I've been having trouble with a script of mine, let me explain.

I'm creating my GUI DTPicker items:

$dateTime1 = GUICtrlCreateDate("05:00:00", 260, 196, 75, 20, $DTS_TIMEFORMAT)
$dateTime2 = GUICtrlCreateDate("07:00:00", 260, 222, 75, 20, $DTS_TIMEFORMAT)

Then I'm changing their format:

GUICtrlSendMsg($dateTime1, 0x1032, 0, "HH:mm:ss")
GUICtrlSendMsg($dateTime2, 0x1032, 0, "HH:mm:ss")

Now let's say I've got a button that calls:

Func ChgTime()
    GUICtrlSetData($dateTime1, "12:00:00")
    GUICtrlSetData($dateTime2, "13:00:00")
    MsgBox(0, "Test", "Test OK")
EndFun

The MsgBox pops up, but the Date is not changed, and @error returns 0. Am I doing (or thinking) something wrong? :D

Share this post


Link to post
Share on other sites
martin

Hello guys, I've been having trouble with a script of mine, let me explain.

I'm creating my GUI DTPicker items:

$dateTime1 = GUICtrlCreateDate("05:00:00", 260, 196, 75, 20, $DTS_TIMEFORMAT)
$dateTime2 = GUICtrlCreateDate("07:00:00", 260, 222, 75, 20, $DTS_TIMEFORMAT)

Then I'm changing their format:

GUICtrlSendMsg($dateTime1, 0x1032, 0, "HH:mm:ss")
GUICtrlSendMsg($dateTime2, 0x1032, 0, "HH:mm:ss")

Now let's say I've got a button that calls:

Func ChgTime()
    GUICtrlSetData($dateTime1, "12:00:00")
    GUICtrlSetData($dateTime2, "13:00:00")
    MsgBox(0, "Test", "Test OK")
EndFun

The MsgBox pops up, but the Date is not changed, and @error returns 0. Am I doing (or thinking) something wrong? :D

I don't know what 0x1032 is but I would have expected you needed the message $DTM_SETFORMAT which is 0x1005.

The format string must have non-formatting characters in single quotes, and the last parameter cannot be a string, it must be a pointer to a string. So I would expect that you need something like this

Const $DTM_SETFORMAT = 0x1005;might already be in an include
$Tstring = "hh':'mm':'ss"
$dsStruct = DllCreatestruct("char[" & Stringlen($Tstring) + 1 & "]")
Dllstructsetdata($dsStruct,1,$Tstring)
$pds = Dllstructgetptr($dsStruct)
GUICtrlSendMsg($dateTime1,$DTM_SETFORMAT , 0, $pds)
$dsStruct = 0;delete the struct

But since I'm eager to go to bed I haven't tried this.


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

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.