Sycamore Posted October 12, 2008 Posted October 12, 2008 I give up, can I get a hand? (I have to move on to more important Functions in this script/program...) Anybody know a quick fix (I'm trying to avoid more coding) to set a combo input box to only accept numeric characters? Hey, while I'm here, is there any maximum script size (not that I need to worry, I just don't want to run out of gas in the desert, so to speak...)?
AdmiralAlkex Posted October 12, 2008 Posted October 12, 2008 Hey, while I'm here, is there any maximum script size (not that I need to worry, I just don't want to run out of gas in the desert, so to speak...)?There is no maximum script size, but there is a max length on the lines, as the FAQ in the helpfile says=Maximum length of a single script line: 4,095 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Sycamore Posted October 12, 2008 Author Posted October 12, 2008 There is no maximum script size, but there is a max length on the lines, as the FAQ in the helpfile says=Thanks for that -About the real reason I'm here today - any idea on a style I can use on the combo box to limit it to numeric? (I tried BitOr with $ES_NUMBER but that didn't seem to do the trick...)I've seen the function that checks it live while it's being typed, but I thought that was a little much for what I've got.I could write a little edit routine, not a problem, it's just that I want to move on as quickly as possible...
Sycamore Posted October 13, 2008 Author Posted October 13, 2008 (edited) I had 4 combo boxes in my screen. I converted them to a 4 element array, then used a little loop to check them for numeric values. It works fine, and gives a little more flexibility - the original selections I had in there are still in the dropdown list, but a specific number of minutes can also be entered. CODE; check combo boxes for numeric values Local $k Local $workcombovalue For $k=1 To 4 Step 1 $workcombovalue = GUICtrlRead($Combo[$k]) If $workcombovalue <= 1 Or $workcombovalue > 1440 Then ControlFocus ($MyWindow, "", $Combo[$k]) MsgBox(4096, "Error", "Please enter a numeric value between 1 and 1440 minutes") Return 0 EndIf Next sample of combo 1: $Combo[1] = GUICtrlCreateCombo("", 219, 80, 57, 20, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|15|20|25|30|45|60|90|120|180|240") Edited October 13, 2008 by Sycamore
rasim Posted October 14, 2008 Posted October 14, 2008 (edited) SycamoreCorrect, but not easy way:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> $hGUI = GUICreate("ComboBox only number", 200, 100) $combo = GUICtrlCreateCombo("", 25, 40, 150, 20) GUICtrlSetData(-1, "1|2|3", 1) $hCombo = GUICtrlGetHandle($combo) GUISetState() $hEdit = DllCall("User32.dll", "hwnd", "FindWindowEx", "hwnd", $hCombo, "hwnd", 0, "ptr", 0, "ptr", 0) $hEdit = $hEdit[0] $wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) Do Until GUIGetMsg() = -3 _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, $wProcOld) DllCallbackFree($wProcHandle) Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case $hEdit Switch $Msg Case $WM_CHAR Switch $wParam Case 48 To 57 Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam) Case Else Return 0 EndSwitch EndSwitch EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam) EndFunc Edited October 14, 2008 by rasim
Sycamore Posted October 17, 2008 Author Posted October 17, 2008 (edited) thanks. i see once again that the stack of what i do not yet know much about is much much larger than the stack of what i am able to quickly comprehend. translated: i am such a rookie. (kind of funny I should say that...I wrote my first program in in Fortran in 1973.) - i don't know much about DllCalls and/or "User32.dll" and what it can do. Calling programs on an IBM mainframe yes, on a PC operating system not so much... Much reading/understanding work to do... Right now, I'm still writing the upgrade for SkyCycling... Edited October 17, 2008 by Sycamore
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