Sunaj Posted October 14, 2006 Share Posted October 14, 2006 (edited) Hi, been trying to make a 'label like' edit box for script design purposes, i.e, making a tab with a headline looking somewhat like this (screenshot from utorrent):However, despite trying to use these instructions I cannot seem to get it right - either the effect is temporary (disappears after switching between applications) or the solution is just not quite.. 'right' (i.e. needing to be set over and over again in a loop.. something I really want to avoid because my script is GUIOnEventMode). That means that the only thing that seems to work is to disable the control. This however invalidates its GUI label design function because the text is then completely grayed out. In short: can someone help me get the GUICtrlCreateEdit disabled WITH white (not grayed) text still showing? Here's the (not yet working) code:#include <guiconstants.au3> Opt("GUIOnEventMode", 1) $Main = GUICreate('', 200, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "close") $tab1_label = GUICtrlCreateEdit(" App Label ",20 ,20 ,160 ,26 ,$SS_LEFT) GUICtrlSetFont (-1,14) GUICtrlSetBkColor ($tab1_label, 0x316AC5) GUICtrlSetColor ($tab1_label, 0xFFFFFF) GUISetCursor (5, 1, $Main) ; standard arrow to keep IBEAM cursor from showing up ;GUICtrlSetState ($tab1_label, $GUI_DISABLE) GUISetState() While 1 Sleep(500) WEnd Func close() Exit EndFunc Edited October 14, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
MHz Posted October 14, 2006 Share Posted October 14, 2006 I do not understand. The pic looks like a label and what you want is a edit control to behave like a label? so, why not use a label? Link to comment Share on other sites More sharing options...
CWorks Posted October 14, 2006 Share Posted October 14, 2006 hows this #include <guiconstants.au3> Opt("GUIOnEventMode", 1) $Main = GUICreate('', 200, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUICtrlCreateLabel(" App Label ",20 ,20 ,160 ,26, $SS_SUNKEN) GUICtrlSetFont (-1,14) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor (-1, 0x316AC5) GUISetState() While 1 Sleep(500) WEnd Func close() Exit EndFunc Link to comment Share on other sites More sharing options...
Sunaj Posted October 14, 2006 Author Share Posted October 14, 2006 (edited) Hi MHz & CWorks.. Uh..... I guess this is one of those special times... I simply stared too hard at one thing.. can't believe its so simple! Thanks a lot for this (simple, but effective) whack on my virtual head! I do not understand. The pic looks like a label and what you want is a edit control to behave like a label? so, why not use a label? Edited October 14, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
MHz Posted October 14, 2006 Share Posted October 14, 2006 As CWorks shows, a style or exstyle can make it look sonething different.Have a look here... http://www.autoitscript.com/forum/index.php?showtopic=32795 for help with control styles. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 14, 2006 Share Posted October 14, 2006 just for future reference for those that want to be able to switch between read only and editable edit control #include <guiconstants.au3> Opt("GUIOnEventMode", 1) Dim $ReadOnly = True $Main = GUICreate('', 200, 130) GUISetOnEvent($GUI_EVENT_CLOSE, "close") $tab1_label = GUICtrlCreateEdit(" App Label ", 20, 20, 160, 26, $SS_LEFT) GUICtrlSendMsg($tab1_label, $EM_SETREADONLY, $ReadOnly, 0) GUICtrlSetFont(-1, 14) GUICtrlSetBkColor($tab1_label, 0x316AC5) GUICtrlSetColor($tab1_label, 0xFFFFFF) GUISetCursor(5, 1, $Main) ; standard arrow to keep IBEAM cursor from showing up GUICtrlCreateButton("Toggle", 20, 50, 90, 25) GUICtrlSetOnEvent(-1, "_Toggle") GUISetState() While 1 Sleep(500) WEnd Func _Toggle() $ReadOnly = Not $ReadOnly GUICtrlSendMsg($tab1_label, $EM_SETREADONLY, $ReadOnly, 0) EndFunc ;==>_Toggle Func close() Exit EndFunc ;==>close Dan_555 1 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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