Sign in to follow this  
Followers 0
Guest niwre22

newbie problem

8 posts in this topic

#1 ·  Posted (edited)

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



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.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

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

#4 ·  Posted (edited)

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

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

#6 ·  Posted (edited)

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

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


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

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