UEZ Posted May 1, 2010 Share Posted May 1, 2010 (edited) Hi, how can I change the background color of GUI IP Address Control (field)? ;example from help file #include <GuiConstantsEx.au3> #include <GuiIPAddress.au3> Opt("MustDeclareVars", 1) $Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hgui, $hIPAddress $hgui = GUICreate("IP Address Control Get (String) Example", 400, 300) $hIPAddress = _GUICtrlIpAddress_Create($hgui, 10, 10) GUISetState(@SW_SHOW) _GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128") GUICtrlSetBkColor($hIPAddress, 0x00A000) ; Wait for user to close GUI Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main GUICtrlSetBkColor($hIPAddress, 0x00A000) is not working! Any idea? Thanks, UEZ Edited May 2, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
trancexx Posted May 2, 2010 Share Posted May 2, 2010 Seems to be resilient. And not to this: #include <GuiConstantsEx.au3> #include <GuiIPAddress.au3> Opt("MustDeclareVars", 1) Global $hGUI = GUICreate("IP Address", 400, 300) Global $hIPAddress = _GUICtrlIpAddress_Create($hGUI, 10, 100, 380, 50) _GUICtrlIpAddress_SetFont($hIPAddress, "Arial", 22, 800, True) ConsoleWrite("! Parent " & $hIPAddress & @CRLF) __EnumChild($hIPAddress) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func __EnumChild($hWnd, $lParam = 0) Local $hFunc = DllCallbackRegister("__EnumChildProc", "bool", "hwnd;lparam") DllCall("user32.dll", "bool", "EnumChildWindows", "hwnd", $hWnd, "ptr", DllCallbackGetPtr($hFunc), "lparam", $lParam) DllCallbackFree($hFunc) EndFunc ;==>__EnumChild Func __EnumChildProc($hWnd, $lParam) ConsoleWrite(" child " & $hWnd & @CRLF) WinSetTitle($hWnd, 0, "bzzz") ;_WinAPI_SetBkColor... ;_SendMessage... Return 1 EndFunc ;==>__EnumChildProc Interesting. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Zedna Posted May 2, 2010 Share Posted May 2, 2010 Hi,how can I change the background color of GUI IP Address Control (field)?GUICtrlSetBkColor($hIPAddress, 0x00A000) is not working!GUICtrlSetxxx() functions work only with native Autoit's controls created by GUICtrlCreatexxx()not for UDF's controls like IPAddress created by _GUICtrlxxx() functions with underscore at start.You mixed native/UDF functions in a wrong way here. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
UEZ Posted May 2, 2010 Author Share Posted May 2, 2010 (edited) Found a way to change the background color but when you start typing it or set the IP it will erase part of the background again! expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiIPAddress.au3> Opt("MustDeclareVars", 1) $Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hgui, $hIPAddress $hgui = GUICreate("IP Address Control Get (String) Example", 400, 300) $hIPAddress = _GUICtrlIpAddress_Create($hgui, 10, 10) GUISetState(@SW_SHOW) Local $tRECT = DllStructCreate($tagRect) DllStructSetData($tRECT, "Left", 0) DllStructSetData($tRECT, "Top", 0) DllStructSetData($tRECT, "Right", 121) DllStructSetData($tRECT, "Bottom", 21) Local $hBrush = _WinAPI_CreateSolidBrush(0x0000FF) ;BGR Local $hDC = _WinAPI_GetDC($hIPAddress) _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush) _GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128") ; Wait for user to close GUI Do Until GUIGetMsg() = $GUI_EVENT_CLOSE $tRECT = "" _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteObject($hBrush) GUIDelete($hgui) Exit EndFunc ;==>_Main Now I'm looking for a way to change the background color of text... BR, UEZ Edited May 2, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Zedna Posted May 2, 2010 Share Posted May 2, 2010 Look at Callback UDF. There is example for subclassing of edit control to change background color.Now Callback is part of standard Autoit.http://www.autoitscript.com/forum/index.php?showtopic=50768&st=0&p=384128&hl=callback&fromsearch=1&#entry384128 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
UEZ Posted May 2, 2010 Author Share Posted May 2, 2010 Look at Callback UDF. There is example for subclassing of edit control to change background color.Now Callback is part of standard Autoit.http://www.autoitscript.com/forum/index....28&hl=callback&fromsearch=1&#entry384128To be honest, I never worked with callbacks and currently I'm trying to understand the code made by trancexx in 2nd post!Thanks,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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