Jump to content

can't set up/down time control values


 Share

Recommended Posts

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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...