Jump to content

ListView and word wrap


Recommended Posts

Hi people,

I created a listview control. Now, I want a text in more than 1 line in a single row. For example:

________________________________

________________________________

________________________________

Cast 1

Cast 2

Cast 3

________________________________

________________________________

________________________________

This following code doesn't work:

$ColumnHeadingLabelFirst="Description"
$ColumnHeadingLabelSecond="Value"
$ListViewControlMovieData=GUICtrlCreateListView($ColumnHeadingLabelFirst & Chr(124) & $ColumnHeadingLabelSecond,$ListViewControlLeftMovieData,$ListViewControlTopMovieData,$ListViewControlWidthMovieData,$ListViewControlHeightMovieData,$LVS_EX_TRACKSELECT)
$ListViewControlItem_A1=GUICtrlCreateListViewItem("Cast 1" & chr(10) & chr(13) & "Cast 2" & chr(10) & chr(13) & "Cast 3",$ListViewControlMovieData)
;$ListViewControlItem_A1=GUICtrlCreateListViewItem("Cast 1",$ListViewControlMovieData)
;$ListViewControlItem_A2=GUICtrlCreateListViewItem("Cast 2",$ListViewControlMovieData)
;$ListViewControlItem_A3=GUICtrlCreateListViewItem("Cast 3",$ListViewControlMovieData)

Any ideas?

Please help me.

Link to comment
Share on other sites

Hi people,

I created a listview control. Now, I want a text in more than 1 line in a single row. For example:

________________________________

________________________________

________________________________

Cast 1

Cast 2

Cast 3

________________________________

________________________________

________________________________

This following code doesn't work:

$ColumnHeadingLabelFirst="Description"
$ColumnHeadingLabelSecond="Value"
$ListViewControlMovieData=GUICtrlCreateListView($ColumnHeadingLabelFirst & Chr(124) & $ColumnHeadingLabelSecond,$ListViewControlLeftMovieData,$ListViewControlTopMovieData,$ListViewControlWidthMovieData,$ListViewControlHeightMovieData,$LVS_EX_TRACKSELECT)
$ListViewControlItem_A1=GUICtrlCreateListViewItem("Cast 1" & chr(10) & chr(13) & "Cast 2" & chr(10) & chr(13) & "Cast 3",$ListViewControlMovieData)
;$ListViewControlItem_A1=GUICtrlCreateListViewItem("Cast 1",$ListViewControlMovieData)
;$ListViewControlItem_A2=GUICtrlCreateListViewItem("Cast 2",$ListViewControlMovieData)
;$ListViewControlItem_A3=GUICtrlCreateListViewItem("Cast 3",$ListViewControlMovieData)

Any ideas?

Please help me.

I'd be surprised if that were possible; I think one item in a list view is one line. You could make several items represent the lines, and then ensure that if one of the items which make up the group of lines is selected then all the other items in the same group also become selected.

I assume that you want to be able to select one item in the list view but to have more than one line of information. Maybe something like the code below, but I might not have understood what you want.

#include <GUIConstants.au3>
#include <guilistview.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 413, 298, 303, 219)
$ListView1 = GUICtrlCreateListView("items", 56, 48, 58, 150)
GUICtrlSendMsg(-1, 0x101E, 0, 50)
$ListView1_0 = GUICtrlCreateListViewItem("goup1", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("group2", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("group3", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("|", $ListView1)
$ListView1_5 = GUICtrlCreateListViewItem("", $ListView1)
$ListView1_6 = GUICtrlCreateListViewItem("", $ListView1)
$ListView1_7 = GUICtrlCreateListViewItem("", $ListView1)
$Edit1 = GUICtrlCreateEdit("", 128, 77, 137, 105)
;GUICtrlSetData(-1, "Edit1")
$Label1 = GUICtrlCreateLabel("Details for selected item", 136, 56, 116, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$selItem = -1
Dim $Grouptext[3]
$GroupText[0] = 'line 1' & @CRLF & 'line 2' & @CRLF & 'line3'
$GroupText[1] = 'Once' & @CRLF & 'upon a' & @CRLF& 'time..'
$GroupText[2] = 'just this'

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
    
    $nowsel = _GUICtrlListViewGetCurSel($ListView1)
    If $nowsel <> $selItem Then
     GUICtrlSetData($Edit1,$GroupText[$nowsel])
     $selItem = $nowsel  
    EndIf

    
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi Martin,

Your example is good, but I want see all informations at a glance, not by selecting an item.

Do you understand me? Sorry, my english is not so good.

Thank you for your help.

I understand you, you English seems very good.

Not sure about a suggestion so I think it would help if you could explain a bit more about what you need to do and how the information is to be displayed. Does it have to be in a listview?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

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