Page 1 of 1
Datagrid question
Posted: Thu Mar 04, 2010 6:54 pm
by phaworth
I would like to display a button next to the currently selected line in a datagrid, making it clear that clicking the button will cause an operation on the data in that line. The dgHilitedLine property tells me which line is currently selected so I guess I'm looking for a way to convert that to a vertical screen position so I know where to position the button.
Thanks,
Pete
Re: Datagrid question
Posted: Thu Mar 04, 2010 7:59 pm
by trevordevore
There is an undocumented dgRectOfIndex property (put the dgRectOfIndex[theIndex] of group "DataGrid") that you might be able to use. As long as the control is visible on screen or you have control caching turned on then a rect will be returned.
Questions though - Will the button need to move if the data grid is scrolled? If so then you might consider putting the button in the actual row itself.
Re: Datagrid question
Posted: Thu Mar 04, 2010 8:39 pm
by phaworth
Thanks for the info Trevor and for pointing out what I had not considered - the scrolling. I guess I had been hoping to save real estate in the datagrid by positioning the button as I mentioned rather than as a column in the datagrid.
I guess another option might be to use a double click on a line to signify the action, or even a right click over the line to bring up a popup menu if there are multiple action choices. I think I've seen discussions of both those things in the datagrid manual and on the forum.
Pete
Re: Datagrid question
Posted: Thu Mar 04, 2010 8:44 pm
by trevordevore