calvino Posted July 22, 2008 Share Posted July 22, 2008 Hi, I have a program that allows the user to set the date and time using a calander control for the date and an up/down control for the time. I have formatted the time control to only display HH:mm. The program can save the selected date and time in a file so it can be recalled later. I'm able to recall and set the date from the saved file, but I can't set the value of the time control with the stored data. Is this a known issue, or is there something that I'm missing? Code snippets: This code is the gui code I use to create the date and time controls: $DateCtrlStart1 = GUICtrlCreateDate("", 416, 80, 90, 21, $WS_TABSTOP) GUICtrlSetOnEvent(-1, "DateCtrlStartChange") $TimeCtrlStart1 = GUICtrlCreateDate($defaulttime, 513, 80, 90, 21, BitOR($DTS_UPDOWN,$DTS_TIMEFORMAT,$WS_TABSTOP)) GUICtrlSetOnEvent(-1, "TimeCtrlStartChange") the code that sets the format of the time and date controls: If @UNICODE Then $DTM_SETFORMAT_ = 0x1032 Else $DTM_SETFORMAT_ = 0x1005 Endif $datestyle = "yyyy/MM/dd" $timestyle = "HH:mm" GuiCtrlSendMsg($TimeCtrlStart1, $DTM_SETFORMAT_, 0, $timestyle) GuiCtrlSendMsg($DateCtrlStart1, $DTM_SETFORMAT_, 0, $datestyle) The format for GUICtrlSetData is: GUICtrlSetData ( controlID, data [, default] ) Here is the code used to attempt to set the value of the time control using the data from the saved file: GuiCtrlSetData (($RowBase[6] + $populaterows), String($FormData [$populaterows][6])) The values stored in the variables might equal to something like this: GuiCtrlSetData (61, "22:35") Where 61 is the controlID and 22:35 is the data I have also tried this GuiCtrlSetData ($TimeCtrlStart1, "22:35") Thanks for any help, calvino Link to comment Share on other sites More sharing options...
Zedna Posted July 22, 2008 Share Posted July 22, 2008 I'm not sure but try to set also date no only time. Maybe GuiCtrlSetData ($TimeCtrlStart1, "1900-01-01 22:35") Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
calvino Posted July 22, 2008 Author Share Posted July 22, 2008 Hey Zedna, that worked! I used slashes / for the date, but otherwise I entered your example exactly. I've been struggling with this for a while, finally I can save and load all of the information from files! Thanks alot for the advice, calvino Link to comment Share on other sites More sharing options...
Zedna Posted July 22, 2008 Share Posted July 22, 2008 I'm glad it worked :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now