Jump to content
Sign in to follow this  
randallc

$DTM_SETFORMAT and GUICtrlSendMsg

Recommended Posts

randallc

Hi,

Sorry to post in the Help area as well.. I wondered if someone knows a workaround for this date format problem from the date combo, as I want to update my scripts to newer release version..

It works OK in the last beta (3.2.1.14) and full versions before that, but now gives silly results.

Changing from 0x1005 to 0x0150 is the same as using "0" or nearly anything else.

Any ideas?

Best, randall

;dateprob3.au3
#include <GUIConstants.au3>
#include <Date.au3>
local $GUI=GUICreate("Get date", 410, 490),$h_date = GUICtrlCreateDate(_NowCalcDate(), 5, 285, 180, 20)
GUISetState()
Do
    $msg = GUIGetMsg()
    If $msg = $h_date Then  MsgBox(0, $msg, "Formatted Date as '2007/05/23' etc.."&@LF&"$sCtrlReadDate="&_DisplayDate($h_date))
Until $msg = $GUI_EVENT_CLOSE
MsgBox(0, $msg, "Formatted Date as '2007/05/23' etc.."&@LF&"$sCtrlReadDate="&_DisplayDate($h_date))

Func _DisplayDate($h1_date);,$DispDate)
    local $DTM_SETFORMAT = 4101,$style1 = "yyyy/MM/dd",$style2 = "dddd, d MMMM yyyy";$DTM_SETFORMAT = 0x1005
    GUICtrlSendMsg($h1_date, $DTM_SETFORMAT, 0, $style1)
    $NewDate = GUICtrlRead($h1_date)
    GUICtrlSendMsg($h1_date, $DTM_SETFORMAT, 0, $style2)
    Return $NewDate
EndFunc   ;==>_DisplayDate
Edited by randallc

Share this post


Link to post
Share on other sites
james3mg

I'm having this problem too (so I guess consider this a bump), using the code:

$DateInput = GUICtrlCreateDate("",230,260,120,20)
GUICtrlSendMsg($DateInput, 0x1005, 0, "MM/dd/yyyy")
(nearly) as documented in example 3 of the help file. It worked fine through stable version 3.2.2.2, but sometime in the 3.2.3.x betas (I think I've got my version numbers right), it broke, and now under 3.2.4.8 when I set a date, it only shows the value before the first "/" - in this case, only the month number.

It doesn't matter if I set the date via GUICtrlSetData() or by clicking a date in the control...it refuses to show anything more than the numerical representation of the intended date's month! I can't find anything in the changelog that changed the behavior of the Date controls directly, so I'm wondering if this is an unintentional change. Can anyone give help or new code if there's a new way of setting the date control style that's not documented in the GUICtrlCreateDate() section of the help file?

Thanks

Edit: Guess I made a noobie mistake, based on randallc's post above, I searched for his recent posts, and found his other thread that people have been helping in. Please disregard this and I'll try their suggestions first, then ask for more information THERE if it doesn't work, like I should have before I posted here :)

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

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  

×