Jump to content
Sign in to follow this  
Sunaj

Disable Edit Without Turning Text Gray

Recommended Posts

Sunaj

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):

Posted Image

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 by Sunaj

Share this post


Link to post
Share on other sites
MHz

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?

Share this post


Link to post
Share on other sites
CWorks

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

Share this post


Link to post
Share on other sites
Sunaj

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! :lmao:

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 by Sunaj

Share this post


Link to post
Share on other sites
GaryFrost

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

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.