Hi Brian,

 

1)       Selection will contain -1 when there are no selections, I believe
(this is from memory and from 1.02/1.03 so, check)

2)       With all those mentions of fleece, are writing financial software?

3)       ItemClick indeed would likely be the better choice over this

4)       In the Loft, specify that the list is a single selection list, as
it appears our code seems to be entirely single selection.

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Brian Rowlands (Greymouth High School)
Sent: Wednesday, September 19, 2007 4:58 AM
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Listview mental block

 

Hi all 
Enjoy reading all the help emails generated by this group so thought I'd ask
for some help please with listview. 

I've used TheLoft to create a gui interface for a program I'm writing. A
button I click is meant to read a selected line from a listview pane and
display the results in a selection of tf / cb controls:

    # determine which rows have been selected 
    my @selection = $win-> lvwFleece-> SelectedItems(); 
    
    my $size    = @selection;   # determine how many rows have been selected

    my %temp;                        # hash for reading listview data 
    my $field;                           # field name to match column
heading 

    if ((@selection) and ($size == 1)) { 
        # display the one row selected 
        foreach my $c (0..$max_fleece-1) { 
            %temp = $win-> lvwFleece-> GetItem($selection[0],$c); 
            $field = $fleece_fields[$c]; 
            $win-> $field-> Text("$temp{-text}"); 
        } 
    } 

The code works and produces the required output but I have some queries that
puzzle me. 

1. @selection contains the index values of the rows selected. However, if no
rows are selected I was expecting it to be return a () array but printing
its size in such a case shows a value of 1. Why would that be?

2. I really need some better way to determine if the listview has been
clicked. The event ItemClick(ITEM) in the package description for listview
looks as though it could be a better option for me. Can someone kindly help
me to construct the line to determine if the listview has had a line
selected please? I'm still learning perl and I'm puzzled how to do this
simple task.

Thanks 
Brian Rowlands 
We must accept finite disappointment, but we must never lose infinite hope.
 <file:///\\quotes\k\martinlutherking\> Martin Luther King Jr.

 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to