Jump to content

How to do word wrap in ListBox?


AndreyS
 Share

Recommended Posts

Need a little clarification before I can help you.

Is it just an issue of display?  If so, look at GUICtrlListView - it automatically includes a horizontal scroll bar and resizable column headers.

Do you want Word Wrap applied to longer strings so that one long entry is more than one line?  I think GUICtrlListView can do that too.

Do you want to break a long string into multiple single-line entries?  That's easy to do with a few String...() functions.

Link to comment
Share on other sites

Thank you for having responded to that!

Will explain. I saw the need to fully long elements without using the horizontal scroll is. Items consist of a few sentences so that they fit only 3-4 lines. When you click on an item must be allocated all of the rows of the item.

Link to comment
Share on other sites

  • 3 weeks later...
Is it possible to make long items listboks transferred / broken into multiple lines?

Then there would be two different items and selection of both the items at the same time won't be possible.

Rather when strings are long, a hover tip could be used to display( >if interested )

Best regards :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

#include <WindowsConstants.au3>
$sText = 'This is a very long string . But that''s not the problem. The line will be divided by the length of no more than 35 characters.'
$hGui = GUICreate('My Program', 250, 260)
$iList = GUICtrlCreateList('', 10, 10, 230, 240, $WS_BORDER + $WS_VSCROLL)
GUICtrlSetData($iList, StringRegExpReplace($sText, '(.{35,}?)\h', '$1|'))
GUISetState()
Do
Until GUIGetMsg() = -3

Link to comment
Share on other sites

Thanks for the option Azjio!
In this embodiment, obtained as a result of three elements, it is necessary that there was one. And that when clicked immediately stood out all the lines.
 
 

post-54057-0-85711500-1378556819_thumb.j

Edited by AndreyS
Link to comment
Share on other sites

Word Wrap or more correctly Text Wrap (for unbroken text) will occur if you don't use any Horizontal Scroll parameters during ListBox creation. At least, that's how it works for me with AutoIt v3.3.0.0 .... not sure for current AutoIt. In that same version, you cannot set this after ListBox creation using GUICtrlSetStyle ... not without deleting and recreating the control.

This behavior can be seen in my WebPad program, currently available in the most recent listings of Examples section of forum.

Text Wrap is a menu item.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

This behavior can be seen in my WebPad program, currently available in the most recent listings of Examples section of forum.

Text Wrap is a menu item.

But it is an edit control and we are speaking about ListBox, can you provide an example for a listbox ?

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

This is what I've got for the moment.

If you are interested in it tell me for any modifications.

Added a lot more of code and functions

Features

  • Add, Insert or Delete(one or all) Item
  • Call function when item is clicked
  • Support of scrolling with arrow buttons
  • VScroll Bar is now included
  • Enter is also taken as an event
  • Set your own cursor
  • Multiple EditLists could be used at a time.

 

EditList.au3

#include-once
#include <Array.au3>
#include <WinAPISys.au3>
#include <WinAPIRes.au3>
#include <APISysConstants.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

; = = = = = = .  . . . Private UDF Global Variables ===========================================================

Global $aItems[1] ;stores Item indexes
Global $sAppend ;stores Item delimited
Global $__hCur ;stores the handle to the cursor
Global $h_ControlHwnd ;stores the handle of the control.
Global $p_Original_WindowProc ;stores the original window procedure(WndProc) of the edit control.

Global $h_NewWndProc = DllCallbackRegister("_NewWnd_Proc_", "int", "hwnd;uint;wparam;lparam") ;hanlde to the new WndProc
Global $p_NewWndProc = DllCallbackGetPtr($h_NewWndProc) ;pointer to the new WndProc.

Global $s_OnEventFunc ;string storing the name of the func to call upon click.

Func _Edit_List_Create($iX, $iY, $iWidth, $iHeight, $hWin, $sAppendString = -1)

    $h_ControlHwnd = _GUICtrlRichEdit_Create($hWin, "", $iX, $iY, $iWidth, $iHeight, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_NOHIDESEL))
    OnAutoItExitRegister("Destroy")

    $p_Original_WindowProc = _Subclass_($h_ControlHwnd, $p_NewWndProc)

    _GUICtrlRichEdit_SetText($h_ControlHwnd, "")

    If $sAppendString = -1 Then $sAppendString = @LF
    $sAppend = $sAppendString
    $aItems[0] = -StringLen($sAppend)

    Return $h_ControlHwnd ;

EndFunc   ;==>_Edit_List_Create

Func _Edit_List_Suspend()

    Local $aRet[6] = [$aItems, $sAppend, $__hCur, $h_ControlHwnd, $p_Original_WindowProc, $s_OnEventFunc]
    ReDim $aItems[1]
    $sAppend = ""
    $__hCur = 0
    $h_ControlHwnd = 0
    $p_Original_WindowProc = 0
    $s_OnEventFunc = ""
    Return $aRet

EndFunc   ;==>_Edit_List_Suspend

Func _Edit_List_Restore($aData)
    If IsArray($aData) = 0 Then Return
    $aItems = $aData[0]
    $sAppend = $aData[1]
    $__hCur = $aData[2]
    $h_ControlHwnd = $aData[3]
    $p_Original_WindowProc = $aData[4]
    $s_OnEventFunc = $aData[5]

EndFunc   ;==>_Edit_List_Restore

Func _Edit_List_GetActive()
    Return $h_ControlHwnd
EndFunc   ;==>_Edit_List_GetActive

Func _Edit_List_InsertItem($s_Text, $iIndex = -1)

    Local $sEdit_Text = _GUICtrlRichEdit_GetText($h_ControlHwnd)
    Local $iMaxLen = StringLen($sEdit_Text)

    If IsInt($iIndex) = 0 Then Return SetError(2, 0, 0) ;bad $iIndex
    $s_Text = StringRegExpReplace($s_Text, "\v+", @LF)

    If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0)

    If $iIndex >= 1 Then

        Local $iUbound = UBound($aItems)
        If $iIndex > $iUbound Then Return SetError(3, 0, 0) ;bad $iIndex

        _GUICtrlRichEdit_GotoCharPos($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend))
        _GUICtrlRichEdit_InsertText($h_ControlHwnd, $s_Text & $sAppend)

        Local $Change = StringLen($s_Text & $sAppend)

        _ArrayInsert($aItems, $iIndex - 1, $aItems[$iIndex - 1])
        ;reset the array
        For $i = $iIndex To $iUbound
            $aItems[$i] += $Change
        Next


    ElseIf $iIndex = -1 Then

        _ArrayAdd($aItems, StringLen($sEdit_Text & $s_Text))
        _GUICtrlRichEdit_AppendText($h_ControlHwnd, $s_Text & $sAppend)

    Else
        Return SetError(1, 0, 0) ;$iIndex parameter is wrong.
    EndIf

    Return 1

EndFunc   ;==>_Edit_List_InsertItem

Func _Edit_List_GetItemText($iIndex = -1) ;by default gets the selected items text
    If $iIndex = -1 Then Return _GUICtrlRichEdit_GetSelText($h_ControlHwnd)
    If $iIndex <= 0 Or IsInt($iIndex) = 0 Then Return SetError(1, 0, 0)
    If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0)
    Return _GUICtrlRichEdit_GetTextInRange($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex])
EndFunc   ;==>_Edit_List_GetItemText

Func _Edit_List_GetSelItemIndex()
    Local $iLowerIndex = _GUICtrlRichEdit_GetSel($h_ControlHwnd)
    If @error Then Return SetError(1, @error, 0)
    $iLowerIndex = $iLowerIndex[0]

    For $i = 1 To UBound($aItems) - 1
        Switch $iLowerIndex
            Case $aItems[$i - 1] + StringLen($sAppend) To $aItems[$i]
                Return $i
        EndSwitch
    Next

    Return SetError(2, 0, 0)
EndFunc   ;==>_Edit_List_GetSelItemIndex

;The Following function was works using the functions of the already present library.
;Therefore it would work with both OnEvent as well as MsgLoop methods.
;PS: The OnEvent macros won't work like @GUI_CTRLID, etc.
;Use _Edit_List_SetOnClick("") to deregister an already registered function.
;The function should not have any parameter.
Func _Edit_List_SetOnEvent($s_FuncName)
    $s_OnEventFunc = $s_FuncName
EndFunc   ;==>_Edit_List_SetOnEvent


Func _Edit_List_SetCursor($hCursor)
    $__hCur = $hCursor;_WinAPI_CopyCursor()
EndFunc   ;==>_Edit_List_SetCursor

Func _Edit_List_SetSel($iIndex, $iReverse = False)
    ;key: the index of the array is the length of the item,
    ;use the index of the previous item to get the initial position of the required item
    If IsInt($iIndex) = 0 Or $iIndex < 1 Or $iIndex >= UBound($aItems) Then Return SetError(1, 0, 0)

    Local $iAnchor = $aItems[$iIndex - 1] + StringLen($sAppend)
    Local $iActive = $aItems[$iIndex]

    If $iReverse Then _ArraySwap($iActive, $iAnchor)

    Return _GUICtrlRichEdit_SetSel($h_ControlHwnd, $iAnchor, $iActive)
EndFunc   ;==>_Edit_List_SetSel

Func _Edit_List_RemoveItem($iIndex)

    If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0)

    _GUICtrlRichEdit_SetSel($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex] + 1)
    _GUICtrlRichEdit_ReplaceText($h_ControlHwnd, "", False)

    Local $Change = StringLen(_Edit_List_GetItemText($iIndex) & $sAppend)

    _ArrayDelete($aItems, $iIndex)
    ;reset the array
    For $i = $iIndex To UBound($aItems) - 1
        $aItems[$i] -= $Change
    Next

    _SendMessage($h_ControlHwnd, $WM_SETFOCUS)

EndFunc   ;==>_Edit_List_RemoveItem

Func _NewWnd_Proc_($hWnd, $iMsg, $wParam, $lParam)




    Switch $hWnd
        Case $h_ControlHwnd
            Switch $iMsg

                Case $WM_RBUTTONDOWN, $WM_CHAR
                    Return 0

                Case $WM_SETCURSOR
                    If $__hCur <> 0 And _WinAPI_LoWord($lParam) = 1 Then Return _WinAPI_SetCursor($__hCur) ;lparam = hittest = 1 = client area

                Case $WM_KEYDOWN

                    Local Const $VK_UP_ = 0x26
                    Local Const $VK_DOWN_ = 0x28
                    Local Const $VK_ENTER_ = 0x0D

                    Switch $wParam
                        Case $VK_UP_, $VK_DOWN_

                            _Edit_List_SetSel(_Edit_List_GetSelItemIndex() + $wParam - 0x27, $wParam - 0x28)
                            _GUICtrlRichEdit_ScrollToCaret($hWnd)

                        Case $VK_ENTER_

                            If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 1)

                    EndSwitch
                    Return 0

                Case $WM_KILLFOCUS

                    $iRet = _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam)

                    DllCall("user32.dll", "int", "ShowCaret", "hwnd", $hWnd)

                    Return $iRet

                Case $WM_SETFOCUS
                    $iRet = _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam)

                    DllCall("user32.dll", "int", "HideCaret", "hwnd", $hWnd)

                    Return $iRet

                Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK

                    $iX = _WinAPI_LoWord($lParam)
                    $iY = _WinAPI_HiWord($lParam)
                    $iChar = _GUICtrlRichEdit_GetCharPosFromXY($hWnd, $iX, $iY);

                    For $n = 1 To UBound($aItems) - 1
                        Switch $iChar
                            Case $aItems[$n - 1] + StringLen($sAppend) To $aItems[$n]

                                _Edit_List_SetSel($n, 1)
                                _GUICtrlRichEdit_ScrollToCaret($hWnd)

                        EndSwitch
                    Next
                    If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 0)

                    Return 0;

            EndSwitch
        Case Else
            Switch $iMsg

                Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK

                    If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 0)
                    Return 0;
            EndSwitch

    EndSwitch
    ;go with the original processing.
    Return _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam)

EndFunc   ;==>_NewWnd_Proc_

Func _Subclass_($hWnd, $pNew_WndProc)

    ;substitute the WndProc of the control.
    Return _WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, $pNew_WndProc)

EndFunc   ;==>_Subclass_

Func Destroy()

    _Subclass_($h_ControlHwnd, $p_Original_WindowProc)
    _GUICtrlRichEdit_Destroy($h_ControlHwnd)
    _WinAPI_DestroyCursor($__hCur)

EndFunc   ;==>Destroy

Func _Edit_List_Clear()
    ReDim $aItems[1]
    Local $iRet = _GUICtrlRichEdit_SetText($h_ControlHwnd, "")
    _SendMessage($h_ControlHwnd, $WM_SETFOCUS)

    Return $iRet
EndFunc   ;==>_Edit_List_Clear

Test Script.au3

;Note the script requries AutoIT v3.3.10++

#include <EditList.au3>
#include <WinAPIRes.au3>

If StringMid(@AutoItVersion, 3, 4) <> "3.10" Then Exit MsgBox(16, "Error", "The script requries AutoIT v3.3.10++" & @CRLF & "You have " & @AutoItVersion)

$hMain = GUICreate("Test", 700, 300)
Global $hRichEdit_1 = _Edit_List_Create(10, 10, 300, 280, $hMain)

_Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling.")
_Edit_List_InsertItem("4. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)" & @CRLF)
_Edit_List_InsertItem("2. Call Win32 and Third-Party DLL APIs." & @CRLF, 2)
_Edit_List_InsertItem("3. COM support", 3)

Local $hCur = _WinAPI_LoadCursor(0, $IDC_HAND)
_Edit_List_SetCursor($hCur)
_WinAPI_DestroyCursor($hCur)

_Edit_List_SetOnEvent(OnEvent_Handler)

;Now before creating a new EditList we have to suspend the first EditList
Global $aData = _Edit_List_Suspend()


Global $hRichEdit_2 = _Edit_List_Create(390, 10, 300, 280, $hMain)

_Edit_List_InsertItem("The only things that evolve by themselves in an organization are disorder, friction and malperformance." & @CRLF)
_Edit_List_InsertItem("The mind is everything. What you think you become.  –Buddha" & @CRLF)
_Edit_List_InsertItem("There is only one way to avoid criticism: do nothing, say nothing, and be nothing. –Aristotle" & @CRLF)
_Edit_List_InsertItem("A person who never made a mistake never tried anything new. – Albert Einstein" & @CRLF)
_Edit_List_InsertItem("The battles that count aren’t the ones for gold medals. The struggles within yourself–the invisible battles inside all of us–that’s where it’s at. –Jesse Owens")

_Edit_List_SetOnEvent(OnEvent_Handler)


GUISetState()

_SendMessage($hRichEdit_2, $WM_SETFOCUS) ;required for initial hiding of the caret. The one created at last should be set the focus

Do
    Sleep(10)
Until GUIGetMsg() = -3 ;$GUI_EVENT_CLOSE = -3

Func OnEvent_Handler($hRichEdit, $iEvent)
    ;$hRichedit is the handle of the richedit from where the function is called
    ;$iEvent
    ;   1| OnEnterDown (received when it is the current editlist)
    ;   0| OnLeftClick
    Switch $iEvent
        Case 0  ;onmouse click
            If _Edit_List_GetActive() <> $hRichEdit Then
                Local $bData = _Edit_List_Suspend()
                _Edit_list_Restore($aData)
                $aData = $bData
                MouseClick('left', Default, Default, 1, 0)  ;simulate a click to set selection
            EndIf
    EndSwitch
    ConsoleWrite("Item Selected: " & _Edit_List_GetSelItemIndex() & @TAB & "  ItemText: " & _Edit_List_GetItemText() & @CRLF)

EndFunc   ;==>OnEvent_Handler


 

Let me know what you think.

Thumbs up if it helped

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Very interesting piece of code.
I began to wonder about other possible uses.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

So so so so much! :) I see the code that is something very similar to the one that I need! :)
 
It is true when you start I get errors:
 
D: Program Files AutoIt3 Include APIConstants.au3 (1989,41): ERROR: $ FR_DIALOGTERM previously declared as a 'Const'.
Global Const $ FR_DIALOGTERM = 0x00000040
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
D: Program Files AutoIt3 Include APIConstants.au3 (1991,41): ERROR: $ FR_ENABLEHOOK previously declared as a 'Const'.
Global Const $ FR_ENABLEHOOK = 0x00000100
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
... and so on.
 
How to fix it?
I'd like to see the results!
Edited by AndreyS
Link to comment
Share on other sites

it works on latest beta

but not on AutoIt 3.3.8.1

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

But it is an edit control and we are speaking about ListBox, can you provide an example for a listbox ?

Doh!  :wacko:

(insert facepalm here)

Where was my brain?  :blink:

Sorry AndreyS - I think my brain was taking a vacation on another planet.  :ermm:

Haven't been myself, since the damn AUS election went to the Immoral party.

P.S. To be fair to my brain though, Word Wrap in a ListBox is a little out of the ordinary ... traditionally you just use a horizontal scrollbar to see the entire entry in a line. ListBox isn't dynamic like an Excel spreadsheet, and I only see trouble spreading things over more than one line. That said, I haven't really looked at the proposals you've been given so far ... certainly not in detail anyway.

For myself, I have always used a Tooltip to display what may be a long entry. I also often use a long Input, that is wider than the Listbox ... when feasible. Another way, is to show a shorter List version, linked to an ini file entry, that displays the full entry over two or more Inputs or a multiline Edit ... done that before too. Obviously they are just for the selected entry in the ListBox.

EDIT

Noticing your Thumbnail again, I can see why my mind thought Edit.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 2 weeks later...
How to fix it?
I'd like to see the results!

I made it on Autoit 3.3.8.1, the problem arises due to the errors in the APIConstants.au3 that you may not have rectified/updated.

I replaced the includes and it would work without APIConstants w/o any problem on the stable release. Check the code again in the stable release.

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Guys,

Try to refrain from using -3 and opt for $GUI_EVENT_CLOSE instead. Also I'm not getting any errors with APIIConstants.au3. What version of then beta are you using please PhoenixXL?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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

×
×
  • Create New...