Jump to content
Sign in to follow this  
Guest niwre22

newbie problem

Recommended Posts

Guest niwre22

Hi,

I have a problem with bij GUI, and I can't find in the helpfile... :(

What's my problem:

$Edit_1 = GUICtrlCreateEdit("My story about myself: {ENTER} Hi! {ENTER} ...", 50, 182, 498,)

I would like type a story in the textbox, but if I type: {ENTER}, the line doesn't go done... (Enter)

How can I fix that problem?

The people can read the text, but also edit the text! :(

How can I do that people alone read the text, en NOT edit the text?

Thx!

Niwre22

Edited by niwre22

Share this post


Link to post
Share on other sites
buzz44

Welcome :(.

To simulate a line break in AutoIt we use...

@CR

Carriage return, Chr(13); sometimes used for line breaks.

@LF

Line feed, Chr(10); typically used for line breaks.

@CRLF

= @CR & @LF ;occasionally used for line breaks.

$Edit_1 = GUICtrlCreateEdit("My story about myself: " & @CRLF & "Hi!" & @CRLF & "...", 50, 182, 498,)

For more information type one of the above into the help file.


qq

Share this post


Link to post
Share on other sites
Guest niwre22

thanks Burrup,

It works now great! :(

About my second question...

Is this also possible with AutoIT?

Share this post


Link to post
Share on other sites
Wb-FreeKill

thanks Burrup,

It works now great! :(

About my second question...

Is this also possible with AutoIT?

<{POST_SNAPBACK}>

Something like this?

GUICtrlCreateedit("You can't edit me",20,20,300,200,$ES_READONLY)

Or

GUICtrlCreateedit("You can't edit me",20,20,300,200)
GUICtrlSetState(-1,$GUI_DISABLE)
Edited by Wb-FreeKill

Share this post


Link to post
Share on other sites
quick_sliver007

Seeing that this is for a story, you may want to look at the $WS_VSCROLL style too. To add a scroll bar to the Edit.

Like this also..............

GuiCreate("MyGUI", 500, 500)
$Edit_1 = GUICtrlCreateEdit("My story about myself: " & @CRLF & "Hi!" & @CRLF & "...", 0, 0, 500,500,$ES_READONLY + $WS_VSCROLL)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case Else
    ;;;
    EndSelect
WEnd

.

Share this post


Link to post
Share on other sites
Guest niwre22

I can't edit the text!

But...

The background of the edit box is black, and it must be White. :(

Thx for help!

Edited by niwre22

Share this post


Link to post
Share on other sites
buzz44

#include <GUIConstants.au3>

Global Const $EM_SETREADONLY = 0xCF

GUICreate("MyGUI", 300, 200)

$Edit = GUICtrlCreateEdit("My story about myself: " & @CRLF & "Hi!" & @CRLF & "...", 0, 0, 200,200, $ES_READONLY + $WS_VSCROLL)
$check = GUICtrlCreateCheckbox ("Read Only?", 210, 10, 100, 20)

GUICtrlSetState($check, $GUI_CHECKED)
GUICtrlSetBkColor ($Edit, 0xFFFFFF)

GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         Exit
      Case $msg = $check
         If $check = $GUI_CHECKED Then
            GUICtrlSetStyle ($Edit, $ES_READONLY + $WS_VSCROLL)
         ElseIf $check = $GUI_UNCHECKED Then
            GUICtrlSetStyle ($Edit, $EM_SETREADONLY + $WS_VSCROLL)
         EndIf
   EndSelect
WEnd

The check box works but setting the style to $ES_READONLY/$EM_SETREADONLY doesn't. I believe it is a bug that should be fixed and I have submitted it to the 'Bug Reports' forum.


qq

Share this post


Link to post
Share on other sites
blindwig

The check box works but setting the style to $ES_READONLY/$EM_SETREADONLY doesn't. I believe it is a bug that should be fixed and I have submitted it to the 'Bug Reports' forum.

<{POST_SNAPBACK}>

I had similiar issues setting the editbox to readonly or readwrite after creation. I got it working. Here's the thread:

http://www.autoitscript.com/forum/index.ph...topic=10744&hl=

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  

×