Jump to content

GuiCtrlCreateDate & GUICtrlSetData not working as expected


Go to solution Solved by MikahS,

Recommended Posts

Hi All,

I've run into an issue in one of my scripts using the GUICtrlCreateDate function with the $DTS_TIMEFORMAT flag.

Basically, after the creation of the Date tool, I seem to be unable to set the data in the box; And after reading the function reference for GuiCtrlSetData, This does seem to be something that's supported... So i'm a little lost as to where exactly i'm going wrong.

I've created a quick test script, and still can't get the two functions to work harmoniously:

local $GUI = GuiCreate("",100,40)
local $testDate = GUICtrlCreateDate("",15,10,70,20,9,-1)
local $test = GUIctrlSetData(-1,"09:00:00")
ConsoleWrite($test & @CR)
GUIsetState(@SW_SHOW)
While 1
   switch GUIgetMsg()
      Case -3
        Exit
   EndSwitch
WEnd 

Theoretically, the date input should show 09:00:00, But the GUIctrlSetData seems to be failing (returning 0).

I've checked the format of the Date input by using GUIctrlRead, and have adhered to that format in the test above, but it still seems to be failing.

Any Ideas? Any help is greatly appreciated! :)

Many Thanks

Javi

give a man an application, and he'll be frustrated for the day, Teach him how to program applications and he'll be frustrated for a lifetime.

Link to comment
Share on other sites

  • Solution

Try this:

local $GUI = GuiCreate("",100,40)
local $testDate = GUICtrlCreateDate("",15,10,70,20,9,-1)
local $test = GUIctrlSetData($testDate,"2015/01/14 09:00:00 AM")
ConsoleWrite($test & @CR)
GUIsetState(@SW_SHOW)
While 1
   switch GUIgetMsg()
      Case -3
        Exit
   EndSwitch
WEnd

:)

EDIT: It just wasn't in the proper date format of YYYY/MM/DD HH:mm:ss.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Hi Mikah, Thanks for the response!

That works perfectly... I didn't realise that the date had to be specified even though it's not displayed.

I tip my hat to you sir! :D

-Javi

give a man an application, and he'll be frustrated for the day, Teach him how to program applications and he'll be frustrated for a lifetime.

Link to comment
Share on other sites

Anytime!

My pleasure. ;)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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

×
×
  • Create New...