Jump to content
Sign in to follow this  
Nova

Sending data to a CtrlEdit

Recommended Posts

Nova

Im just messing with GUICtrlCreateEdit which ive never had a use for up till now.

How do I send text to an edit control and not make it over wright previous text sent.

For example

GUICtrlSetData ( $MyEdit1, "Line 1")
GUICtrlSetData ( $MyEdit1, "Line 2")

I want the edit to look like after the the text has been set by the GUICtrlSetData commands.

Line 1
Line 2

Instead line 2 just overlaps line 1 deleting it in the process and it looks like this

Line 2

Im sure this is very simple but I justcant get it to work.

Edited by Nova

Share this post


Link to post
Share on other sites
layer

i had this problem, but after

GUICtrlSetData ($MyEdit1, "Line1", 1)
<< you hav to had that 1 there, i remember i had this problem, but add that 1, that should do the trick! :idiot:

FootbaG

Share this post


Link to post
Share on other sites
Nova

No actually that make the text pile up 1 after the other in a horizontal pattern with no spacing :idiot:

Like this

Line1Line2Line3

Share this post


Link to post
Share on other sites
layer

ohhh, my bad, i didnt read your full post :"> why not do

GUICtrlSetData ($MyEdit1, "Line1", 1)
GUICtrlSetData ($MyEdit1, @CRLF, 1)
GUICtrlSetData ($MyEdit1, "Line2", 1)

thats what you want right? :idiot:


FootbaG

Share this post


Link to post
Share on other sites
Nova

thats what you want right? :idiot:

Nope its not actually

Share this post


Link to post
Share on other sites
layer

then what do you want?!!?!??!


FootbaG

Share this post


Link to post
Share on other sites
SlimShady

then what do you want?!!?!??!

<{POST_SNAPBACK}>

Yeah. I tested layer's script and it worked.

I'll post some examples that'll do what you explained.

Example 1 (changed layer's code a bit)

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$Edit_1 = GUICtrlCreateEdit("Some Text", 10, 10, 200, 200)
$Button_1 = GUICtrlCreateButton("OK", 75, 215, 70, 25)

GUISetState(@SW_SHOW)

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $msg = $Button_1
         GUICtrlSetData($Edit_1, @CRLF, 1)
         GUICtrlSetData($Edit_1, "Line1", 1)
         GUICtrlSetData($Edit_1, @CRLF, 1)
         GUICtrlSetData($Edit_1, "Line2", 1)

   EndSelect

WEnd

Example 2

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$Edit_1 = GUICtrlCreateEdit("Some Text", 10, 10, 200, 200)
$Button_1 = GUICtrlCreateButton("OK", 75, 215, 70, 25)

GUISetState(@SW_SHOW)

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $msg = $Button_1
         GUICtrlSetData($Edit_1, @CRLF & "Line1" & @CRLF & "Line2", 1)

   EndSelect

WEnd

Example 3
[code]#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$Edit_1 = GUICtrlCreateEdit("Some Text", 10, 10, 200, 200)
$Button_1 = GUICtrlCreateButton("OK", 75, 215, 70, 25)

GUISetState(@SW_SHOW)

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $msg = $Button_1
         $Content = GUICtrlRead($Edit_1)
         GUICtrlSetData($Edit_1, $Content & @CRLF & "Line1" & @CRLF & "Line2")
         $Content = 0

   EndSelect

WEnd

Share this post


Link to post
Share on other sites
Nova

Tnx for the examples Slim im quite good with the new GUI functions, its just I havnt used ctrledit before and ive never crossed a simular issue either.

Im sure ill get it doing what I want now.

Cheers

Nova

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  

×