Jump to content

A way to disable an "Edit" WITHOUT it turning gray?


Recommended Posts

A way to disable an "Edit" WITHOUT it turning gray? i'd like an edit box that cannot be typed in, but when i disable the box, it turns the background of the box gray. Best I can come up with is "Cream".

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

maybe just putting Guictrlsetdata($INPUTBOXVARIABLE,"") into a loop

so it continually sets your input to nothing, or just set the Background color to a different color

HAHAHAH woops accidently chose purple instead of white my bad

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 128, 24, 169, 305, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

oÝ÷ Ù©Ý¢¶®¶­s`¢6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC°£²ÓÒuTvVæW&FVBvF¶öFÓТb33c´f÷&ÓÒuT7&VFRgV÷C´f÷&ÓgV÷C²Âc#"ÂCCÂ"Â#R¢b33c´VFCÒuT7G&Ä7&VFTVFBgV÷C²gV÷C²Â#Â#BÂcÂ3RÂÓÂb33cµu5ôUô4ÄTåDTDtR¤uT6WE7FFR5uõ4õr¥vÆR¤wV7G&Ç6WDFFb33c´VFCÂgV÷C²gV÷C² b33c¶×6rÒwVvWD×6r 6VÆV7@ 66Rb33c¶×6rÒb33c´uTôUdTåEô4Äõ4P WDÆö÷ 66RVÇ6P ³³³³³³° VæE6VÆV7@¥tVæ@¤W@
Edited by thatsgreat2345
Link to comment
Share on other sites

  • Moderators

Would be nice to know if some of the help things actually work for you: ( Like This One )

#include <guiconstants.au3>
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('', 10, 10, 180, 80)
$Button = GUICtrlCreateButton('Disable', 65, 95, 60, 30)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = - 3
            Exit
        Case $Msg = $Button
            GUICtrlSetState($Edit, $GUI_DISABLE)
            GUICtrlSetBkColor($Edit, 0xFFFFFF)
    EndSelect
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

thatsgreat: I intend the box to have text in it, just not editable by the user. I want it to be white, and anytime its FFFFFF it turns gray because its white. I dont see what you are attempting to do different in the second code box. It is 1:32am so I might just be missing it.

Smokin: your code appears to be doing the same thing.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

  • Moderators

thatsgreat: I intend the box to have text in it, just not editable by the user. I want it to be white, and anytime its FFFFFF it turns gray because its white. I dont see what you are attempting to do different in the second code box. It is 1:32am so I might just be missing it.

Smokin: your code appears to be doing the same thing.

Same thing? What are you talking about, maybe an example (a script maybe) of what you would like it to look like before and after?

Edit:

Actually, since I'll never know if it actually worked for you, I think I'll let you or someone else figure it out.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

smokin:

1) i told you i visually saw no difference between the code. never got a chance to try it.

2) i told you exactly what i did, and what happens. You could have simply just asked for example code.

3) save the drama.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

  • Moderators

smokin:

1) i told you i visually saw no difference between the code. never got a chance to try it.

2) i told you exactly what i did, and what happens. You could have simply just asked for example code.

3) save the drama.

Where does what I posted Not do what you asked below?

A way to disable an "Edit" WITHOUT it turning gray? i'd like an edit box that cannot be typed in, but when i disable the box, it turns the background of the box gray. Best I can come up with is "Cream".

"You didn't say "anything" about what "you did", only what "you wanted", other than it comes up "cream". And we shouldn't have to ask for anything, that's the standard since I've been on this forum is show what the hell you've done thus far to try and accomplish what you want... (You know... so we don't WAISTE OUR TIME TRYING TO DO SOMETHING YOU'VE ALREADY DONE!!)

And the drama is well warranted IMHO...

Edit:

So, with the above said, it's still left for us to decipher if you mean you don't want the "text" greyed out too, so now we are assuming.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

For the sake of arguement, I believe this is what you were looking for:

#include <guiconstants.au3>
Global $SetEditState
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('blah', 10, 10, 180, 80)
$Button = GUICtrlCreateButton('Disable', 65, 95, 60, 30)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = - 3
            ExitLoop
        Case $Msg = $Button
            $SetEditState = Not $SetEditState
            If $SetEditState Then
                GUICtrlSetData($Button, 'Enable')
                GUICtrlSendMsg($Edit, 0xCF, True, 0)
                GUICtrlSetBkColor($Edit,0xFFFFFF)
            Else
                GUICtrlSetData($Button, 'Disable')
                GUICtrlSendMsg($Edit, 0xCF, False, 0)
            EndIf
    EndSelect
WEnd
At least it will help others if they have the question on how to do something like this.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Don't know if this can help (quick adaption of Smoke's gui):

#include <guiconstants.au3>
Global $SetEditState
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('blah', 10, 10, 180, 80)
$wantedtext = "blah"
GUISetState()

While 1
    $Msg = GUIGetMsg()
    $text = GUICtrlRead($Edit)
    Select
        Case $text <> "blah"
            GUICtrlSetData($Edit, $wantedtext)
        Case $Msg = - 3
            ExitLoop
    EndSelect
WEnd

Alzo

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Hmm, well it is very strange, the code you guys post works fine, but not in my program. I must be missing something miniscule. Thank you everyone for your help.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

Hmm, well it is very strange, the code you guys post works fine, but not in my program. I must be missing something miniscule. Thank you everyone for your help.

If you post it we could have a look here :D

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Minor, but for the sake of asking, is there any to get it, now that its disabled, that when you click in it, that the cursor will stop blinking in that perticular edit box?

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

  • Moderators

Minor, but for the sake of asking, is there any to get it, now that its disabled, that when you click in it, that the cursor will stop blinking in that perticular edit box?

I can't figure out any other way than this, I'll chalk it up to fatigue:
#include <guiconstants.au3>
Global $SetEditState, $BlockedEdit
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('blah', 10, 10, 180, 80)
Global $Edit_Hwnd = ControlGetHandle($Main, '', ControlGetFocus($Main))
$Button = GUICtrlCreateButton('Disable', 65, 95, 60, 30)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = - 3
            ExitLoop
        Case $Msg = $Button
            $SetEditState = Not $SetEditState
            $BlockedEdit = Not $BlockedEdit
            If $SetEditState Then
                GUICtrlSetData($Button, 'Enable')
                GUICtrlSendMsg($Edit, 0xCF, True, 0)
                GUICtrlSetBkColor($Edit,0xFFFFFF)
            Else
                GUICtrlSetData($Button, 'Disable')
                GUICtrlSendMsg($Edit, 0xCF, False, 0)
            EndIf
    EndSelect
    If $BlockedEdit Then
        ;Have to put focus on some other control, I'm using $Button here, I'm sure it would be different in yours.
        If (ControlGetHandle($Main, '', ControlGetFocus($Main)) == $Edit_Hwnd) Then ControlFocus($Main, '', $Button)
    EndIf
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

#include <guiconstants.au3>
Global $SetEditState
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('blah', 10, 10, 180, 80)
$h_edit = ControlGetHandle($Main,"","Edit1")
DllCall("user32.dll","int","HideCaret","hwnd",$h_edit)

$Button = GUICtrlCreateButton('Disable', 65, 95, 60, 30)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = - 3
            ExitLoop
        Case $Msg = $Button
            $SetEditState = Not $SetEditState
            If $SetEditState Then
                GUICtrlSetData($Button, 'Enable')
                GUICtrlSendMsg($Edit, 0xCF, True, 0)
                GUICtrlSetBkColor($Edit,0xFFFFFF)
            Else
                GUICtrlSetData($Button, 'Disable')
                GUICtrlSendMsg($Edit, 0xCF, False, 0)
            EndIf
    EndSelect
WEnd

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

  • Moderators

#include <guiconstants.au3>
Global $SetEditState
$Main = GUICreate('', 200, 130)
$Edit = GUICtrlCreateEdit('blah', 10, 10, 180, 80)
$h_edit = ControlGetHandle($Main,"","Edit1")
DllCall("user32.dll","int","HideCaret","hwnd",$h_edit)

$Button = GUICtrlCreateButton('Disable', 65, 95, 60, 30)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = - 3
            ExitLoop
        Case $Msg = $Button
            $SetEditState = Not $SetEditState
            If $SetEditState Then
                GUICtrlSetData($Button, 'Enable')
                GUICtrlSendMsg($Edit, 0xCF, True, 0)
                GUICtrlSetBkColor($Edit,0xFFFFFF)
            Else
                GUICtrlSetData($Button, 'Disable')
                GUICtrlSendMsg($Edit, 0xCF, False, 0)
            EndIf
    EndSelect
WEnd

Dammit, you don't know how many API's I went through to try and find that!!! Good 1 Gary!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...