Jump to content

Line wrap in control Edit


steph10
 Share

Recommended Posts

Hello,

I am quite new to autoIt and have problems with control Edit: it seems like lines are wrapped automatically to 1024 characters, and I couldn't find how to increase this limit.

My goal is to display very long lines (up to 5,000 chars) without wrapping them on the screen, i.e. only with Hscrollbar to view the end of line.

Here is a sample code that features the problem:

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

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $Form, $Text, $string, $i

    $Form = GUICreate("Pb", 632, 592, 189, 112)
    $Text = GUICtrlCreateEdit("", 8, 32, 617, 145, $GUI_SS_DEFAULT_EDIT)
    $string = "Just a test....."
    For $i = 1 to 8
        $string = $string & $string
    Next
    ; $string is now a string made of 4096 characters
    GUICtrlSetData(-1, $string)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()

            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
EndFunc

Thanks a lot for your pointers!

Steph.

post-60239-12851377950154_thumb.jpg

Link to comment
Share on other sites

  • Moderators

steph10,

Welcome to the AutoIt forum. ;)

A Google search found this on a MS help page:

In the Microsoft Windows graphical environment [...] A multiline edit control is [...] subject to the following limitations:

[...]

The maximum number of characters in a single line is 1024.

The maximum width of a line is 30,000 pixels.

The maximum number of lines is approximately 16,350.

Looks like it is a Windows limitation, not an AutoIt one, which means you are stuck with it. ;)

However, I have found some evidence that RichEdit controls are not limited in the same manner - perhaps you might like to look at the GUIRichEdit UDF to see if that can help you. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

steph10,

The "built-in" controls are all contained within the AutoIt interpreter which is attached to any compiled script. This means that the more "built-in" functions you have, the bigger the compiled files. At present a compiled file is usually about 600k (or about 350k if you compress it with upx) - no-one really wants it to get too much bigger. By using UDFs, we can greatly expand the scope of AutoIt without adding to the size of the interpreter - and the compiled file size. ;)

Another good reason to have UDFs is that it allows people other than the Devs to help improve AutoIt. Anyone can propose UDFs to enable AutoIt to do additional things which may be useful to other coders. These UDFs are available in the Examples section - or you can find them in the sigs of various members (you can see mine below). Some of these UDFs have been included in the main package - although their number is limited in order to keep the installation download to reasonable size and to reduce the burden of keeping the UDFs up to date - much easier to get the original authors to do the work for you. ;)

I hope that explains clearly enough why we have UDFs. I look forward to seeing some of your code in the Examples section some day soon. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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