Datagrid Column Click

Bob Sneidar bobsneidar at iotecdigital.com
Thu Dec 21 17:11:10 EST 2017


CODE CORRECTION:

on mouseDown pButtonNum
  if pButtonNum <> 3 then pass mouseDown
  put getClickedColumn(the long id of me) into tClickedColumn
end mouseDown

function getClickedColumn pDGID
  put the mouseControl into tTargetNum
  put the name of tTargetNum into tTargetName
  put the left of pDGID into tLeftMargin
  put item 1 of the mouseLoc into tMouseClick
  put (tMouseClick) - tLeftMargin into tColumnClick
  put the dgProp ["column widths"] of pDGID into tColumnRightEdges
  put the dgHscroll of pDGID into tHscroll
  subtract tHscroll from item 1 of tColumnRightEdges

  -- shift all column rights left by hscroll
  repeat with i = 1 to the number of items of tColumnRightEdges
     add item i-1 of tColumnRightEdges to item i of tColumnRightEdges
  end repeat

  -- find which column the mouse was clicked in
  repeat with i = 1 to the number of items of tColumnRightEdges
     if item i of tColumnRightEdges > tColumnClick then exit repeat
  end repeat

  put the dgProp ["columns"] of pDGID into tColumnNames
  put line i of tColumnNames into tClickedColumn
  return tClickedColumn
end getClickedColumn

Bob S


On Dec 21, 2017, at 11:26 , Mark Waddingham via use-livecode <use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>> wrote:

File an enhancement request and I'll make sure Michael sees it - he's had his head buried in the DG for a while so he might be able to suggest a way to do it right now. It sounds like a useful thing to be able to do.

Warmest Regards,

Mark

Sent from my iPhone

On 21 Dec 2017, at 18:50, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>> wrote:

Hi all.

I have a need to right-click on a datagrid column and get the name of the column, whether or not there is any data in it. I know this is not currently possible, as:

put the mouseControl into tTargetNum
put the name of tTargetNum into tTargetName

will return graphic "dgAlternatingRows" if there is no data. I'm hoping to submit a feature request for the new "Super Duper Datagrid" currently in devemopment. How would I go about doing that?

Bob S
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list