1. list box question

How do I find the number of lines available in a list box?

new topic     » topic index » view message » categorize

2. Re: list box question

George Walters wrote:
> 
> 
> How do I find the number of lines available in a list box?

Assuming you are using win32lib, go to the documentation and look under
List Control. There you will see a function called getCount(). That function
returns the number of lines currently in a list box.

If you are asking what is tha maximum number of lines you can enter, then
I think its around 64000. To double check this go the the 
http://microsoft.msdn.com site and look up the list control details there.

-- 
Derek Parnell
Melbourne, Australia

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

3. Re: list box question

It's neither Derek, I would like to know how many lines fit in the list box
space presented on the screen. Is there a function to return that bit of info?.

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

4. Re: list box question

George Walters wrote:
> 
> It's neither Derek, I would like to know how many lines fit in the list box
> space presented on the screen. Is there a function to return that bit of
> info?.
> 

George:

   I think the only way you could do this is
to determine the size of your listbox in pixels
and then divide that by the height of the font to
get the number of list entries showing. You
would have to recalculate each time the user resizes
the list control.

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.ew

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

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

5. Re: list box question

George Walters wrote:
> 
> It's neither Derek, I would like to know how many lines fit in the list box
> space presented on the screen. Is there a function to return that bit of
> info?.
> 
George,

Here's how I do what you're looking for:

cpp = sendMessage(ResultsLV, LVM_GETCOUNTPERPAGE, 0, 0)

and Bernie is right, you'll need to call this routine any time you want to
work with the number of visible elements if the window can be resized.

Jonas Temple
http://www.yhti.net/~jktemple

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

6. Re: list box question

Thanks for the help but that didn't work. I got "ResultsLV" not found. Must be
something in 60.x and
I'm using 59.1... This is what I'm using(completely imperical) that is usually
close.
	tmp = getExtent(idList)
	nbrLines = int(tmp[2]/(fontHeight+1) - 1)

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

7. Re: list box question

George Walters wrote:
> 
> Thanks for the help but that didn't work. I got "ResultsLV" not found. Must be
> something
> in 60.x and
> I'm using 59.1... This is what I'm using(completely imperical) that is usually
> close.
> 	tmp = getExtent(idList)
> 	nbrLines = int(tmp[2]/(fontHeight+1) - 1)
> 

If you cant use that this >should< be universal...

1) get the client rectangle
2) use upper left point with sendMessage [LB_ITEMFROMPOINT] for 1st line#
3) use bottom right point with sendMessage [LB_ITEMFROMPOINT] for 2nd line#
4) subtract 1st line# from second line# and add 1 for total

Sorry, would give a complete code snip or function but I dont have the
time right now... :/


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu