Sign in to follow this  
Followers 0
SoundOfDeath

GUICtrlSetData Help

3 posts in this topic

#1 ·  Posted (edited)

Hello first of all here is the script I got so far:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$item1 = "Once upon a time"
$item2 = "A little man walked in the grass"
$item3 = "He smashed into a tree"
$item4 = "And a apple felt on his head, he was lucky he wasn't dead"

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Laptops&Zo\Bureaublad\AutoIt\Form\Story Teller.kxf
$Form1 = GUICreate("Story Test", 538, 218, 192, 124)
$Group1 = GUICtrlCreateGroup("", 8, 0, 521, 209)
$Button1 = GUICtrlCreateButton("Story 1", 16, 16, 107, 25, $WS_GROUP)
$Group2 = GUICtrlCreateGroup("", 128, 0, 401, 209)
$Edit1 = GUICtrlCreateEdit("", 136, 16, 385, 177)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetCursor (-1, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("Story 2", 16, 48, 107, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Story 3", 16, 80, 107, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Story 4", 16, 112, 107, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Story 5", 16, 144, 107, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Credits", 16, 176, 107, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch

If $nMsg = $Button1 Then
    GUICtrlSetData ($Edit1,$item1 & $item2 & $item3 & $item4)
EndIf

WEnd

So as you can see when you click on $Button1 you get a text in $Edit1, the problem here is, I don't know how to separate it with Enter so it will look like this:

Once upon a time

A little man walked in the grass

He smashed into a tree

And a apple felt on his head, he was lucky he wasn't dead

It now just looks like this:

Once upon a timeA little man walked in the grassHe smashed into a treeAnd a apple felt on his head, he was lucky he wasn't dead

can someone help me out with this?

~Thanks

Edited by SoundOfDeath

Share this post


Link to post
Share on other sites



You need to add a @CRLF at the end of a line to move to the next line, change your line that alters the edit to this.

GUICtrlSetData ($Edit1,$item1 & @CRLF & $item2 & @CRLF & $item3 & @CRLF & $item4)

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites

Thanks for the help Yoriz, it works like I wanted it now :(

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