09-15-2009 10:19 AM
Hello
I've got an application whith two tables. The content (rows) can varry a lot in both of them.
It would be practical if the user could size the height of them by dragging the mouse.
Regards Per
09-15-2009 11:12 AM
This is something I have done in the past, using code similar to:
case EVENT_LEFT_CLICK: // This is in the control callback
do { // Do it continuously
GetRelativeMouseState (panel, 0, &x, &y, &down, 0, 0); // Get mouse position
... // Use x & y to draw/size the control
// SetCtrlAttribute () with ATTR_HEIGHT, for example
// You might not need to change its width - depends on your app
// You probably want to constrain the xy values
}
ProcessDrawEvents (); // Ensure the control is actually drawn
} while (down); // Mouse release gives "commit" event
JR
09-15-2009 12:10 PM - edited 09-15-2009 12:11 PM
Per:
If you want to allow users to resize the row height, you need to set the size mode for all rows to USE EXPLICIT SIZE, and then enable row resizing for the table.
SetTableRowAttribute (mainPanelHandle, PANEL_TABLE, -1, ATTR_SIZE_MODE, VAL_USE_EXPLICIT_SIZE);
SetCtrlAttribute (mainPanelHandle, PANEL_TABLE, ATTR_ENABLE_ROW_SIZING, 1);
Then the user will be able to resize a row by dragging the border of the row.
09-15-2009 12:41 PM - edited 09-15-2009 12:42 PM
Hey Per -
I have one more suggestion to add to the list. You may consider using splitter controls and attaching them to your tables. Take a look at the sample code attached.
NickB
National Instruments
09-16-2009 08:23 AM
Hello
I might not express clearly what I wanted to do.
What I want is to resize the table, eg. the number of rows, by draging the mouse
I tried to set the attributs as you proposed but I couldent see any effect, neither on individual rows.
09-16-2009 10:11 AM
This code worked well for me:
case EVENT_LEFT_CLICK: // This is in the table callback
do {
GetRelativeMouseState (panel, control, 0, &y, &down, 0, 0);
SetCtrlAttribute (panel, control, ATTR_HEIGHT, y);
ProcessDrawEvents ();
} while (down);
JR