Pain Posted August 26, 2008 Share Posted August 26, 2008 Is it possible to change the color a disabled label have? As you can see you can move the gui by click and drag anywhere except for the label. I only want to change the color on labels and maybe something more but not all disabled controls. #include <GuiConstants.au3> Global Const $WM_LBUTTONDOWN = 0x0201 $Gui = GUICreate("test", 420, 200, -1, -1, $WS_POPUP+$WS_BORDER) ;I'm using GUICtrlCreatePic() for this but to make it easier I removed it and changed color, it will have same effect GUISetBkColor(0xf1f1f1) GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") $label = GUICtrlCreateLabel("Some text here", 21, 8, 200, 20) GUICtrlSetState(-1, $GUI_DISABLE) ;I need to disable the control to be able to move it GUICtrlSetColor(-1, 0x000000) ;Since the control will become grey when it's disabled I need to change the color back to black (or whatever color I want to) $Button = GUICtrlCreateButton("Exit", 240, 80, 150, 30) GUISetState(@SW_SHOW, $Gui) While 1 $msg = GUIGetMsg() Select Case $msg = $Button Quit() EndSelect WEnd Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) If BitAND(WinGetState($hWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
martin Posted August 26, 2008 Share Posted August 26, 2008 Is it possible to change the color a disabled label have? As you can see you can move the gui by click and drag anywhere except for the label. I only want to change the color on labels and maybe something more but not all disabled controls. #include <GuiConstants.au3> Global Const $WM_LBUTTONDOWN = 0x0201 $Gui = GUICreate("test", 420, 200, -1, -1, $WS_POPUP+$WS_BORDER) ;I'm using GUICtrlCreatePic() for this but to make it easier I removed it and changed color, it will have same effect GUISetBkColor(0xf1f1f1) GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") $label = GUICtrlCreateLabel("Some text here", 21, 8, 200, 20) GUICtrlSetState(-1, $GUI_DISABLE) ;I need to disable the control to be able to move it GUICtrlSetColor(-1, 0x000000) ;Since the control will become grey when it's disabled I need to change the color back to black (or whatever color I want to) $Button = GUICtrlCreateButton("Exit", 240, 80, 150, 30) GUISetState(@SW_SHOW, $Gui) While 1 $msg = GUIGetMsg() Select Case $msg = $Button Quit() EndSelect WEnd Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) If BitAND(WinGetState($hWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc Func Quit() Exit EndFunc You could do something like this expandcollapse popup#include <GuiConstants.au3> #include <windowsconstants.au3> #include <misc.au3> Global Const $WM_LBUTTONDOWN = 0x0201 $Gui = GUICreate("test", 420, 200, -1, -1, $WS_POPUP+$WS_BORDER) ;I'm using GUICtrlCreatePic() for this but to make it easier I removed it and changed color, it will have same effect GUISetBkColor(0xf1f1f1) GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") $label = GUICtrlCreateLabel("Some text here", 21, 8, 200, 20) ;GUICtrlSetState(-1, $GUI_DISABLE) ;I need to disable the control to be able to move it GUICtrlSetColor(-1, 0x000000) ;Since the control will become grey when it's disabled I need to change the color back to black (or whatever color I want to) $Button = GUICtrlCreateButton("Exit", 240, 80, 150, 30) GUISetState(@SW_SHOW, $Gui) While 1 $msg = GUIGetMsg() Select Case $msg = $Button Quit() case $GUI_EVENT_PRIMARYDOWN $CursorInfo = GUIGetCursorInfo() if $CursorInfo[4] = $label Then $StartWIndowPos = wingetpos($gui) $CurrentMousePos = mousegetpos() while _ispressed("01") $NewMousePos = mousegetpos() winmove($gui,"",$StartWIndowPos[0] + $NewMousePos[0] - $CurrentMousePos[0],$StartWIndowPos[1] + $NewMousePos[1] - $CurrentMousePos[1]) WEnd EndIf EndSelect WEnd Func WM_LBUTTONDOWN($hWnd, $iMsg, $StartWIndowPosaram, $lParam) If BitAND(WinGetState($hWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc Func Quit() Exit EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Pain Posted August 27, 2008 Author Share Posted August 27, 2008 Thanks alot martin, that made it, however I found a shorter way that seems to work too Case $GUI_EVENT_PRIMARYDOWN _SendMessage($Gui,$WM_SYSCOMMAND,0xF012,0) 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