Jump to content

Recommended Posts

I have this GUI with an edit control. I want to make absolutely sure that any data I send to it is going to be added to the end of the existing data. The problem is that data is always added at the carat point.

Is it possible to disable the edit control so it can't be clicked, without disabling the scroll bar so it can still be scrolled?

If not, is there a way to move the carat to the end position before the data is set?

#include <Array.au3>
 Opt("MustDeclareVars", 1)
 
 GUICreate("Test", 290, 264)
 Local $button = GUICtrlCreateButton("Button", 204, 39, 75, 25, 0x0301);$BS_CENTER + $BS_DEFPUSHBUTTON
 Local $infobox = GUICtrlCreateEdit("Line 1" & @CRLF & _
         "Line 2" & @CRLF & "Line 3" & @CRLF & _
         "Line 4" & @CRLF & "Line 5" & @CRLF & _
         "Line 6" & @CRLF & "Line 7" & @CRLF & _
         "Line 8" & @CRLF & "Line 9" & @CRLF & _
         "Line 10" & @CRLF & "Line 11" & @CRLF & _
         "Line 12" & @CRLF & "Line 13" & @CRLF & _
         "Line 14" & @CRLF & "Line 15", 10, 74, 270, 180, 0x200840);$WS_VSCROLL + $ES_READONLY + $ES_AUTOVSCROLL
 
 GUISetState(@SW_SHOW)
 Local $msg = GUIGetMsg()
 While $msg <> -3
     $msg = GUIGetMsg()
     If $msg = $button Then
         For $X = 16 To 30
             GUICtrlSetData($infobox, @CRLF & "Line " & $X, GUICtrlRead($infobox))
         Next
     EndIf
 WEnd

Maybe

#include <Array.au3>
#include <guiedit.au3>
Opt("MustDeclareVars", 1)

GUICreate("Test", 290, 264)
Local $button = GUICtrlCreateButton("Button", 204, 39, 75, 25, 0x0301);$BS_CENTER + $BS_DEFPUSHBUTTON
Local $infobox = GUICtrlCreateEdit("Line 1" & @CRLF & _
        "Line 2" & @CRLF & "Line 3" & @CRLF & _
        "Line 4" & @CRLF & "Line 5" & @CRLF & _
        "Line 6" & @CRLF & "Line 7" & @CRLF & _
        "Line 8" & @CRLF & "Line 9" & @CRLF & _
        "Line 10" & @CRLF & "Line 11" & @CRLF & _
        "Line 12" & @CRLF & "Line 13" & @CRLF & _
        "Line 14" & @CRLF & "Line 15", 10, 74, 270, 180, 0x200840);$WS_VSCROLL + $ES_READONLY + $ES_AUTOVSCROLL

GUISetState(@SW_SHOW)
Local $msg = GUIGetMsg()
While $msg <> -3
    $msg = GUIGetMsg()
    If $msg = $button Then
        For $X = 16 To 30
            _GUICtrlEdit_AppendText($infobox, @CRLF & "Line " & $X)
           ;GUICtrlSetData($infobox, @CRLF & "Line " & $X, GUICtrlRead($infobox))
        Next
    EndIf
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

well you could always jump into the #Include file , nick the func you want _GUICtrlEdit_AppendText() and paste it as a func in your script. that way you dont need to #include all the rest of the GuiEdit.au3 content.

i know its exactly NOT what your looking for but another way maybe is _GUICtrlEdit_SetSel ($infobox,999,999) just before your GUICtrlSetData($infobox, @CRLF & "Line " & $X, GUICtrlRead($infobox))

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

OMFG, JackDinn, you are a freaking genius!

well, appreciated :D

maybe an even better "fudge" would be to put

Send("{down " & ControlCommand($Hgui, $infobox, "Edit1", "GetLineCount", "") & "}")

before your for next loop, you would need to give the GUI a handle though.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Global $Hgui = GUICreate("Test", 290, 264)
Global $lcount
Local $button = GUICtrlCreateButton("Button", 204, 39, 75, 25, 0x0301);$BS_CENTER + $BS_DEFPUSHBUTTON
Local $infobox = GUICtrlCreateEdit("Line 1" & @CRLF & _
        "Line 2" & @CRLF & "Line 3" & @CRLF & _
        "Line 4" & @CRLF & "Line 5" & @CRLF & _
        "Line 6" & @CRLF & "Line 7" & @CRLF & _
        "Line 8" & @CRLF & "Line 9" & @CRLF & _
        "Line 10" & @CRLF & "Line 11" & @CRLF & _
        "Line 12" & @CRLF & "Line 13" & @CRLF & _
        "Line 14" & @CRLF & "Line 15", 10, 74, 270, 200);$WS_VSCROLL + $ES_READONLY + $ES_AUTOVSCROLL
GUISetState(@SW_SHOW)
$lcount = ControlCommand($Hgui, $infobox, "Edit1", "GetLineCount", "")
Local $msg = GUIGetMsg()
While $msg <> -3
    $msg = GUIGetMsg()
    If $msg = $button Then
        Send("{down " & ControlCommand($Hgui, $infobox, "Edit1", "GetLineCount", "") & "}")
        For $X = 16 To 30
            GUICtrlSetData($infobox, @CRLF & "Line " & $X, GUICtrlRead($infobox))
        Next
    EndIf
WEnd

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

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