Jump to content

GUICtrlCreateDate custom designator?


Recommended Posts

Hello,

I want to show the 12 hour clock in my date control:

#include <GUIConstantsEx.au3>
#include <DateTimeConstants.au3>

Example()


Func Example()
    Local $n, $msg
    GUICreate("", 200, 200, -1, -1)
    $n = GUICtrlCreateDate("", 20, 20, 150, 20, $DTS_TIMEFORMAT)
    $DTM_SETFORMAT_ = 0x1032
    $style = "yyyy/MM/dd hh:mm tt"
    GUICtrlSendMsg($n, $DTM_SETFORMAT_, 0, $style)
    GUISetState()

    Do
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>Example

The problem is i'm using the 24h on my PC and i don't want to change so i don't see PM-AM on the control so is impossible to get the right time. So how to set/see the PM-AM on the control?

Link to comment
Share on other sites

  • Moderators

MyEarth,

The "AM/PM" is set by the "tt$DTM_SETFORMATW element. I see "AM/PM" when I run that script and my machine is also set to 24h.

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

  • Moderators

MyEarth,

I now notice that you are using $DTM_SETFORMAT_ (with a trailing underscore) - and the code runs, which surprises me a little as there is no such constant within the DateTimeConstants include file. Try changing that to  $DTM_SETFORMATW (which is in the file) and see if that helps.

M23

Edit: Another thought: is the control wide enough to display the "AM/PM" or does the time element run to the end of the available space?

Edited by Melba23

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

No @Melba23 the variable doesn't matter, $DTM_SETFORMATW = ($DTM_FIRST + 50) = 0x1032
 

Anyway i have understood why i don't see the AM-PM. In my international settings ( i have check in different OS, also the last W10 ) are empty the two string about the designator. If i'll "fill" it, i'll see it in the control.

But...since i don't want to change nothing on my OS ( and other one's ) i'll carry-over the question to @Jos

There is a way to "send" to the control the designator? In .NET i have see something in this way

https://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ttSpecifier

I don't know if without .NET is possible, so i can use instead of my  international settings the en-US so i'm sure to see the AM-PM.

 

 

Edited by MyEarth
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...