DataGrid question...
Bob Sneidar
bobsneidar at iotecdigital.com
Wed Apr 1 14:15:20 EDT 2020
Hi all.
I’m not sure I understand the nature of the problem anymore as the thread is so long, but if you are using the data grid, it is very easy to get the actual index and column number of a cell that has been clicked on. If you put this into your data grid script, you can see it at work.
If you don’t want the column headers to show just set the dgprop [“show Header”] to false. You will need the header to control column widths though. The dividers are actual lines, so I suspect in a mouseDown handler you can detect that and handle accordingly.
on mouseUp
put the mouseControl into tControl
put word 1 of the name of tControl into tType
if tType is "field" then — otherwise anything goes
put getRowAndColumn(tControl) into tRowAndColumn
end if
pass mouseUp
end mouseUp
function getRowAndColumn pControl
put the short name of pControl into tName
put word 1 of tName into tColumName
put 0 + word 2 of tName into tRow
put the dgProp ["columns"] of me into tColumns
put lineOffset(tColumName, tColumns) into tColumnNum
/* Workaround for failure of dgIndexOfLine
put the dgIndexOfLine [tRow] of me into tIndex
*/
put the dgHilitedIndex of me into tIndex
return tIndex,tColumnNum
end getRowAndColumn
More information about the use-livecode
mailing list