MyEarth Posted August 2, 2013 Share Posted August 2, 2013 (edited) Hi, it's hard to explain so i'll post some images Did you know when you try to change the hour on Windows? You have the big clock and the input control. I'm intrested to this image: If i click on the Hour, the first two number will be evidence: The same is for Minute and Seconds, So if i click on the Up-Down control can add +1 or -1 to the hour. I can't click on the dots. And also every element as a unique limit, 0-23 for the hour, 00-59 for minute and seconds. So, how i can reproduce the same type of control? I think is possible because is a "standard" Windows control This is what i have done: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Test", -1, -1, -1, -1, $WS_SIZEBOX) $input = GUICtrlCreateInput(@HOUR & "." & @MIN & "." & @SEC, 10, 10, 100, 20) GUICtrlCreateUpdown($input) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Thanks for any help Edited August 2, 2013 by MyEarth Link to comment Share on other sites More sharing options...
FireFox Posted August 2, 2013 Share Posted August 2, 2013 Hi, I can see with the Au3Info tool that it's a not a custom input control but an assembly of labels and edits. The double dots are labels and hours/minutes/seconds are separate inputs. Your turn to make the same Br, Firefox. Link to comment Share on other sites More sharing options...
Solution johnmcloud Posted August 2, 2013 Solution Share Posted August 2, 2013 (edited) I have beat FireFox, is a good day I'm jocking, this is what MyEarth want: ; johnmcloud #include <GuiDateTimePicker.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 120, 50, -1, -1) $hDTP = _GUICtrlDTP_Create($hGUI, 20, 15, 80, 21, $DTS_UPDOWN) GUISetState() _GUICtrlDTP_SetFormat($hDTP, "HH.mm.ss") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Edited August 2, 2013 by johnmcloud BrewManNH, MyEarth and TheSaint 3 Link to comment Share on other sites More sharing options...
BrewManNH Posted August 2, 2013 Share Posted August 2, 2013 I didn't even realize that function existed, thanks for that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
FireFox Posted August 2, 2013 Share Posted August 2, 2013 I didn't even realize that function existed, thanks for that. Same. I was going into I re-invent the wheel. Anyway I post what I've done expandcollapse popup #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $_iLastInputVal = 0, $_iLastInputSel = 0 #region GUI Local $hGUI = GUICreate("MyGUI") GUICtrlCreateLabel("", 10, 10, 60, 20, $SS_BLACKFRAME) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("", 11, 11, 58, 18) GUICtrlSetBkColor(-1, $COLOR_WHITE) GUICtrlSetState(-1, $GUI_DISABLE) Global $_iInputHour = GUICtrlCreateInput(@HOUR, 14, 13, 14, 15, $ES_NUMBER, 0) GUICtrlSetBkColor($_iInputHour, $COLOR_WHITE) GUICtrlCreateLabel(":", 28, 10, 5, 20, $SS_CENTERIMAGE) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState(-1, $GUI_DISABLE) Global $_iInputMin = GUICtrlCreateInput(@MIN, 33, 13, 14, 15, $ES_NUMBER, 0) GUICtrlSetBkColor($_iInputMin, $COLOR_WHITE) GUICtrlCreateLabel(":", 47, 10, 5, 20, $SS_CENTERIMAGE) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState(-1, $GUI_DISABLE) Global $_iInputSec = GUICtrlCreateInput(@SEC, 52, 13, 14, 15, $ES_NUMBER, 0) GUICtrlSetBkColor($_iInputSec, $COLOR_WHITE) Global $_iUpDown1 = GUICtrlCreateInput("0", 74, 10, 0, 20, $ES_AUTOHSCROLL) GUICtrlSetState($_iUpDown1, $GUI_HIDE) GUICtrlCreateUpdown($_iUpDown1) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW, $hGUI) #endregion GUI While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd GUIDelete($hGUI) Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = 0, $iCode = 0 $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $iIDFrom Case $_iUpDown1 Switch $iCode Case $EN_CHANGE Local $_iInputVal = GUICtrlRead($_iUpDown1) If Number($_iInputVal) > $_iLastInputVal Then GUICtrlSetData($_iLastInputSel, GUICtrlRead($_iLastInputSel) + 1) Else GUICtrlSetData($_iLastInputSel, GUICtrlRead($_iLastInputSel) - 1) EndIf $_iLastInputVal = $_iInputVal EndSwitch Case $_iInputHour, $_iInputMin, $_iInputSec Switch $iCode Case $EN_SETFOCUS $_iLastInputSel = $iIDFrom EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Link to comment Share on other sites More sharing options...
MyEarth Posted August 2, 2013 Author Share Posted August 2, 2013 Thank you guys, thanks to FireFox for the effort in his script but i'll use the johnmcloud's one, simply to use Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now