Sign in to follow this  
Followers 0
Pain

inputbox that only accept time?

4 posts in this topic

This is a part of one of my script

........

$start = GUICtrlCreateInput("", 50, 22, 120, 21)

GUICtrlSetData(-1, "00:00")

.......

I only want to be able to type in a time, like 18:20, because later I use the time with a _DateDiff so it needs to be written in that way.

I can't use $es_number because of the ":" and I it would look stupid if I wrote 1820 and later use stringsplit to get the time.

Share this post


Link to post
Share on other sites



Try to use standard Date control and set appropriate format.

$dt_datum_od = GUICtrlCreateDate("", 480, 48, 82, 21, $DTS_SHORTDATEFORMAT)
GuiCtrlSendMsg($dt_datum_od, $DTM_SETFORMAT, 0, "hh:mm"); dd.MM.yyyy

Share this post


Link to post
Share on other sites

thanks, I changed the $DTS_SHORTDATEFORMAT to $DTS_TIMEFORMAT and removed the second line since I only wanted the time and your script returned with the day "6" because it's 6 june.

btw is it possible to remove the up and down arrow?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$hGUI = GUICreate("DateTimePick", 400, 300)
GUICtrlCreateDate("", 20, 20, 90, 20, $DTS_TIMEFORMAT)
ControlHide($hGUI, "", "msctls_updown321")

keyboard arrow keys still select and increment/decrement selected value in DTP control

Edited by rover

I see fascists...

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