Reizvoller

GuiCtrlCreateEdit & GuiCtrlSetData Question! :)

6 posts in this topic

Hello!

When utilizing GUICtrlSetData to edit what is displayed in a GUICtrlCreateEdit field, is there a way to just make it write new lines rather than clearing what's there and writing the new information?

For example ... 

GUICtrlSetData ($editField, "Line one"&@CRLF ,  "")
GUICtrlSetData ($editField, "Line two"&@CRLF ,  "")
GUICtrlSetData ($editField, "Line three"&@CRLF ,  "")

What happens now if those three things run one after another, the Edit field displays "Line One" , then that is replaced with "Line Two" and so on with the previous information disappearing and the subsequent taking its place. I'd like for it to say all three, one after another. Any documents on how I may accomplish this?

Thanks!

-Reiz

Share this post


Link to post
Share on other sites



Reizvoller,

Use the GUlEdit UDF - the _GUICtrlEdit_AppendText function is the one you want.

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

Hello there!

Melba23, that sounds just peachy! Trouble I am having now is locating the UDF. I searched the forums for that name and I went through the Wiki ( https://www.autoitscript.com/wiki/User_Defined_Functions ) . I feel like I am once again over looking something plainly obvious... If it's not too much trouble could you spare the time to provide a link? Thanks a bunch!

-Reiz

Share this post


Link to post
Share on other sites

@Reizvoller just do a search in the help file for _GuiCtrlEdit_AppendText. If you have the current version of AutoIt, it's in there ;)


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

Read the help file more carefully. The last parameter of GUICtrlSetData can't be an empty string if you want to append to the text there already.

;~ Change this line
GUICtrlSetData ($editField, "Line three"&@CRLF ,  "")
:` To this
GUICtrlSetData ($editField, "Line three"&@CRLF ,  "x") ; the last parameter can be anything as long as it's not an empty string.

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Ohh! I thought it was an external UDF I had to download. haha , thank you for the clarification :)

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

  • Similar Content

    • rootx
      By rootx
      I hope someone explain me how to do that... well, if you run the command netstat -a inside cmd prompt he look nice( indented ) but if you try to show the output inside the GUICtrlCreateEdit he look without indentation... how can I  fix it? Thx
      $Pid = Run(@ComSpec & " /c " & "netstat -a",@ScriptDir,@SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Dim $_StderrRead='', $_StdoutRead='', $_StdReadAll='' While ProcessExists ( $Pid ) $_StderrRead = StderrRead ( $Pid ) If Not @error And $_StderrRead <> '' Then GUICtrlSetData($Edit1, "Error: " & $_StderrRead & @Crlf ,1) EndIf $_StdoutRead = StdoutRead ( $Pid ) If Not @error And $_StdoutRead <> '' Then GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) EndIf Wend  
    • rootx
      By rootx
      How can I write a good output inside Edit control?
       4 example on notepad (windows) he looks terrible... but he looks perfect on notepad++ and cmd. THX
      GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) the log..
      <snip>
    • kitoy
      By kitoy
      I wanted to make a countdown timer without queueing the countdown message to the next line but the previous data is removed after using GUICtrlSetData. Any thoughts on how to display the previous data/message?

      Here is an example:
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $_main = GUICreate("", 501, 313, -1, -1) Global $g_idMemo = GUICtrlCreateEdit("", 2, 2, 496, 274, $ES_AUTOVSCROLL + $ES_READONLY + $WS_VSCROLL) GUICtrlSetData(-1, "") GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUICtrlSendMsg($g_idMemo, $EM_SETREADONLY, True, 0) GUICtrlSetBkColor($g_idMemo, 0xFFFFFF) GUICtrlSetCursor($g_idMemo, -1) GUISetState(@SW_SHOW) HotKeySet('{esc}', "_close") Func _close() Exit EndFunc ;==>_close Func MemoWrite($sMessage = "") GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite MemoWrite("test message 1") Sleep(1000) MemoWrite("test message 2") Sleep(1000) MemoWrite("test message 3") Sleep(1000) For $i = 5 to 0 Step -1 GUICtrlSetData($g_idMemo, "Program will exit in "&$i&" seconds...") Sleep(1000) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • kashamalasha
      By kashamalasha
      Hello.
      Could you help me find the answer for my issue. I'm trying to set fomatted data wich is selected from SQL to GUICtrlCreateEdit field.
      And the GUICtrlSetData function is inserting it in one line. But when I'm trying to do the same using MsgBox the data looks fine.
      I'm trying to not use _GUICtrlRichEdit UDF.
      Thanks in advance. Here is my test code.
      #include <GUIConstants.au3> #include <GUIListBox.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Opt("GUIOnEventMode", 1) $hMainGUI = GUICreate("Test", 520, 240) $hListBox = _GUICtrlListBox_Create($hMainGUI, "", 10, 10, 180, 80) $hEdit = GUICtrlCreateEdit("", 10, 80, 500, 150) GUISetState(@SW_SHOW, $hMainGUI) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Local $hQuery, $aRow _SQLite_Startup() $hDB = _SQLite_Open('MyDB.sqlite') _SQLite_Query(-1, "SELECT ID ||"". "" || Name FROM Templates ORDER BY ID;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK _GUICtrlListBox_AddString($hListBox, $aRow[0]) WEnd GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Button") While 1 Sleep(100) WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox Switch $iCode Case $LBN_DBLCLK Select_Template(_GUICtrlListBox_GetCurSel($hListBox) + 1) Return 0 EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func CLOSE_Button() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc ;==>CLOSE_Button Func Select_Template($sListItem) _SQLite_QuerySingleRow($hDB, _ "SELECT Content " & _ "FROM Templates " & _ "WHERE ID = " & $sListItem & ";", $aRow) ;~ MsgBox(64, "Test: " & $sListItem, $aRow[0]) GUICtrlSetData($hEdit, $aRow[0]) WinSetTitle($hMainGUI, "", "Test: " & $sListItem) EndFunc ;==>Select_Template