Jump to content

ListView - expand items automatically


nitekram
 Share

Recommended Posts

I have read the extended style list of options and have tried many, but have not been able to find the one I am looking for. I want the lists to auto expand, meaning I do not have to  click on the vertical bar to read the rest of the text. Can someone tell my which me is this even possible? I have tried padding with spaces and other combination of extended styles.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram

Use _GUICtrlListView_SetColumnWidth with $LVSCW_AUTOSIZE as the width parameter - then the columns expand to fit the content. But be aware that you may push the content over the edge of the ListView and so introduce scrollbars..

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

@Melba23,

I just tried that, and it does not appear to work...here is my function, and the first column is now smaller than it was previous. I am sure I have done something wrong, just not sure what. I am leaving for the day, so will not be able to test again until tomorrow - thanks for any help and suggestions.

Func oOApp_NewMailEx($sOL_EntryId)
    Static $iCurrent = ''
    $iCurrent = $sOL_EntryId
    If @UserName = 'username' Then
        Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)
        #cs
            MsgBox(64, "OutlookEX UDF Example Script", "New mail has arrived!" & @CRLF & @CRLF & _
            "From:    " & $oOL_Item.SenderName & @CRLF & _
            "Subject: " & $oOL_Item.Subject)
        #ce

        Local $hNewMail = ''

        $hNewMail = WinActive("[active]", "")
        ;MsgBox('','', $hNewMail)
        Sleep(200)
        Local $aWidthSender = _StringSize($oOL_Item.SenderName)
        Local $aWidthSubject = _StringSize($oOL_Item.Subject)
        Local $hGUI = GUICreate('New Outlook Email Alert', $aWidthSubject[2] + 400, 200, -1, -1, $WS_MAXIMIZEBOX + $WS_SIZEBOX, $WS_EX_TOPMOST)
        Local $idOK = GUICtrlCreateButton("OK", 110, 150, 85, 25)


        Local $sSpacesSender = ' '
        For $x = 0 To $aWidthSender[2]
            $sSpacesSender &= ' '

        Next


        Local $sSpacesSubject = ' '
        For $x = 0 To $aWidthSubject[2]
            $sSpacesSubject &= ' '

        Next


        Local $idListview = GUICtrlCreateListView("From " & $sSpacesSender & "|Subject" & $sSpacesSubject, 0, 0, $aWidthSubject[2] + 400, 50, $LVS_REPORT, $LVS_EX_FULLROWSELECT)
        _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE)
        GUICtrlCreateListViewItem($oOL_Item.SenderName & '|' & $oOL_Item.Subject, $idListview)
        ;Local $idLable01 = GUICtrlCreateLabel("From:    " & $oOL_Item.SenderName, 10, 10)
        ;Local $idLable01 = GUICtrlCreateLabel("Subject: " & $oOL_Item.Subject, 10, 50)

        GUISetState(@SW_SHOW, $hGUI)
        Sleep(200)

        ;WinActivate('New Outlook Email Alert')
        Sleep(200)

        WinActivate($hNewMail)

        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE, $idOK
                    GUISetState(@SW_HIDE, $hGUI)
                    ExitLoop

            EndSwitch
        WEnd


    EndIf
EndFunc   ;==>oOApp_NewMailEx

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

You need to reset the width after you add each item so that the ListView can determine how much it to needs to expand the column:

#include <GUIConstantsEx.au3>
#include <GUIListView.au3>
#include <String.au3>

$hGUI = GUICreate("Test", 500, 500)

$cListView = GUICtrlCreateListView("Expander|Total width", 10, 10, 480, 400)
GUICtrlSetFont($cListView, Default, Default, Default, "Consolas") ; Monospaced font

$cAdd = GUICtrlCreateButton("Add Item", 10, 450, 80, 30)

GUISetState()

$iWidth = 0

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAdd

            $iWidth += 1
            $sString = _StringRepeat(Chr(Random(65, 90, 1)), $iWidth)
            GUICtrlCreateListViewItem($sString & "|" & $iWidth, $cListView)
            _GUICtrlListView_SetColumnWidth($cListView, 0, $LVSCW_AUTOSIZE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch

WEnd

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

I have tried a few different ways to try and get it to work, but it never expands - I have placed it after the create list view item, but it still does not expand...could it be that the string coming from the object, is conflicting with this?

Func oOApp_NewMailEx($sOL_EntryId)
    If @UserName = 'username' Then
        Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)
        #cs
            MsgBox(64, "OutlookEX UDF Example Script", "New mail has arrived!" & @CRLF & @CRLF & _
            "From:    " & $oOL_Item.SenderName & @CRLF & _
            "Subject: " & $oOL_Item.Subject)
        #ce
        Local $hNewMail = ''

        $hNewMail = WinActive("[active]", "")
        ;MsgBox('','', $hNewMail)
        Sleep(200)
        Local $aWidthSender = _StringSize($oOL_Item.SenderName)
        Local $aWidthSubject = _StringSize($oOL_Item.Subject)
        Local $sSenderName = $oOL_Item.SenderName
        Local $sSubject = $oOL_Item.Subject

        Local $hGUI = GUICreate('New Outlook Email Alert', $aWidthSubject[2] + 400, 200, -1, -1, $WS_SIZEBOX, $WS_EX_TOPMOST)
        Local $idOK = GUICtrlCreateButton("OK", 110, 160, 85, 25)
        
        GUISetState(@SW_SHOW, $hGUI)

        Local $idListview = GUICtrlCreateListView("From|Subject", 10, 10, $aWidthSubject[2] + 400, 110)
        GUICtrlSetFont($idListview, Default, Default, Default, "Consolas") ; Monospaced font
        GUICtrlCreateListViewItem($sSenderName & '|' & $sSubject, $idListview)
        _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE)

        Sleep(200)

        WinActivate($hNewMail)

        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE, $idOK
                    GUISetState(@SW_HIDE, $hGUI)
                    ExitLoop

            EndSwitch
        WEnd

    EndIf
EndFunc   ;==>oOApp_NewMailEx

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

Does the ListView in my example script expand as it should?

M23

P.S. The monospaced font was only to ensure that each item was wider - you can use any font.

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

Yours seems to work fine on yours, yet because the chars are different widths, some lines are longer than others. I went to like 30 on yours. Mine is about more or less.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

I have no idea why it does not work in your script - I used exactly the same trick when rewriting _ArrayDisplay so that its ListView expanded to fit the data and to date no-one has mentioned that it does not. Unfortunately I do not use OutLook so I cannot test the code as it is written, but I do notice that there appears to be no loop adding new items, so why do you need to resize the ListView at all? Surely you can size the ListView and its columns directly using the _StringSize return?

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

Yeah, If that had worked, I would not have started this LOL. The reason is that there will be more items, or could be more items in the list, as I am looking for new emails in the event for outlook. I was trying to take control over the rules - Full disclosure

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

I imagined as much - but I felt I had to ask.

Could you convert some of the strings which are not expanding into binary (use the StringToBinary function) so I can take a look and see if there is anything peculiar about them? Feel free to PM them if you would rather not post in open forum.

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

I am still in the testing phase, so there is nothing but random chars...I have included one here - not random. ASCII text is - Test 100 this is only a test subject line to be used for seeing why listview will not show the whole line test 100

I get to about the L in only, so about 20 chars or so

0x54657374203130302074686973206973206F6E6C7920612074657374207375626A656374206C696E6520746F206265207573656420666F7220736565696E6720776879206C697374766965772077696C6C206E6F742073686F77207468652077686F6C65206C696E65207465737420313030

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

It works just fine for me in my test script:

#include <GUIConstantsEx.au3>
#include <GUIListView.au3>

$sString = BinaryToString("0x54657374203130302074686973206973206F6E6C7920612074657374207375626A656374206C696E6520746F206265207573656420666F7220736565696E6720776879206C697374766965772077696C6C206E6F742073686F77207468652077686F6C65206C696E65207465737420313030")
ConsoleWrite($sString & @CRLF)

$hGUI = GUICreate("Test", 1000, 500)

$cListView = GUICtrlCreateListView("Expander|Total width", 10, 10, 900, 400)
;GUICtrlSetFont($cListView, Default, Default, Default, "Consolas") ; Monospaced font

$cAdd = GUICtrlCreateButton("Add Item", 10, 450, 80, 30)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAdd

            GUICtrlCreateListViewItem($sString, $cListView)
            _GUICtrlListView_SetColumnWidth($cListView, 0, $LVSCW_AUTOSIZE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch

WEnd

Now off to see if I can get it to work in your code.

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

nitekram,

You do realise in your code that the GUI is sized to "width of the subject + 400"? That means that the GUI and ListView are too narrow to display the expanded column and that would explain what you are seeing.  So, you need to resize the GUI and ListView as you resize the column - like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

#include "StringSize.au3"

$sSenderName = "Test 100 this is only a test subject line to be used for seeing why listview will not show the whole line test 100"
$sSubject = "Subject which is also of variable size"
$aWidthSender = _StringSize($sSenderName, Default, Default, Default, "Consolas")
$aWidthSubject = _StringSize($sSubject, Default, Default, Default, "Consolas")

Local $hGUI = GUICreate('New Outlook Email Alert', ($aWidthSubject[2] + 400), 220, -1, -1, $WS_SIZEBOX, $WS_EX_TOPMOST) ;
Local $idAdd = GUICtrlCreateButton("Add", 110, 160, 85, 25)

GUISetState(@SW_SHOW, $hGUI)
Sleep(500)

Local $idListview = GUICtrlCreateListView("From|Subject", 10, 10, ($aWidthSubject[2] + 380), 110)
;GUICtrlSetFont($idListview, Default, Default, Default, "Consolas") ; Monospaced font

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idAdd

            ; Add Item
            GUICtrlCreateListViewItem($sSenderName & '|' & $sSubject, $idListview)
            ; Resize columns
            _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE)
            _GUICtrlListView_SetColumnWidth($idListview, 1, $LVSCW_AUTOSIZE)
            ; Now get combined widths of columns
            $iMaxWidth = 0
            For $i = 0 To 1
                $iMaxWidth += _GUICtrlListView_GetColumnWidth($idListview, $i)
            Next
            ; Now resize the GUI and ListView to fit
            WinMove($hGUI, "", Default, Default, $iMaxWidth + 40) ; Just a quick approx - we can refine this
            ControlMove($hGUI, "", $idListview, 10, 10, $iMaxWidth + 25)
    EndSwitch
WEnd

Do you get the full line now?

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

Yes, and now I feel stupid for wasting your time, as I did not know that you could use different columns (_GUICtrlListView_SetColumnWidth)? I went with what the help file stated - "0-based index of a valid column. For list-view mode, this parameter must be set to zero". And in my attempt to get them expanded, I believe I set it to list view in the beginning and never changed anything for this function call.

 

Sorry and thanks for your help.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

Delighted we got there in the end.

For list-view mode, this parameter must be set to zero

No idea what that means - I shall investigate and amend the help file accordingly. Thanks for pointing it out.

M23

Edit: It should read "List" mode - as opposed to LargeIcon, SmallIcon & Report (what you are using) - it will be suitably amended.

Edit 2: And done.

Edited by Melba23

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

Thanks again for your help and update.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

My pleasure as always.

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