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
Datagrid question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Datagrid question
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.
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.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: Datagrid question
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
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
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Datagrid question
I often use a contextual menu myself. Here is a lesson.
How Do I Add a mouseDown Event To The Data Grid Without Breaking It?
How Do I Add a mouseDown Event To The Data Grid Without Breaking It?
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder