Jump to content
Sign in to follow this  
AndreyS

How to do word wrap in ListBox?

Recommended Posts

Hello everyone!
Maybe someone knows. Is it possible to make long items listboks transferred / broken into multiple lines?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Sounds like you want this:

Specifically, post #17.  It's an Outlook style ListView which should do the trick for you.  Very customizable!

Edited by Artisan

Share this post


Link to post
Share on other sites
If such a ListView control of foliage in the settings that will be possible to set it up on a multi-line then that is what you need! :)
Thanks Artisan for the link! 
I will try!

Share this post


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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Yes, I would like to see your solution, TheSaint, or if you can link to.

 
By the way, dear developers, you can even without spaces between items that are visible on my preview.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Very interesting piece of code.
I began to wonder about other possible uses.

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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: 2020-11-20

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

it works on latest beta

but not on AutoIt 3.3.8.1


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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: 2020-11-20

Share this post


Link to post
Share on other sites
Ahh that's it! :)
Thank mlipok!
Then I see that you have to switch to this version. It is very necessary to implement this functionality.

Share this post


Link to post
Share on other sites
Soooo PhoenixXL! Experienced! A great solution! It was then that I had! That's it! :)
Finally! :) Not easy but you did it! :)
Thank you so much!
Edited by AndreyS

Share this post


Link to post
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

Share this post


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

Share this post


Link to post
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

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By RAMzor
      Hello all,
      I am trying to get scrolling events for ListBox (mouse wheel and up/down arrows) but without success. The event not occured on row change but if I click on it - yes
      The ComboBox works fine even if not in focus (with mouse wheel) but I prefer visual look of ListBox. In addition to all, I can't change the height of control. Unfortunately it depends only on font size and same fonts has different heights between InputBox and ComboBox
      Is there a way to get over the issue?
      Any other ideas for unit selection realization are welcome
      #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> Global $idCombo, $idComboUnit, $idList, $idListUnit Global $sComboInitUnit = "pJ", $fComboVal = 7.5 Global $sListInitUnit = "nF", $fListVal = 0.15 Units_Conversion_Example() Func Units_Conversion_Example() ; Create GUI GUICreate("Units Conversion", 400, 296) $idCombo = GUICtrlCreateInput($fComboVal, 22, 20, 91, 26) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idComboUnit = GUICtrlCreateCombo("", 112, 20, 50, 30) GUICtrlSetData(-1, "uJ|nJ|pJ", $sComboInitUnit) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idList = GUICtrlCreateInput($fListVal, 22, 80, 91, 26) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") $idListUnit = GUICtrlCreateList("", 112, 80, 57, 26, BitOR($LBS_NOTIFY,$LBS_NOSEL,$WS_VSCROLL)) GUICtrlSetData(-1, "uF|nF|pF", $sListInitUnit) GUICtrlSetFont(-1, 13, 400, 0, "MS Reference Sans Serif") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Do Sleep(5) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo, $hWndListBox If Not IsHWnd($idComboUnit) Then $hWndCombo = GUICtrlGetHandle($idComboUnit) If Not IsHWnd($idListUnit) Then $hWndListBox = GUICtrlGetHandle($idListUnit) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hWndCombo Switch $iCode Case $LBN_SELCHANGE ConsoleWrite(GUICtrlRead($idComboUnit) & @CRLF) EndSwitch Case $hWndListBox Switch $iCode Case $CBN_SELCHANGE ConsoleWrite(GUICtrlRead($idListUnit) & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND  
       
    • By Dan_555
      Hi, here are few functions for the ListBox.
      I have searched the forum, but most of the functions are for listview, so i took one example code from melba23 (clear selection) and
      wrote few more functions. (Because my current project needs them).
       
      These functions work only on a Multi-selection ListBox . 
      Edit: Only 1 function does not work with single selection box.
      The functions do: Clear Selection, Delete Selected items, Invert Selection, Move selected items up and down.
       The example code has 2 Listboxes. The selected items on the left ListBox can be moved up and down. The right Listbox has buttons for the other functions.
      #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> Local $singlesel = 0, $iMsgBoxAnswer = 0 ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question, Modality=Task Modal $iMsgBoxAnswer = MsgBox(8228, "Choose Listbox selecton type", "Yes for single, No for multi selection box") If $iMsgBoxAnswer = 6 Then $singlesel = 1 ;Yes Local $BL_1,$BL_2,$BR_1,$BR_2,$BR_3,$BR_4,$BR_5,$BR_6 Global $hForm1 = GUICreate("Listbox test", 349, 287) $LB_1 = GUICtrlCreateList("", 6, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) If $singlesel = 1 Then $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) Else $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) $BR_3 = GUICtrlCreateButton("Reverse Sel", 272, 22, 68, 17) EndIf $BL_1 = GUICtrlCreateButton("Up", 20, 3, 35, 18) $BL_2 = GUICtrlCreateButton("Down", 60, 3, 35, 18) $BR_1 = GUICtrlCreateButton("Up", 200, 3, 35, 18) $BR_2 = GUICtrlCreateButton("Down", 240, 3, 35, 18) $BR_4 = GUICtrlCreateButton("Clear Sel", 217, 22, 52, 17) $BR_5 = GUICtrlCreateButton("Delete", 175, 22, 40, 17) $BR_6 = GUICtrlCreateButton("Populate", 290, 3, 50, 18) GUISetState(@SW_SHOW) For $x = 0 To 50 If $x <= 10 Then GUICtrlSetData($LB_1, $x & " test", 0) GUICtrlSetData($LB_2, $x & " Test", 0) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BL_1 $a = Listbox_ItemMoveUD($LB_1, -1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BL_2 $a = Listbox_ItemMoveUD($LB_1, 1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BR_1 Listbox_ItemMoveUD($LB_2, -1) Case $BR_2 Listbox_ItemMoveUD($LB_2, 1) Case $BR_3 Listbox_ReverseSelection($LB_2) Case $BR_4 Listbox_ClearSelection($LB_2) Case $BR_5 Listbox_DeleteSelectedItems($LB_2) Case $BR_6 ;Populate GUICtrlSetData($LB_2, "") ; Clears the listbox For $x = 0 To 50 GUICtrlSetData($LB_2, $x & " Test", 0) Next EndSwitch WEnd ;note $hLB_ID - is the Listbox id Func Listbox_DeleteSelectedItems($hLB_ID) Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Get selected items Local $i, $slb = 0, $y, $x If $aSel[0] = 0 Then ;If the array is empty, there is no selection, or it is a single selection listbox For $x = 0 To _GUICtrlListBox_GetCount($hLB_ID) - 1 $y = _GUICtrlListBox_GetSel($hLB_ID, $x) If $y = True Then $slb = 1 _GUICtrlListBox_DeleteString($hLB_ID, $x) ;Perform a delete on single sel. LB ExitLoop EndIf Next EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = $aSel[0] To 1 Step -1 ;Loop backwards and delete the selected items _GUICtrlListBox_DeleteString($hLB_ID, $aSel[$i]) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_DeleteSelectedItems Func Listbox_ClearSelection($hLB_ID) ;Removes the selection from multi and single selection ListBox Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Code from Melba23 - Autoit Forum Local $slb, $x, $y If $aSel[0] = 0 Then _GUICtrlListBox_SetCurSel($hLB_ID, -1) $slb = 1 EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 1 To $aSel[0] _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i], False) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_ClearSelection Func Listbox_ReverseSelection($hLB_ID) ;Logically, this function works only on multi-selection listboxes Local $i Local $aCou = _GUICtrlListBox_GetCount($hLB_ID) Local $cSel = _GUICtrlListBox_GetCaretIndex($hLB_ID) ;Save the caret _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 0 To $aCou _GUICtrlListBox_SetSel($hLB_ID, $i, Not (_GUICtrlListBox_GetSel($hLB_ID, $i))) Next _GUICtrlListBox_SetCaretIndex($hLB_ID, $cSel) ;Restore the caret _GUICtrlListBox_EndUpdate($hLB_ID) EndFunc ;==>Listbox_ReverseSelection Func Listbox_ItemMoveUD($hLB_ID, $iDir = -1) ;Listbox_ItemMoveUD - Up/Down Move Multi/Single item in a ListBox ;$iDir: -1 up, 1 down ;Return values -1 nothing to do, 0 nothing moved, >0 performed moves Local $iCur, $iNxt, $aCou, $aSel, $i, $m = 0, $y, $slb = 0 ;Current, next, Count, Selection, loop , movecount $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Put selected items in an array $aCou = _GUICtrlListBox_GetCount($hLB_ID) ;Get total item count of the listbox If $aSel[0] = 0 Then $y = _GUICtrlListBox_GetCurSel($hLB_ID) If $y > -1 Then _ArrayAdd($aSel, $y) $aSel[0] = 1 $slb = 1 EndIf EndIf ;WinSetTitle($hGUI, "", $aSel[0]) ;Debugging info Select Case $iDir = -1 ;Move Up For $i = 1 To $aSel[0] If $aSel[$i] > 0 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] - 1) ;Save the selection index - 1 text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] - 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) ;Replace the index-1 text with the index text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) ;Replace the selection with the saved var $m = $m + 1 EndIf Next For $i = 1 To $aSel[0] ;Restore the selections after moving If $aSel[$i] > 0 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] - 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] - 1) EndIf EndIf Next Return $m Case $iDir = 1 ;Move Down If $aSel[0] > 0 Then For $i = $aSel[0] To 1 Step -1 If $aSel[$i] < $aCou - 1 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] + 1) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] + 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) $m = $m + 1 EndIf Next EndIf For $i = $aSel[0] To 1 Step -1 ;Restore the selections after moving If $aSel[$i] < $aCou - 1 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] + 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] + 1) EndIf EndIf Next Return $m EndSelect Return -1 EndFunc ;==>Listbox_ItemMoveUD  
    • By topgundcp
      Hi, 
      This is my very first post in this forum and am also new with Autoit programming so be easy on me.
      Below is the code that I am trying to get the index of the item selected. No problem getting the text.
      Case $listEdition   ; handle of the list             local $index=0             $item=GUICTRLRead($listEdition)    ; This will return the text in the list             ; ==============   The loop below always fails  ==================             ; Meaning _GUICtrlListView_GetItemSelected($listEdition, $i) always return FALSE. WHY ???????              For $i = 0 To $editionArray[0] - 1   ; The content of the list in an array where editionArray[0] contains total count of items                 If _GUICtrlListView_GetItemSelected($listEdition, $i) Then                     $index = $i                     exitloop                 EndIf              Next              ;===================================================             ConsoleWrite( "Select Edition:     " & $item & "  index: " & $index & @CR) ....... Please look at the comments in the code & the pix attached.
      _GUICtrlListView_GetItemSelected($listEdition, $i) always returns FALSE.
      Another problem is on the list. It also populate  the total count of items from the Array. How can I skip this item from populating to the list ?.
      Please advise and thanks

    • By kneze
      Hi
      first step i write ipconfig output to ipconfig.txt. Now i try to find all Adapters and get for each adapter: Adapter Name, Description, Media State and Mac Adress and put it to listbox. I search for "Ethernet Adapter" but they are other entrys like Wireless Adapter .. How can i get all Adapters from ipconfig.txt and information for each adapter Adapter Name, Description, Media State and Mac Adress and write to listbox ? 
      Would appreciate any help!
      #include <File.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 451, 328, 856, 237) $Button1 = GUICtrlCreateButton("Button1", 8, 8, 75, 25) $List1 = GUICtrlCreateList("", 88, 8, 353, 305) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select ;Case $GUI_EVENT_CLOSE Case $msg = $GUI_EVENT_CLOSE Exitloop Case $msg = $Button1 $FilePath= "C:\temp\IPconfig.txt" $StringToSearch= "Ethernet adapter" $CaseSense=0 $Lines=_FileCountLines($FilePath) $hFile=FileOpen($FilePath,0) $Lines=_FileCountLines($FilePath) For $i=0 To Number($Lines) $Test=FileReadLine($hFile,$i) If StringInStr($Test,$StringToSearch,$CaseSense) Then $filereadAdapter = FileReadLine($hFile,$i) $filereadDescription = FileReadLine($hFile,$i+4) $filereadMediaState = FileReadLine($hFile,$i+2) $filereadMAcAdress = FileReadLine($hFile,$i+5) GUICtrlSetData($List1 , "Adapter: " & $filereadAdapter & @CRLF& "Description: "& $filereadDescription & @CRLF & "Media State: " & $filereadMediaState & @CRLF & "Mac Adress: " & $filereadMAcAdress& @CRLF) ;ExitLoop EndIf Next FileClose($hFile)  
       
    • By nacerbaaziz
      can we  create a list box with  Columns?
      welcome everybody
      Dears I have a question if you let me
      can we  create a list box with  Columns?
      i know we can create a list view with Columns
      but my question is about the list box
      I'm waiting your responses
      Thank you in advance
×
×
  • Create New...