Getting WIDGET_TABLE Number of rows and columns [message #88903] |
Wed, 02 July 2014 10:33  |
Ken G
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
Is there a direct way to ask a WIDGET_TABLE the number of rows and columns it currently has?
I wish WIDGET_TABLE was more forgiving about SET_VALUE and such, but if you exceed the size of the table, IDL throws an error, so it pays to know the size (and set the size) of the table properly before using SET_VALUE to set the contents.
So far, all I've been able to think up is this kludge.
Ncols = N_ELEMENTS( WIDGET_INFO(tableID, /COLUMN_WIDTHS) )
Nrows = N_ELEMENTS( WIDGET_INFO(tableID, /ROW_HEIGHTS) )
Essentially we ask for an array of widths and heights, and then infer the table dimensions from the number of elements in each array.
Thanks!
|
|
|
Re: Getting WIDGET_TABLE Number of rows and columns [message #88919 is a reply to message #88903] |
Thu, 03 July 2014 09:51  |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
On Wednesday, July 2, 2014 7:33:47 PM UTC+2, Ken G wrote:
> Is there a direct way to ask a WIDGET_TABLE the number of rows and columns it currently has?
>
>
>
> I wish WIDGET_TABLE was more forgiving about SET_VALUE and such, but if you exceed the size of the table, IDL throws an error, so it pays to know the size (and set the size) of the table properly before using SET_VALUE to set the contents.
>
> So far, all I've been able to think up is this kludge.
>
>
>
> Ncols = N_ELEMENTS( WIDGET_INFO(tableID, /COLUMN_WIDTHS) )
>
> Nrows = N_ELEMENTS( WIDGET_INFO(tableID, /ROW_HEIGHTS) )
>
>
>
> Essentially we ask for an array of widths and heights, and then infer the table dimensions from the number of elements in each array.
>
>
>
> Thanks!
What about:
Widget_CONTROL, tableID, GET_VALUE=table
dims = Size(table, /DIM)
alx.
|
|
|