Jump to content

Sending data to a CtrlEdit


Nova
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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