Sign in to follow this  
Followers 0
Ghastly_MIB

Guictrlsetstyle() Problem

4 posts in this topic

Hey, it's me again :)

I'm creating a editor with the GUI EDIT and i want to protect the edit with readonly and with a button to unlock it.

I got the script and it works, but there's a resize problem. When i'm maximize or resize the window and change the style, the editbox resizes back to the orginal size. How can I fix this?

Here's a example:

#NoTrayIcon
#include <GUIConstants.au3>

GUICreate("hoi", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$edit = GUICtrlCreateEdit("Blabla", 0, 0, 400, 350)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$button = GUICtrlCreateButton("SET TEXT and readonly 1", 10, 360, 190, 23)
$button1 = GUICtrlCreateButton("SET TEXT 2", 200, 360, 190, 23)
GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
    Case $button
        GUICtrlSetStyle($edit, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY))
        GUICtrlSetData($edit, "The new text")
    Case $button1
        GUICtrlSetStyle($edit, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
        GUICtrlSetData($edit, "The new text")
    EndSwitch
WEnd

Thanks Ghastly_MIB

Share this post


Link to post
Share on other sites



Global Const $EM_SETREADONLY = 0xCF

; set to read only
    GUICtrlSendMsg($edit, $EM_SETREADONLY, 1, 0)
; unset read only
    GUICtrlSendMsg($edit, $EM_SETREADONLY, 0, 0)


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

Jee, thanks :)

Share this post


Link to post
Share on other sites

Do you know maybe the GUICtrlSendMsg command for $WS_VSCROLL?

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