1. ListView Question

What's the difference between,
   
ok=sendMessage( ListView1, LVM_SETCOLUMNWIDTH, 1,124)

and

setColumn(ListView1,1 124 )

Don Cole 
SF

new topic     » topic index » view message » categorize

2. ListView Question

Hello everybody,

   I have 2 small questions here.

if I go:

for x=1 to 10 do
 VOID &=addLVItem(LV,0,sprintf("%d",x))
end for

I get in Listview column 1:

10
9
8
7
6
5
4
3
2
1

1.) Is there a way to reverse the order (1 at the top; 10 at the bottom) without
having to hit the headings tab?

2.) Is there a way to put just the number in without using sprintf?

 VOID &=addLVItem(LV,0,x))?
 
TIA

Don Cole

new topic     » goto parent     » topic index » view message » categorize

3. Re: ListView Question

don cole wrote:
> 
> if I go:
> 
> for x=1 to 10 do
>  VOID &=addLVItem(LV,0,sprintf("%d",x))
> end for
> 
> 1.) Is there a way to reverse the order (1 at the top; 10 at the bottom)
> without
> having to hit the headings tab?

for x=10 to 1 by -1 do

> 2.) Is there a way to put just the number in without using sprintf?
> 
>  VOID &=addLVItem(LV,0,x))?

probably not.

new topic     » goto parent     » topic index » view message » categorize

4. Re: ListView Question

c.k.lester wrote:
> 
> don cole wrote:
> > 
> > if I go:
> > 
> > for x=1 to 10 do
> >  VOID &=addLVItem(LV,0,sprintf("%d",x))
> > end for
> > 
> > 1.) Is there a way to reverse the order (1 at the top; 10 at the bottom)
> > without
> > having to hit the headings tab?
> 
> for x=10 to 1 by -1 do
> 
> > 2.) Is there a way to put just the number in without using sprintf?
> > 
> >  VOID &=addLVItem(LV,0,x))?
> 
> probably not.

  Thank you c.k.lester,

 1.) I thought of that but thought I might mess other things up. I suppose not.

 2.) addLVItem must use text (I guess).

 Thanks,

Don Cole

new topic     » goto parent     » topic index » view message » categorize

5. Re: ListView Question

don cole wrote:
> 
> Hello everybody,
> 
>    I have 2 small questions here.
> 
> if I go:
> 
> for x=1 to 10 do
>  VOID &=addLVItem(LV,0,sprintf("%d",x))
> end for
> 
> I get in Listview column 1:
> 
> 10
> 9
> 8
> 7
> 6
> 5
> 4
> 3
> 2
> 1
> 
> 1.) Is there a way to reverse the order (1 at the top; 10 at the bottom)
> without
> having to hit the headings tab?
> 

 From Win32lib docs:
[func]
setLVInsert (integer pFlag )
Sets the default position for ListView inserts.
Returns: The flag setting before this change.
Category: ListView Control


If pFLag is zero, addLVItem() adds new items to the top of the list, else new
items are added at the end. The default is to add items to the top of lists.

Example: 

     integer lvInsert
     -- Make listviews add to end of lists.
     lvInsert = setLVInsert( 1 )

> 2.) Is there a way to put just the number in without using sprintf?
> 
>  VOID &=addLVItem(LV,0,x))?
>  
> TIA
> 
> Don Cole

new topic     » goto parent     » topic index » view message » categorize

6. Re: ListView Question

don cole wrote:
> 1.) Is there a way to reverse the order (1 at the top; 10 at the bottom)
> without
> having to hit the headings tab?

Yes. There are two ways. The first is to call ...

    atom OldVal
    OldVal = setLVInsert(1)

Then from now on, all addLVItem calls will add to the end of the list.

The second is to call addLVItem like this ...

    VOID &= adLVItem( {LV, -1}, 0, x)

The -1 here means add to end of list. You can have other positive numbers here
to add at other positions too.

> 2.) Is there a way to put just the number in without using sprintf?
> 
>  VOID &=addLVItem(LV,0,x))?

There is a bug in the code. It is meant to be able to do this but the signature
is wrong.

> Replace ...
  global function addLVItem(object id, atom iIcon, sequence text )
> With ...
  global function addLVItem(object id, atom iIcon, object text )

And then you can say things like 

  for x = 1 to 10 do
    VOID &= addLVItem({LV,-1},0,x))
  end for
  

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

7. Re: ListView Question

Thanks Judith and Derek,

  That's exactly what I was looking for on both counts.

Both meaning, Judith and Dereck.

And both meaning, Derek's explination of two different problems.

Just one more question. In my code I only have one listView and Judith's code 
works perfectly on that.  But supposen' I had multiple listViews how would

 lvInsert = setLVInsert( 1 )

know which listView to apply itself to?




Don Cole

new topic     » goto parent     » topic index » view message » categorize

8. Re: ListView Question

don cole wrote:
> In my code I only have one listView.  But supposen' I had multiple listViews
> how would
>  
> 
>  lvInsert = setLVInsert( 1 )
> 
> know which listView to apply itself to?

It has a global effect. It effects all listviews. That is why you can use the
syntax

  addLVItem( { lv, -1}, ... )

Also, one could code ...

  -- Set effect on
  temp = setLVInsert( 1 )
  addLVItem ( ... )
  -- Revert to previous setting.
  temp = setLVInsert( temp )


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

9. Re: ListView Question

Derek Parnell wrote:
> 
> don cole wrote:
> > In my code I only have one listView.  But supposen' I had multiple listViews
> > how
> would</font></i>
> >  
> > 
> >  lvInsert = setLVInsert( 1 )
> > 
> > know which listView to apply itself to?
> 
> It has a global effect. It effects all listviews. That is why you can use the
> syntax 
> 
>   addLVItem( { lv, -1}, ... )
> 
> Also, one could code ...
> 
>   -- Set effect on
>   temp = setLVInsert( 1 )
>   addLVItem ( ... )
>   -- Revert to previous setting.
>   temp = setLVInsert( temp )
> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

In the various mods I made and submitted to Derek, setLVinsert() can act
 locally (ie each ListView has its own flag, and you can act on either the
 local or global one). Perhaps this will make it to the next official lib.

CChris

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu