Jump to content

newbie problem


Guest niwre22
 Share

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
Link to comment
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.

qq

Link to comment
Share on other sites

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
Link to comment
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

.

Link to comment
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
Link to comment
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.

qq

Link to comment
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=

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