Edano Posted June 12, 2013 Share Posted June 12, 2013 (edited) sometimes i feel so stupid to ask trivial questions, but how can i get the inputbox with updown clean and white, without blue highlight focus or caret in it? i mean, it is readonly, but still looks like editable. it should not do anything. . #include <EditConstants.au3> GUICreate("") GUICtrlCreateInput(640,15,88,70,20,BitOR($ES_NUMBER,$ES_CENTER,$ES_READONLY)) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetFont(-1,-1,1000) GUICtrlCreateUpdown(-1) GUICtrlSetCursor(-1,0) GUISetState() Do Until GUIGetMsg()=-3 . from >here i learned that this is not a trivial question, but it is still unsolved. thx E. edit: melba's subclassing fails with updown control: expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <EditConstants.au3> ;Global subclass vars Global Const $GCL_WNDPROC = -24 Global $hNew_ControlProc = 0, $pOriginal_EditProc ; Must be run before any input controls are created _ControlGlobalSubclass() ; All subsequently created inputs will be subclassed - individual controls original wndproc cannot be restored ; Create GUI $hGUI = GUICreate("Subclassed Input Control without Highlight", 500, 210) $hInput = GUICtrlCreateInput(640, 10, 10, 80, 20,BitOR($ES_NUMBER,$ES_CENTER,$ES_READONLY)) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetFont(-1,-1,1000) GUICtrlCreateUpdown(-1) GUICtrlSetCursor(-1,0) $hButton = GUICtrlCreateButton("Dummy", 10, 50, 80, 30) GUISetState() Sleep(2000) ; Remove initial HighLight from input GUICtrlSendMsg($hInput, 0xB1, 0, 0) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Must delete subclassed controls before freeing DLLCallbacks GUIDelete($hGUI) ; Now free DLLCallbacks - not strictly necessary, but "good idea" according to Help file DllCallbackFree($hNew_ControlProc) Exit EndSwitch WEnd Func _ControlGlobalSubclass() ; Check we have not done it already If $hNew_ControlProc <> 0 Then Return SetError(1, 0, 0) ; Create temp GUI Local $hGUITemp = GUICreate("", 1, 1, -10, -10) ; Create temporary edit Local $hEditTemp = GUICtrlGetHandle(GUICtrlCreateEdit("", -10, -10, 1, 1)) ; Create callback $hNew_ControlProc = DllCallbackRegister("_WndProc", "int", "hwnd;uint;wparam;lparam") Local $pCallbackPtr = DllCallbackGetPtr($hNew_ControlProc) ; Subclass Edit class - which means replace the original wndproc with our own $pOriginal_EditProc = DllCall("User32.dll", "dword", "SetClassLongW", "hwnd", $hEditTemp, "int", $GCL_WNDPROC, "ptr", $pCallbackPtr) $pOriginal_EditProc = $pOriginal_EditProc[0] ; Destroy temporary GUI GUIDelete($hGUITemp) Return SetError(0, 0, 1) EndFunc ;==>_ControlGlobalSubclass ; And this is the new wndproc which we set when we subclass Func _WndProc($hWnd, $iMsg, $wParam, $lParam) Switch _WinAPI_GetClassName($hWnd) Case "Edit" ; Intercept the SETSEL message If $iMsg = $EM_SETSEL And $lParam <> -1 Then ConsoleWrite("SETSEL msg intercepted" & @CRLF) Return 0 EndIf ; Pass other messages to original wndproc Return _WinAPI_CallWindowProc($pOriginal_EditProc, $hWnd, $iMsg, $wParam, $lParam) Case Else Return 0 EndSwitch EndFunc ;==>_WndProc Edited June 12, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
BrewManNH Posted June 12, 2013 Share Posted June 12, 2013 How about faking it like this. #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> ; Create GUI $hGUI = GUICreate("Subclassed Input Control without Highlight", 500, 210) $hInput = GUICtrlCreateInput(640, 90, 10, 16, 20, BitOR($ES_NUMBER, $ES_CENTER, $ES_READONLY)) $hLabel = GUICtrlCreateLabel(640, 10, 10, 80, 20, BitOR($SS_CENTER, $GUI_SS_DEFAULT_LABEL, $SS_SUNKEN)) GUICtrlSetBkColor($hLabel, 0xFFFFFF) GUICtrlSetColor($hLabel, 0x000000) $hUpDown = GUICtrlCreateUpdown($hInput) $hButton = GUICtrlCreateButton("Dummy", 10, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Case $hUpDown GUICtrlSetData($hLabel, GUICtrlRead($hInput)) EndSwitch WEnd Piwonia 1 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...
Edano Posted June 12, 2013 Author Share Posted June 12, 2013 i thought of the same. it's nicer than the original for sure. if there's no other way ... E [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] 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