Discussion:
How to Get True ListBox Column Width?
Jim Wagner
2017-02-14 21:42:25 UTC
Permalink
Greetings

I have a ListBox with a variable number of columns. The left-most has a width of 100 and all the others are “*”.

For the first few rows, when there is no vertical scroll bar, I can get the the widths of the right columns from (me.width - 100)/(me.ColumnCount-1). Close enough.

But, how do I do it when the vertical scroll bar gets added? I could subtract a constant from the width when I have some indication that the scroll bar is there, but I don’t know how to know that (scroll bar presence) at runtime.

I don’t see a width property for individual cells, though the CellBackgroundPaint event seems to know. Don’t find a width property for columns, either.

What I am trying to do is add some TextFields, below certain columns, said TextFields are to be drawn with the same width as the column that above it, so I need column sizes!

So, I could really use some help here.

Many thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>




_______________________________________________

Xojo f
Markus Winter
2017-02-14 22:01:42 UTC
Permalink
Listbox.column(2).widthActual

MfG

Markus

_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jim Wagner
2017-02-14 22:59:47 UTC
Permalink
Thanks, Markus -

I could NOT find any reference to that in the ListBox docs.
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Markus Winter
Listbox.column(2).widthActual
MfG
Markus
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Markus Winter
2017-02-15 06:36:31 UTC
Permalink
If you looked in the new dicumentation: neither could I. They are crap.

Had to look in the old dicumentation.

MfG

Markus

Sent from my iPad
Post by Jim Wagner
I could NOT find any reference to that in the ListBox docs.
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jim Wagner
2017-02-15 07:08:21 UTC
Permalink
I finally found a ListColumn class that is accessed with the ListBox.column properties. So ListBox.Column().ActualWidth is documented in the ListColumn class. Makes lots of sense!

Thanks for getting me pointed in the right direction.

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Markus Winter
If you looked in the new dicumentation: neither could I. They are crap.
Had to look in the old dicumentation.
MfG
Markus
Sent from my iPad
Post by Jim Wagner
I could NOT find any reference to that in the ListBox docs.
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/
Jim Wagner
2017-02-15 07:10:42 UTC
Permalink
In case anyone else is reading the traffic, that should be ListBox.Column().WidthActual.

Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
I finally found a ListColumn class that is accessed with the ListBox.column properties. So ListBox.Column().ActualWidth is documented in the ListColumn class. Makes lots of sense!
Thanks for getting me pointed in the right direction.
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Markus Winter
If you looked in the new dicumentation: neither could I. They are crap.
Had to look in the old dicumentation.
MfG
Markus
Sent from my iPad
Post by Jim Wagner
I could NOT find any reference to that in the ListBox docs.
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com/

emile.a.schwarz
2017-02-15 07:09:19 UTC
Permalink
Hi Jim,

 

In the Listbox entry, look below See Also, the entry before the last one of the line.

 

I too discovers that by pure hazard (or by another user reference, I forgot).

 

The adventage of this is… you can set a specific column width (as I use it), and in your case, you can get the Column(i) width !

 

Very useful.

 

This Listbox entry page is the same in docs and in developer:

 

http://docs.xojo.com/index.php/Listbox

http://docs.xojo.com/index.php/ListColumn

http://developer.xojo.com/listbox

http://developer.xojo.com/listcolumn

 
Documentation is a crap ?
Paul need one student this summer (or before) to do a whole reformat / rewrite, etc.

 

Notably in http://developer.xojo.com… When I go there, I am always asking myself if the provided page is for iOS or…

 

But it have its goog parts too: when you ask for a page, the left pane provide “contextual” links (links related to what you ask). Check by yourself:

http://developer.xojo.com/sqlitedatabase-classic

 

And you have a button to express yourself / Paul is very reactive with that button.

 

Hope this helps,

 

Emile

 
Message du 15/02/17 00:00
De : "Jim Wagner"
A : "Nug"
Objet : Re: How to Get True ListBox Column Width?
Thanks, Markus -
I could NOT find any reference to that in the ListBox docs.
James Wagner
Oregon Research Electronics
http://www.orelectronics.net
Post by Markus Winter
Listbox.column(2).widthActual
MfG
Markus
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
__________________________________________
Emile Schwarz
2017-02-14 22:12:49 UTC
Permalink
Listbox1.ColumnWidths returns a string with the current width who can have 12.15 pixels for a column as well as * for another or so…
BTW: do you know the 
ListColumn Class ?

Take a look there and you may have a solution.
De : Jim Wagner <***@comcast.net>
À : Nug <***@lists.xojo.com>
Envoyé le : Mardi 14 février 2017 22h42
Objet : How to Get True ListBox Column Width?

Greetings

I have a ListBox with a variable number of columns. The left-most has a width of 100 and all the others are “*”.

For the first few rows, when there is no vertical scroll bar, I can get the the widths of the  right columns from (me.width - 100)/(me.ColumnCount-1). Close enough.

But, how do  I do  it when the vertical scroll bar gets added? I could subtract a constant from the width when I have some indication that the scroll bar is there, but I don’t know how to know that (scroll bar presence) at runtime. 

I don’t see a width property for individual cells, though the CellBackgroundPaint event seems to know. Don’t find a width property for columns, either.

What I am trying to do is add some TextFields, below certain columns, said TextFields are to be drawn with the same width as the column that above it, so I need column sizes!

So, I could really use some help here.

Many thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>




_______________________________________________

Xojo forum:

https://forum.xojo.com/


_______________________________________________

Xojo forum:

https://fo
Loading...