Drag and Drop between Data Grids

zryip theSlug zryip.theslug at gmail.com
Wed Dec 15 09:14:28 EST 2010


On Wed, Dec 15, 2010 at 2:01 PM, Yves COPPE <yvescoppe at skynet.be> wrote:
>
> Le 15 déc. 2010 à 11:55, zryip theSlug a écrit :
>
>> On Wed, Dec 15, 2010 at 9:41 AM, Yves COPPE <yvescoppe at skynet.be> wrote:
>>> Le 14 déc. 2010 à 21:09, zryip theSlug a écrit :
>>>
>>> Hi
>>>
>>> I have a problem with the script above
>>> The text in the datagrid2 doesn't appear
>>> When I add by drag 'n drop text from datagrid1 to datagrid2, I see the scroll bar of datagrid2 moving, so the text seems to be effectively added, but no text appears
>>> When I place a breakpoint at end of the script of datagrid2 I see the variables with the good data.
>>>
>>> What do I wrong ?
>>>
>>> thanks.
>>
>> Hi Yves,
>>
>> Should be reside in the fact that the columns of your dest datagrid
>> are not named "Col1" and "Col2".
>> Bob has experimented this, I think. He replied the solution in another post.
>>
>>
>> It seems that some explanations are required here.
>>
>> 1) In the source datagrid, the datas of the drag line are formatted
>> with a tab for delimiting each fields with the combine keyword and put
>> them into the dragData:
>>
>> put the dgDataOfIndex[tTheIndex] of me into tTheDragData
>> combine tTheDragData using tab
>> set the dragData["private"] to tTheDragData
>>
>> For example, if you have a grid:
>>
>> First Name      Last Name
>> Yves               COPPE
>>
>> The resulting data in the dragData will be something such as:
>> Yves(tab)COPPE
>>
>> 2) In the destination datagrid you need to map the content of the
>> dragData dropped, with the corresponding columns of the datagrid.
>>
>> The line:
>>
>> put "Col1" & cr & "Col2" into tTheColOrder
>>
>> assumes that your destination datagrid contains 2 columns: "col1" and "col2"
>> That is probably not the case.
>>
>> If your destination grid looks like this:
>>
>> First Name      Last Name
>> Yves               COPPE
>>
>> Your line must be:
>> put "First Name" & cr & "Last Name" into tTheColOrder
>>
>> That could be something equivalent to:
>> put item 1 of the dragData into column "First Name"
>> put item 2 of the dragData into column "LastName"
>>
>>
>> If your destination grid looks like this:
>>
>> Last Name      First Name
>> COPPE          Yves
>>
>> Your line must be:
>> put "First Name" & cr & "Last Name" into tTheColOrder
>>
>> That could be something equivalent to:
>> put item 1 of the dragData into column "First Name"
>> put item 2 of the dragData into column "Last Name"
>>
>> Why?:
>> In this case, as you pass the columns to the addLine event, the
>> datagrid engine will be capable to map your data and populate the
>> corresponding columns
>>
>> send "AddLine tTheNewData, tTheColOrder" to me
>>
>>
>> Note that putting the data in the dragData in this way is a
>> possibility not an obligation. You can developp your own method for
>> doing this, more according to your needs.
>>
>>
>> Best regards,
>> --
>> -Zryip TheSlug- wish you the best! 8)
>> http://www.aslugontheroad.co.cc
>>
>> _______________________________________________
>> use-livecode mailing list
>> 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
>
>
>
> Hi
>
>
>
> in the script of grp "datagrid2" (destination grid), I write
> set itemDel to tab
>> put item 1 of the dragData into column "First Name"
>> put item 2 of the dragData into column "Last Name"
>
> when I "apply", I get an error
> i add
>
>> put item 1 of the dragData into column "First Name" of me
>
>
> but no success
>
> Why ???

Yves,

Because it was a virtual example I gave you to show how the datagrid
interpreted the informations you sent. Sorry if this gave you some
confusion.

This form of writing does not exist.You must use the following lines
to fill the datagrid:

put "Col1" & cr & "Col2" into tTheColOrder -- the names of the columns
of the destination grid
put the dragData["private"] into tTheNewData -- the data
send "AddLine tTheNewData, tTheColOrder" to me -- the command for adding a line


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




More information about the Use-livecode mailing list