Maikey81 Posted May 22, 2012 Posted May 22, 2012 (edited) Hi, Is it possible to create an Inputbox with text already in it, that isn't editable, but when you select the inputbox, you start typing behind the text that's already in the inputbox? For example: When having a series of product which all start with the same first four characters, is it possible to default have these first four characters in an inputbox, but people can't delete there characters and always start typing behind the default text? Maybe in the form of a picture? Thanks in advance. Edited May 22, 2012 by Maikey81
Xenobiologist Posted May 22, 2012 Posted May 22, 2012 #Region ;************ Includes ************ #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #EndRegion ;************ Includes ************ $GUI = GUICreate(" My GUI", 350, 180) $hInput = GUICtrlCreateInput("DN40", 10, 5, 300, 20) GUICtrlSetLimit(-1, 10) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $controlID = _WinAPI_LoWord($wParam) If $controlID = $hInput Then If StringLeft(GUICtrlRead($hInput), 4) <> 'DN40' Then GUICtrlSetData($hInput, "DN40") EndIf ; hier jegliche Logik rein. EndIf EndFunc ;==>MY_WM_COMMAND Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Maikey81 Posted May 22, 2012 Author Posted May 22, 2012 #Region ;************ Includes ************ #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #EndRegion ;************ Includes ************ $GUI = GUICreate(" My GUI", 350, 180) $hInput = GUICtrlCreateInput("DN40", 10, 5, 300, 20) GUICtrlSetLimit(-1, 10) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $controlID = _WinAPI_LoWord($wParam) If $controlID = $hInput Then If StringLeft(GUICtrlRead($hInput), 4) <> 'DN40' Then GUICtrlSetData($hInput, "DN40") EndIf ; hier jegliche Logik rein. EndIf EndFunc ;==>MY_WM_COMMAND Thanks Xeno! That did the trick! Now I'm going to try and figure out what you did.
PhoenixXL Posted May 23, 2012 Posted May 23, 2012 (edited) I even wanted SomeThing Like That The Problem is its not Case-Sensitive Try Selecting the 'D' and type 'd' in its place it replaces that EDIT: forgot case sensitive option this would do the work code:#Region ;************ Includes ************ #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #EndRegion ;************ Includes ************ $GUI = GUICreate(" My GUI", 350, 180) $hInput = GUICtrlCreateInput("DN40", 10, 5, 300, 20) GUICtrlSetLimit(-1, 10) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $controlID = _WinAPI_LoWord($wParam) If $controlID = $hInput Then If Not (StringLeft(GUICtrlRead($hInput), 4)=='DN40') Then GUICtrlSetData($hInput, "DN40") EndIf ; hier jegliche Logik rein. EndIf EndFunc ;==>MY_WM_COMMAND thnx xenobiologist for the code Regards Phoenix XL Edited May 23, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
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