Jump to content

Making $ES_READONLY box Not $ES_READONLY...


Recommended Posts

i have an input box, where i have set the state to $ES_READONLY....

however i would like to (when i click a button) to change the inputbox from $ES_READONLY, back to being able to input agin.

please help

Link to comment
Share on other sites

however i would like to (when i click a button) to change the inputbox from $ES_READONLY, back to being able to input agin.

ControlEnable() and ControlDisable() can switch your inputbox on/off, then you don't need the readonly flag.

Link to comment
Share on other sites

Yes Works a Treat TY. is there anyway to change the colours of the text and bacground as this inputbox recieves data from a inifile. Hence the reason why i dont want to edit it.

Untill later........(ie, edit button or something)......

thanks for your help sofar tho..... :D

Edited by Aceguy
Link to comment
Share on other sites

This is your GUI or another?

#include <GUIConstants.au3>
$Write = 1
$Form1 = GUICreate("AForm1", 201, 101, 192, 125)
$Input = GUICtrlCreateInput("", 8, 8, 193, 21, -1, $WS_EX_CLIENTEDGE)
$Button = GUICtrlCreateButton("Write", 56, 56, 73, 33)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
If $msg = $Button Then
    If $Write = 1 Then
        GUICtrlSetState($Input,$GUI_DISABLE)
        $Write = 0
        GUICtrlSetData($Button,"DONT WRITE")
    Elseif $Write = 0 Then
    $Write = 1
    GUICtrlSetState($Input,$GUI_ENABLE)
    GUICtrlSetData($Button,"Write")
EndIf
EndIf
IF $msg = $GUI_EVENT_CLOSE then Exit
        
WEnd
Link to comment
Share on other sites

Sorry, not mine..... but this is it...

And working now thanks.....

$Main = GUICreate('Main', 200, 100)

$input = GUICtrlCreateInput('', 10, 10, 50, 50)
ControlDisable($Main,"",$input)
GUICtrlSetBkColor($input,0xffffff)

$Button = GUICtrlCreateButton("", 50, 40, 100, 30)
GUICtrlSetData($Button,"Disabled")
GUISetState()


 
while 1 
    $MSG = GUIGetMsg()  
    Select
    case $MSG = - 3 
        Exit
    case $MSG = $Button
    $read=GUICtrlRead($Button)
    if $read="Disabled" Then
        ControlEnable($Main,"",$input)
        GUICtrlSetData($Button,"Enabled")
    Else
    ControlDisable($Main,"",$input)
GUICtrlSetBkColor($input,0xffffff)
EndIf
EndSelect
WEnd

thanks..... :D :D :P;):evil:

Link to comment
Share on other sites

this also works but you need beta

#include <GuiConstants.au3>

Global Const $EM_SETREADONLY = 0xCF

$Main = GUICreate('Main', 200, 100)

$input = GUICtrlCreateInput('', 10, 10, 50, 50)
GUICtrlSendMsg($input, $EM_SETREADONLY, 1, 0)
GUICtrlSetBkColor($input, 0xffffff)

$Button = GUICtrlCreateButton("", 50, 40, 100, 30)
GUICtrlSetData($Button, "Disabled")
GUISetState()

While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $GUI_EVENT_CLOSE
            Exit
        Case $MSG = $Button
            $read = GUICtrlRead($Button)
            If $read = "Disabled" Then
                GUICtrlSendMsg($input, $EM_SETREADONLY, 0, 0)
                GUICtrlSetData($Button, "Enabled")
            Else
                GUICtrlSendMsg($input, $EM_SETREADONLY, 1, 0)
                GUICtrlSetData($Button, "Disabled")
            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

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...