Sign in to follow this  
Followers 0
themax90

Deleting A Style

3 posts in this topic

#1 ·  Posted (edited)

For example:

$GUI = GUICreate("GUI", 400, 400)
$Edit = GUICtrlCreateEdit("Edit", 10, 10, 380, 380, $ES_READONLY)
GUISetState(@SW_SHOW)

What if I want to remove the $ES_READONLY from my edit box? How do I do this?

Thanks.

Smith

P.S. Wow it's been a while since I've needed help. Just glad the communities here.

Edit 1: I think I just reenter all the styles I had previously with GUICtrlSetStyle but still is there a more direct route?

Edited by AutoIt Smith

Share this post


Link to post
Share on other sites



$GUI = GUICreate("GUI", 400, 425)
$Edit = GUICtrlCreateEdit("Edit", 10, 10, 380, 380)
GUICtrlSendMsg($Edit, 0xCF, 1, 0)
$Button = GUICtrlCreateButton('Undo', 10, 395, 380, 25)
GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Button
            GUICtrlSendMsg($Edit, 0xCF, 0, 0)
            MsgBox(64, 'Active', 'You can now edit the edit box')
    EndSwitch
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.

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
#include <EditConstants.au3>

$GUI = GUICreate("GUI", 400, 425)
$Edit = GUICtrlCreateEdit("Edit", 10, 10, 380, 380, $ES_READONLY)
$Button = GUICtrlCreateButton('Undo', 10, 395, 380, 25)
GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Button
            Local $Current_Style = _GUICtrlGetStyle($Edit)
            If BitAND($Current_Style, $ES_READONLY) Then
                GUICtrlSetStyle($Edit, BitAND($Current_Style, BitNOT($ES_READONLY)), -1)
                GUICtrlSetData($Button,"Redo")
                MsgBox(64, 'Active', 'You can now edit the edit box')
            Else
                GUICtrlSetStyle($Edit, BitOR($Current_Style, $ES_READONLY), -1)
                GUICtrlSetData($Button,"Undo")
                MsgBox(64, 'Read Only', "You can't edit the edit box")
            EndIf
    EndSwitch
WEnd
Func _GUICtrlGetStyle($CtrlhWnd)
    If Not IsHWnd($CtrlhWnd) Then $CtrlhWnd = GUICtrlGetHandle($CtrlhWnd)
    Local $a_Style = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $CtrlhWnd, "int", -16);get existing Style
    Return $a_Style[0]
EndFunc   ;==>_GUICtrlGetStyleoÝ÷ Ù&¦z^­«b¢w·¢w°ØDÅ+r殶­sdgVæ2ôuT7G&ÄvWDW7GÆRb33c´7G&ÆvæB¢bæ÷B4væBb33c´7G&ÆvæBFVâb33c´7G&ÆvæBÒuT7G&ÄvWDæFÆRb33c´7G&ÆvæB¢Æö6Âb33c¶ôW7GÆRÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶ÆöærgV÷C²ÂgV÷C´vWEvæF÷tÆöærgV÷C²ÂgV÷C¶væBgV÷C²Âb33c´7G&ÆvæBÂgV÷C¶çBgV÷C²ÂÓ#¶vWBW7FærW7GÆP¢&WGW&âb33c¶ôW7GÆU³Ð¤VæDgVæ2³ÓÒfwCµôuT7G&ÄvWDW7GÆP

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  
Followers 0