Jump to content

Display specif time with date control


Recommended Posts

I try to put a predefined value in the time input field with the GUICtrlSetData($TimeControl,"12:16:20") and I dont receive the correct time in the field. I receive 15:24:54 in the input field.

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hDTP ,$k

    ; Create GUI
    GUICreate("DateTimePick Set Format", 400, 300)
    $k=GUICtrlCreateDate("12:15:26", 2, 6, 190)
     $hDTP = GUICtrlGetHandle($k)

    GUISetState()

    ; Set the display format
    _GUICtrlDTP_SetFormat($hDTP, "HH:mm:ss")

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

Elke vogel zingt zoals hij gebekt is !Als alleen die vogels zongen die het mooiste zingen zou het stil zijn in het bos.

Link to comment
Share on other sites

  • Moderators

Richardr,

As far as I know, you can only choose the date to be shown in a Date control - the time always comes up as your system time. You can alter this once the control is created using the $DTS_UPDOWN style to replace the dropdown calendar with an up/down control, but I can find no way to alter the displayed time directly - other than by messing with the system time itself. GUICtrlSetData only seems to work with the date in the "yyyy/mm/dd" format - as stated in the Help file.

Sorry I cannot be of more help - perhaps someone else might have the answer. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

In the GUICtrlCreateDate, i specified the format style $DTS_TIMEFORMAT. This gives me the right format and the UP/down buttons.

When playing aroudn with the control, i added the date in the text field ans then the time is displayed correctly.

The final coding is GuiCtrlSetData($guitime,"2010/01/01 " & $vartime). This gives the correct display and returns the updated time when using $vartime=GuiCtrlRead($guitime)

thanks for your research

Richard

Elke vogel zingt zoals hij gebekt is !Als alleen die vogels zongen die het mooiste zingen zou het stil zijn in het bos.

Link to comment
Share on other sites

  • Moderators

Richardr,

Well done! :(

As the Help file only mentioned date, I never thought to try with a date/time mix. One to add to my snippets store. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...