Sign in to follow this  
Followers 0
leegold

Best Way For GUI Input of A Time Interval

3 posts in this topic

Hi,

I note when I do

;...
GUICtrlCreateDate("", 200, 10, 185, 20) 
$DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
$style = "MM/dd/yyyy    HH:mm:s"
GUICtrlSendMsg($r1date, $DTM_SETFORMAT_, 0, $style)

I get a neat date selector and if a user puts the focus on the seconds part of the entry fields they can toggle seconds up or down in a way that's has integrity for seconds, same with minutes etc...

What I want to do is have a similar GUI input field for time but not for a specific date but only for a time interval? Like a GUI time picker that just represents eg. 4hr 12 min 03 secs as a discrete time value that I can use and not a point in time on a calender?  Else I could just have simple input field and just enforce a time format, but I thought there might be a way to have a time input for a user with the advantages of the date input.

Thanks.

Share this post


Link to post
Share on other sites



leegold,

Try this...

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>

local $gui010   =   guicreate('Day - Time Interval',300,100)
                    guictrlcreatelabel('Days',20,10,50,15)
                    guictrlcreatelabel('Hours',80,10,50,15)
                    guictrlcreatelabel('Minutes',140,10,50,15)
                    guictrlcreatelabel('Seconds',200,10,50,15)
local $inp010   =   guictrlcreateinput('00',20,30,40,20)
local $ud0010   =   GUICtrlCreateUpdown($inp010)
local $inp020   =   guictrlcreateinput('00',80,30,40,20)
local $ud0020   =   GUICtrlCreateUpdown($inp020)
local $inp030   =   guictrlcreateinput('00',140,30,40,20)
local $ud0030   =   GUICtrlCreateUpdown($inp030)
local $inp040   =   guictrlcreateinput('00',200,30,40,20)
local $ud0040   =   GUICtrlCreateUpdown($inp040)
local $status   =   guictrlcreatelabel('',20,70,260,30,$ss_center)
                    guictrlsetfont(-1,12,800)
                    guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        case $inp010, $inp020, $inp030, $inp040
            guictrlsetdata($status,stringformat(' %02i %02i:%02i:%02i', _
                guictrlread($inp010), _
                guictrlread($inp020), _
                guictrlread($inp030), _
                guictrlread($inp040)))
    EndSwitch
WEnd

See Help file for ways to control the UP/Down controls.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

I thought there might be a special widget to do this...but it's simple.

This forum is so helpful - posters are generous with their time and knowledge!

Thank you for posting the code.

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