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

zryip theSlug zryip.theslug at gmail.com
Sat Apr 24 18:31:07 EDT 2010

Hi all,

I'm actually working with datagrids.

First of all, I think that I have to explain my question, so:

Basically a datagrid is divide in 4 parts:
- headers
- scroll bars
- lines of data (that I call "the selectable lines")
- area with no data (that I call "the empty area outside the selectable lines")

I would like to manage this empty area. I planned to add a new line
when an user double click in it.
For doing that, I created this code in the datagrid script:

on mouseDoubleUp
   If ((the dgHeader of the target is empty) and \
     (the short name of the mouseControl is not "dgCornerPiece"))  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,\
   end if
end mouseDoubleUp

I have difficulties with the scroll bars. When they exists but are not
active (because the list is too small), they traps the double click
and performs the creation of the new line.

What is my best alternative if I assume that I have seen nothing in
the API to manage this empty area?
No doubt someone has already doing that. ;)

I have already give a try to the mouseControl function but it not
returns the scrollbar control because the datagrid bg objects rides
the scrollbar.

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?

TIA for any help! 8-)

-Zryip TheSlug- wish you the best! 8)

More information about the Use-livecode mailing list