Sign in to follow this  
Followers 0
Der_Andi

Change format of Time-Control

8 posts in this topic

Hi,

is there a way to change the format of those Time-Controls?

I get an output like this: 00:00:00 (hour, min, sec), but seconds aren't necessary in my script.

Andi

Share this post


Link to post
Share on other sites



Hi,

is there a way to change the format of those Time-Controls?

I get an output like this: 00:00:00 (hour, min, sec), but seconds aren't necessary in my script.

Andi

$Time = @HOUR & ':' & @MIN & ':' & @SEC
$Time = StringTrimLeft($Time, StringInStr($Time, ':'))
MsgBox(64, 'Info', $Time)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry, i don't see, what you are telling me.

This is what i meant:

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Posted Image

I don't want to have these seconds in this control.

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "HH:mm"
GuiCtrlSendMsg($Date_1, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

This might do the trick


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Sorry, i don't see, what you are telling me.

This is what i meant:

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I don't want to have these seconds in this control.

You never said you were working with a GUI! Of course you didn't get what I said then :)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You never said you were working with a GUI!

Well, i thought, talking about a control would suffice. ^^

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This might do the trick

yes, it does. thank you very much. :)

Just one more question: how do i set a custom time?

GUICtrlSetData($time, "09:45") does not work...

Edited by Der_Andi

Share this post


Link to post
Share on other sites

Well you can for a start do it in the creation

$Date_1 = GuiCtrlCreateDate("09:45", 70, 70, 190, 20, $DTS_TIMEFORMAT)

I'll look for the GUICtrlSetData.. but read about it in the helpfile :)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
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
Sign in to follow this  
Followers 0