[Datagrid] How to manage the empty area outside the selectable lines?

zryip theSlug zryip.theslug at gmail.com
Sat Apr 24 19:43:33 EDT 2010


2010/4/25 zryip theSlug <zryip.theslug at gmail.com>:

> About this, by testing this solution, I seen an odd behavior with
> inactive horizontal scrollbars. When you click on the scrollbar and
> have lines in the datagrid, you select the corresponding line. Is it
> totally normal?

Hum... vertical scroll bar, not horizontal.

So if I correct myself:

About this, by testing this solution, I seen an odd behavior with
inactive vertical scrollbars. When you click on the scrollbar and
have lines in the datagrid, you select the corresponding line. Is it
totally normal?


And here is my solution in case it could be useful to someone:

on mouseDoubleUp
   If ((the dgHeader of the target is empty) and \
    (the short name of the mouseControl is not "dgCornerPiece") \
    and isNotInScrollBar())  then
      dg_AddNewLine long id of me,"last",true --C
      put the dgNumberOfLines of me into tCurrentRow
      set the dgHilitedLines of me to tCurrentRow
      dispatch "EditCell" to me with line 2 of the cColumnNames of me,\
        tCurrentRow
   end if
end mouseDoubleUp

function isNotInScrollBar
   put the long id of scrollbar "dgHScrollbar" of me\
     into tHScrollBarRef
   put the long id of scrollbar "dgScrollBar" of me\
     into tVScrollBarRef

   return (the mouseLoc is not within the rect of tHScrollBarRef)\
      and (the mouseLoc is not within the rect of tVScrollBarRef)
end isNotInScrollBar


A little tricky, maybe it exists better, but it doing the job ;)

-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the Use-livecode mailing list