Jump to content
Sign in to follow this  
Pain

inputbox that only accept time?

Recommended Posts

Pain

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
Zedna

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
Pain

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
rover

$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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.