A Few bits and pieces

zryip theSlug zryip.theslug at gmail.com
Sat Nov 27 16:32:07 EST 2010


On Sat, Nov 27, 2010 at 7:51 PM, Peter Haworth <pete at mollysrevenge.com> wrote:>

Pete,

> I'm seeing several additions/changes to datagrids in the release notes for
> 4.5/4.5.1.  Some of them are self-explanatory but there's a few that aren't
> explained in the release notes and aren't mentioned in the latest version of
> the datagrid manual.  They are:

I can't answer for the first part

>        SetDataOfIndex/Line can pass multiple keys - what's the syntax for
> this?
>        dgClickLine, dgClickIndex, dgClickedInDataView,ColumnControlOFLine -
> more info?

1) SetDataOfIndex pIndex, pKey, pValue
SetDataOfLine pLine, pKey, pValue

SetDataOfIndex and SetDataOfLine working now with several couple of
pKey and pValue at the same time. See the FindLine command in the
documentation for a similar command.

Example to set the content of a line where you have first_name and
last_name columns

SetDataOfLine 1, "first_name", "Pete", "last_name", "Haworth"

2) -> dgClickLine (read only) : returns the number of the click line
or empty if the user not clicked on a line of data
    -> dgClickIndex works same than the dgClickLine but returns the
index of the clicked line

Example with a mouseDoubleUp located in the datagrid script:

on mouseDoubleUp
   local tTheClickLine

   put the dgClickLine of me into tTheClickLine

   if (tTheClickLine is not empty) then
      answer "You have double clicked on the line" && tTheClickLine
   end if
   pass mouseDoubleUp
end mouseDoubleUp

  ->  dgClickedInDataView returns true if the user clicked in the area
where data is displayed.

Example with an improvement of a script I have already shared on the
list for managing the empty area and adding a row on a double click.
This script should be available in its more improved form, in a future
version of the DGH plugin:

on mouseDoubleUp
   DGH_AddNewLineOnDoubleClick --
end mouseDoubleUp

command DGH_AddNewLineOnDoubleClick
   ## Add a new line in the dg when user double click on an empty area in the dg

   if ((the dgClickedInDataView of me) and (the dgClickLine of me is
empty)) then
      AddData
   end if
end DGH_AddNewLineOnDoubleClick


3) ColumnControlOFLine and ColumnControlOFIndex are functions that you
can use in the datagrid messages path

ColumnControlOFLine pColumn, pLine returns the long id of the control
for the line pLine and the column pColumn
ColumnControlOfIndex pColumn, pIndex returns the long id of the
control for the line pIndex and the column pColumn

You can using these functions if you need to interact with a control
in a cell in a datagrid table.

For datagrids forms it exists the properties:
- dgDataControlOfLine pLine
- dgDataControlOfIndex pIndex

Example:
put ColumnControlOfIndex("Color", the dgIndex of me) into theColumnControl
set the backcolor of graphic "Graphic" of theColumnControl to the
selectedtext of btn "Choice" of me


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




More information about the use-livecode mailing list