cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
djhanson
Level V

Tablebox() - how to set focus to specific row?

Hi, lets say I have a Tablebox() with many rows.  (e.g. 1000 rows)  In this case it does an automatic vertical scroll bar.  (good as there are many rows)  But how to set focus to say the n=685th row as focus?  Is there a specific command or method?  In this way, by focus, I mean a command that will automatically scroll the vertical scroll bar to the n=685th row.  (so that a user doesn't have to manually scroll down via the vertical scroll bar)

 

thanks, DJ

1 ACCEPTED SOLUTION

Accepted Solutions
djhanson
Level V

Re: Tablebox() - how to set focus to specific row?

Ok, I figured out a solution!  This will set the focus of a specific row within a tablebox().  Basically, you just need to disable the standard scrolling associated with a tablebox(), then wrap that tablebox within a scrollbox().  Here's roughly how it's done:

 

 

//r10 is a report of a data table called dt10

//wrap the report tablebox in a scrollbox
sb10 = Scroll Box( size( 700, 400 ), r10 );

//disable the scrolling of the report tablebox
r10[Table Box( 1 )] << set selectable rows();
r10[Table Box( 1 )] << set scrollable( 0, 0 );

//find max hor and vert pixel range of scrollbox sb10
sb10max = sb10 << get scroll extents;

//now reference the vertical component of sb10max
//make a buttonbox and you can find key rows in tablebox
//and find their ratio of where they occur as row indices to nrows(dt10)
//then multiply them by sb10max and this will force the
//tablebox to scroll by the action of the buttonbox! woo-hoo!

 

View solution in original post

3 REPLIES 3
djhanson
Level V

Re: Tablebox() - how to set focus to specific row?

I might add, in a Scrollbox() there is a <<set scroll position command.  But with a Tablebox() it seems to automatically make a vertical scroll box I think. (if many rows)  Can this <<set scroll position work with Tablebox() perhaps?

txnelson
Super User

Re: Tablebox() - how to set focus to specific row?

No such message exists in the Table Box() object.  I too wish that it has that capability

Jim
djhanson
Level V

Re: Tablebox() - how to set focus to specific row?

Ok, I figured out a solution!  This will set the focus of a specific row within a tablebox().  Basically, you just need to disable the standard scrolling associated with a tablebox(), then wrap that tablebox within a scrollbox().  Here's roughly how it's done:

 

 

//r10 is a report of a data table called dt10

//wrap the report tablebox in a scrollbox
sb10 = Scroll Box( size( 700, 400 ), r10 );

//disable the scrolling of the report tablebox
r10[Table Box( 1 )] << set selectable rows();
r10[Table Box( 1 )] << set scrollable( 0, 0 );

//find max hor and vert pixel range of scrollbox sb10
sb10max = sb10 << get scroll extents;

//now reference the vertical component of sb10max
//make a buttonbox and you can find key rows in tablebox
//and find their ratio of where they occur as row indices to nrows(dt10)
//then multiply them by sb10max and this will force the
//tablebox to scroll by the action of the buttonbox! woo-hoo!