Hi,

I recently joined this mailing list and have enjoyed, and learned a lot, from 
the 
various posting.  I've also been browsing the older posts on SourceForge and 
found 
those equally helpful.  Unfortunately, I'm still struggling with bits and 
pieces and 
agree with the statement others have made that the documentation is lacking.  
That 
being said I have a few questions.

1) Can you lock the columns in a ListView so you can't drag the headers to 
resize?  
I can see the value in resizing a column on the fly, but for whatever reason 
resizing 
screws up the layout sometimes and I would prefer to just lock it down.

2) Has anyone attempted an application that was "skinable" similar to WinAmp? 
Not 
sure of the BitMap stuff would make this possible.

3) Dumb question but the I have to ask...The latest version of Win32::GUI is 
1.0 
therefore if I have installed that version I should see Win32-GUI [1.0] when I 
query 
my installed package...right?

Finally, in the spirit of giving back to the group, here is a little sub 
routine I use to 
insert list items into a list view.  

My first Win32 app was created mostly from example/sample code.  Whenever I 
needed something different I often just screwed around with the code till I 
figured 
how to do what I needed.  In the case of inserting items into a ListView I 
found 
myself rewriting the same sub procedure and giving it a different name.  After 
creating about 5 of nearly the same thing I woke up and said "there has to be a 
better way."  What I came up with was a way, at least for my app, to use one 
sub to 
insert content into different size ListViews.  Here is the sub procedure:

sub InsertListItem {
# Sub-procedure that inserts results into the list table
# Takes an array that starts with List View Name followed by data for each 
Column
    my @InsertItems = @_;
    my $ListViewName = shift(@InsertItems);
    $Window->$ListViewName->Clear();
    my $FirstItem = shift(@InsertItems);
    my $item = $Window->$ListViewName->InsertItem(
        -item  => $Window->$ListViewName->Count(),
        -text  => $FirstItem,
    );
    $i=1;
    foreach(@InsertItems){
         $Window->$ListViewName->SetItem(-item=>$item,-subitem=>$i,-text=>$_);
         $i++;
    }
    $Window->$ListViewName->View(1);
}

Basically, the sub takes an array where the first item is the name of the 
ListView.  
The first item is shifted off the array which leaves the content that needs to 
be 
inserted into the ListView.  I clear the contents of the ListView because I'm 
refreshing data rather than adding to it.  If, however, you're adding to 
existing data, 
then just remove $Window->$ListViewName->Clear().  Next, I handle the first 
insertion item on its own by shifting if off the array mostly because this is 
what I 
picked up in other examples; however, I'm not sure why this first item is 
handled 
differently.  After that I just loop through the remaining items and increment 
the $i 
so the data is placed in the right subitem and then I set View to 1.  Now 
instead of 5 
different subs doing nearly the same thing, I've got one that can insert data 
into 
ListViews of varying sizes.  Hope someone else finds this useful.


Reply via email to