Jump to content
Sign in to follow this  
randallc

GUIListView limitations

Recommended Posts

randallc

Hi,

I have 2 problems with the list view at the moment, and I can post code if it is not already known?...

1. After Insert column, a full item will not be accepted by the listview.

2. Insert item only seems to work for subitems, not full items.

As I say, if these are not known behaviour or not clear, I can post examples from help file.

Best, Randall :D

Share this post


Link to post
Share on other sites
GaryFrost

Hi,

I have 2 problems with the list view at the moment, and I can post code if it is not already known?...

1. After Insert column, a full item will not be accepted by the listview.

2. Insert item only seems to work for subitems, not full items.

As I say, if these are not known behaviour or not clear, I can post examples from help file.

Best, Randall :D

Examples of what your talking about would be helpfull.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
randallc

OK,

Here is the column one first; I have modified the helpfile example to add 2 rows after each insert; but there is a fail error with the second one each time

Randallc

Edited by randallc

Share this post


Link to post
Share on other sites
GaryFrost

If you use the InsertColumn autoit still only reconizes the original # of columns

you'll have to either do an new item with the origianl # of columns then set the last column to the data or

#include <GuiConstants.au3>
#include <GuiListView.au3>

opt('MustDeclareVars', 1)
Dim $listview, $Btn_InsertCol, $Btn_Exit, $msg, $Input_col, $Status
GUICreate("ListView Insert Column", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
GUICtrlCreateLabel("Enter Column # to Insert:", 90, 190, 130, 20)
$Input_col = GUICtrlCreateInput("", 220, 190, 80, 20, $ES_NUMBER)
GUICtrlSetLimit($Input_col, 1)
$Btn_InsertCol = GUICtrlCreateButton("Insert Column", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember columns are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
         ExitLoop
      Case $msg = $Btn_InsertCol
         If (StringLen(GUICtrlRead($Input_col)) > 0) Then
            If (_GUICtrlListViewInsertColumn ($listview, Int(GUICtrlRead($Input_col)), "test", 0, 40)) Then
               GUICtrlSetData($Status, 'Insert column: ' & GUICtrlRead($Input_col) & ' Successful')
            Else
               GUICtrlSetData($Status, 'Failed to Insert column : ' & GUICtrlRead($Input_col))
            EndIf
            If (_GUICtrlListViewInsertItem($listview,-1,"lineINS|dataINS|moreINS") <> $LV_ERR) Then
               GUICtrlSetData($Status, 'Add row: ' & GUICtrlRead($Input_col) & ' Successful')
            Else
               GUICtrlSetData($Status, 'Failed to Insert  row: ' & GUICtrlRead($Input_col))
            EndIf
            If (_GUICtrlListViewInsertItem($listview,-1,"lineINS|dataINS|moreINS|more2INS") <> $LV_ERR) Then
               GUICtrlSetData($Status, 'Add row: ' & GUICtrlRead($Input_col) & ' Successful')
            Else
               GUICtrlSetData($Status, 'Failed to Insert  row: ' & GUICtrlRead($Input_col))
            EndIf
         Else
            GUICtrlSetData($Status, 'Must enter a column to insert')
         EndIf
   EndSelect
WEnd
Exit
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
randallc

Hi,

I have 2 problems with the list view at the moment, and I can post code if it is not already known?...

1. After Insert column, a full item will not be accepted by the listview.

2. Insert item only seems to work for subitems, not full items.

As I say, if these are not known behaviour or not clear, I can post examples from help file.

Best, Randall :D

1. After Insert column, a full item will not be accepted by the listview.

So can this be included in the helpfile; "GUICreateListViewItem" does not wortk, and the work-around?

2. Insert item only seems to work for subitems, not full items.

Did you see the example I gave as requested on this thread Gary?

Best, Randallc

Edited by randallc

Share this post


Link to post
Share on other sites
Zedna

Here is the item text;

Perhaps I have the syntax wrong?...

[The helpfile example only sets the text for first column, not whole row..]

Randall

I din't look deep into but do you know difference between GUICtrlSetData and _GUICtrlListViewSetItemText? Edited by Zedna

Share this post


Link to post
Share on other sites
Zedna

No I don't; do you?

Randallc

Yes I do.

By GUICtrlSetData you can set text for whole row

and by _GUICtrlListViewSetItemText you can set text only for particular column in row.

for GUICtrlSetData you need remember item_id (returned from GUICtrlCreateListViewItem)

For set text to whole row by _GUICtrlListViewSetItemText you need to parse your text by StringSplit

and call _GUICtrlListViewSetItemText for every column (from that array returned by StringSplit)

That's all.

Edited by Zedna

Share this post


Link to post
Share on other sites
randallc

Hi,

If that is so..

and it appears to be, then the helpfile is misleading?

_GUICtrlListViewSetItemText

--------------------------------------------------------------------------------

Changes the text of a list-view item or subitem.

So it says you can "Change the text of a list-view item ", not only individual subitems one at a time?..

Best, Randall

Share this post


Link to post
Share on other sites
GaryFrost

Hi,

If that is so..

and it appears to be, then the helpfile is misleading?

So it says you can "Change the text of a list-view item ", not only individual subitems one at a time?..

Best, Randall

item = col 0, subitems = col > 0


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
Zedna

Hi,

If that is so..

and it appears to be, then the helpfile is misleading?

So it says you can "Change the text of a list-view item ", not only individual subitems one at a time?..

Best, Randall

Term ListView item means first column, that's terminology is correct by me.

listview item row = listview item (first column) + listview subitems (second and above columns)

EDIT: gafrost was quicker :D

Edited by Zedna

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.