On 30 Mar 2012, at 18:42, Greg Ercolano wrote:
> There is the concept of a 'cursor' in the form of
> 'current_row' and 'current_col' variables, and this
> cursor can be moved around with the arrow keys.
>
> Since the app handles all cell drawing, the app has to
> handle drawing this cursor if it wants it to be visible.
>
> Thing is, I don't think any of our test programs show
> how to do that; guess I'll add it to one of the examples,
> or make a new one.
>
> Basically, in the app's draw_cell() callback, when
> CELL_CONTEXT is received (which tells the app to draw a cell),
> one can check to see if the row/col values of that cell match
> the cursor's row/col values, and if so, draw the focus_box(), eg:
>
> ---- snip
>
> // Handle drawing all cells in table
> void MyTable::draw_cell(TableContext context, int R, int C, int X, int Y, int
> W, int H) {
> [..]
> case CONTEXT_CELL: {
>
> [..cell drawing here..]
>
> if ( R == current_row && C == current_col ) // ADD THIS
> draw_focus(box(),X,Y,W,H); // ADD THIS
>
> fl_pop_clip();
> return;
> }
>
> ---- snip
>
> As a test, I just added that to the table-sort.cxx example
> and it shows the little focus box when you use the arrow keys
> to move around, and the table scrolls when the cursor moves
> off an edge, etc.
>
> In the above case, it draws the focus box around just the cell,
> but you can also draw it over the whole row if you want by
> ignoring the current_col value, and using the entire width
> of the screen instead of the X and W values.
Cool - I'm not certain, but that sounds like it might be just what the OP
wanted, so hopefully this'll be enough info to get that sorted out now!
Cheers to one and all.
Really lovely weather today here. Hope everyone has it as nice!
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk