Drag & drop reordering of a DataGrid form

147 views
Skip to first unread message

Monte Goulding

unread,
Oct 1, 2010, 6:17:15 AM10/1/10
to How to use Revolution
Hi Everyone

I've got a blog up for reordering DataGrid forms by drag and drop. Doesn't work for tables and you must cache controls.

http://goulding.ws/consulting/blog/

Cheers

--
Monte Goulding
M E R Goulding Software Development
Bespoke application development for vertical markets

InstallGadget - How to create an installer in 10 seconds
revObjective - Making behavior scripts behave

_______________________________________________
use-revolution mailing list
use-rev...@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Monte Goulding

unread,
Oct 1, 2010, 7:09:37 AM10/1/10
to How to use Revolution
Hold the phone. Looking at the data grid behavior script this might already be a feature but I can't find any docs about enabling it. Trevor?

Monte Goulding

unread,
Oct 1, 2010, 8:23:15 AM10/1/10
to How to use Revolution
> Hold the phone. Looking at the data grid behavior script this might already be a feature but I can't find any docs about enabling it. Trevor?

Talking to myself here but the blog post has been updated with a drag and drop script using the inbuilt support that seems to be undocumented. Scroll to the bottom but I'm leaving my original script as it still might be worthwhile for people that want to give their drag and drop a customised look.

zryip theSlug

unread,
Oct 2, 2010, 8:28:12 AM10/2/10
to How to use Revolution
On Fri, Oct 1, 2010 at 2:23 PM, Monte Goulding
<mo...@sweattechnologies.com> wrote:
>> Hold the phone. Looking at the data grid behavior script this might already be a feature but I can't find any docs about enabling it. Trevor?
>
> Talking to myself here but the blog post has been updated with a drag and drop script using the inbuilt support that seems to be undocumented. Scroll to the bottom but I'm leaving my original script as it still might be worthwhile for people that want to give their drag and drop a customised look.
>
> http://goulding.ws/consulting/blog/
>
> Cheers

Hi Monte,

You are correct and Trevor could confirm that: for now there is no
documentation about the drag & drop features of a datagrid.

Concerning Drag & drop, Trevor has shared different links.

1) An example with a mp3 library:
http://tr.im/data_grid

This example shows how reorder lines in a DG or copy lines from a DG
table to a DG form

2) A sample stack
http://www.bluemangolearning.com/download/revolution/tools/dragdroptest.zip
The code used in the DG group is similar to the script you shared in
your blog excepted the dragMove handler is missing.


I shared also a small lab stack one or two weeks ago, to demonstrate
how drag & drop lines from a DG table to another DG table.
http://www.aslugontheroad.co.cc/index.php?option=com_phocadownload&view=category&download=11:experiment-15-drag-drop-in-dg&id=7:data-grid&Itemid=63

You have found your way with that so I posted this in case it could be
useful for someone in the list.
Anyway the Trevor's mp3 library still interesting to study.

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

Monte Goulding

unread,
Oct 2, 2010, 8:51:44 AM10/2/10
to How to use Revolution
> 2) A sample stack
> http://www.bluemangolearning.com/download/revolution/tools/dragdroptest.zip
> The code used in the DG group is similar to the script you shared in
> your blog excepted the dragMove handler is missing.

Ah, this stack would have been handy. It doesn't work unless you set the dragAction in dragMove though.

Cheers

--
Monte Goulding
M E R Goulding Software Development
Bespoke application development for vertical markets

InstallGadget - How to create an installer in 10 seconds
revObjective - Making behavior scripts behave

_______________________________________________

zryip theSlug

unread,
Oct 2, 2010, 9:19:37 AM10/2/10
to How to use Revolution
On Sat, Oct 2, 2010 at 2:51 PM, Monte Goulding
<mo...@sweattechnologies.com> wrote:
>> 2) A sample stack
>> http://www.bluemangolearning.com/download/revolution/tools/dragdroptest.zip
>> The code used in the DG group is similar to the script you shared in
>> your blog excepted the dragMove handler is missing.
>
> Ah, this stack would have been handy. It doesn't work unless you set the dragAction in dragMove though.

Monte,

Right. It seems necessary to set the dragAction in the dragMove
handler since LiveCode 4.5.
When I'm running the same stack with Revolution 4.5 dp2 all works like
a charm without the dragMove handler.


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

zryip theSlug

unread,
Oct 2, 2010, 9:32:15 AM10/2/10
to How to use Revolution
> On Sat, Oct 2, 2010 at 2:51 PM, Monte Goulding
> <mo...@sweattechnologies.com> wrote:
>>> 2) A sample stack
>>> http://www.bluemangolearning.com/download/revolution/tools/dragdroptest.zip
>>> The code used in the DG group is similar to the script you shared in
>>> your blog excepted the dragMove handler is missing.
>>
>> Ah, this stack would have been handy. It doesn't work unless you set the dragAction in dragMove though.
>
> Monte,
>
> Right. It seems necessary to set the dragAction in the dragMove
> handler since LiveCode 4.5.
> When I'm running the same stack with Revolution 4.5 dp2 all works like
> a charm without the dragMove handler.

Just to clarify, this is a change in the datagrid library itself not
in the LiveCode engine.
I have tried this by using the revdatagridlibrary stack from the
LiveCode 4.5 into my version of Revolution 4.5 dp2 and now I have to
set the dragAction to make the reorder perform.

Trevor DeVore

unread,
Oct 4, 2010, 9:40:47 AM10/4/10
to How to use Revolution
On Sat, Oct 2, 2010 at 9:32 AM, zryip theSlug <zryip....@gmail.com>wrote:

> Just to clarify, this is a change in the datagrid library itself not
> in the LiveCode engine.
> I have tried this by using the revdatagridlibrary stack from the
> LiveCode 4.5 into my version of Revolution 4.5 dp2 and now I have to
> set the dragAction to make the reorder perform.


In the dgDragMove handler update the code that sets the dragAction to this:

## Make sure data grid control will accept drop
if the dragSource contains the long ID of me and (the mouseControl is not
empty and the long id of the mouseControl contains the long ID of me) then
set the dragAction to "move"
end if

--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers:
http://revolution.bluemangolearning.com

Peter Haworth

unread,
Oct 4, 2010, 1:15:05 PM10/4/10
to use-rev...@lists.runrev.com
Maybe I'm misunderstanding something but I don't see any code for
handling drag/drop in the default datagrid behavior script I got when
I installed LiveCode 4.5

Pete Haworth

On Oct 4, 2010, at 10:00 AM, use-revolut...@lists.runrev.com
wrote:

> Message: 3
> Date: Mon, 4 Oct 2010 09:40:47 -0400
> From: Trevor DeVore <li...@mangomultimedia.com>
> Subject: Re: Drag & drop reordering of a DataGrid form
> To: How to use Revolution <use-rev...@lists.runrev.com>
> Message-ID:
> <AANLkTikNK=kzhhcL5BbtpDECy1dpaeXe37tWw=r7q...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1

David Beck

unread,
Oct 4, 2010, 1:18:03 PM10/4/10
to use-rev...@lists.runrev.com

Hello,

I have had two clients report serious performance problems with a
LiveCode standalone application on Windows 7, 32-bit machines. Dialogs
and windows take several minutes to open, when usually they take only
seconds. The same standalone (with the same data) works fine on other
machines. I have never encountered this issue before, and since these
two cases where both on Windows 7 I wonder if the problem is related to
Windows 7.

Has anybody else experiences this issue or have any ideas about what
could be the cause?

Thanks very much!

David Beck
Rotunda Software

Peter Haworth

unread,
Oct 4, 2010, 1:18:39 PM10/4/10
to use-rev...@lists.runrev.com
Thanks Trevor, that works great. Follow up question for you. I have
a datagrid table with two option menu columns in it. It's OK to
initialise the first one per your reply but the contents of the second
one need to be set differently depending on the currently selected
value in the first option menu. Any recommendations as to how to do
that?

Pete Haworth

On Oct 4, 2010, at 10:00 AM, use-revolut...@lists.runrev.com
wrote:

> Message: 4
> Date: Mon, 4 Oct 2010 09:42:59 -0400
> From: Trevor DeVore <li...@mangomultimedia.com>
> Subject: Re: Datagrid option menu initialisation


> To: How to use Revolution <use-rev...@lists.runrev.com>
> Message-ID:

> <AANLkTimOb-tiVAyBNETa-...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sat, Oct 2, 2010 at 12:22 PM, Peter Haworth
> <pe...@mollysrevenge.com>wrote:
>
>> I have defined an option menu in a datagrid column whose contents are
>> created by reading data from an SQLite database - the contents will
>> be the
>> same for each instance of the option menu and should be loaded when
>> the card
>> containing the datagrid is opened. Where should I put the code to
>> create
>> the option menu contents?
>>
>
> In the card that contains the data grid :-)
>
> In the preopencard or openCard message query the database, update
> the menu
> button text in the data grid template and then load the data grid.
> Since the
> template has the updated menu text all instances of your column will
> contain
> the updated menu text.


>
> --
> Trevor DeVore
> Blue Mango Learning Systems
> ScreenSteps: http://www.screensteps.com
> Releasable Revolution Resources for Developers:
> http://revolution.bluemangolearning.com

_______________________________________________

Mark Wieder

unread,
Oct 4, 2010, 1:39:28 PM10/4/10
to How to use Revolution
David-

Monday, October 4, 2010, 10:18:03 AM, you wrote:

> Has anybody else experiences this issue or have any ideas about what
> could be the cause?

Try upgrading the Win7 video drivers (!)

--
-Mark Wieder
mwi...@ahsoftware.net

J. Landman Gay

unread,
Oct 4, 2010, 3:25:00 PM10/4/10
to How to use Revolution
On 10/4/10 12:18 PM, David Beck wrote:
>
> Hello,
>
> I have had two clients report serious performance problems with a
> LiveCode standalone application on Windows 7, 32-bit machines. Dialogs
> and windows take several minutes to open, when usually they take only
> seconds. The same standalone (with the same data) works fine on other
> machines. I have never encountered this issue before, and since these
> two cases where both on Windows 7 I wonder if the problem is related to
> Windows 7.
>
> Has anybody else experiences this issue or have any ideas about what
> could be the cause?

I don't know the cause, but I also have a client who reports that on
Win7 "nothing happens" when he clicks either of two buttons that call
"ask file" or "answer file" dialogs. Given what you said, I wonder if
"nothing happens" really means "nothing happens for a long time until I
get bored and quit."

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com

Peter Haworth

unread,
Oct 4, 2010, 3:44:10 PM10/4/10
to use-rev...@lists.runrev.com
I guess I'm not understanding this correctly. Here's what I did,
assuming the column with the option menu in it is named "OptionColumn"

On the Datagrid Templates card, I see a button named "OptionColumn
Behavior". I deleted all the lines from the script for that button
then hit Apply. Then I opened the card containing my datagrid but
still my default column script is only executed for columns that have
not been customised.

Any ideas?


Pete Haworth

On Oct 4, 2010, at 10:00 AM, use-revolut...@lists.runrev.com
wrote:

> Message: 5
> Date: Mon, 4 Oct 2010 09:45:02 -0400
> From: Trevor DeVore <li...@mangomultimedia.com>
> Subject: Re: Datagrid Default Column Behavior


> To: How to use Revolution <use-rev...@lists.runrev.com>
> Message-ID:

> <AANLkTimF1Et1p5Pfc_G-V...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sun, Oct 3, 2010 at 9:06 PM, Peter Haworth
> <pe...@mollysrevenge.com>wrote:
>
>> What is the correct way to set the default column behavior of a
>> datagrid so
>> that the script is entered for columns which have been customised
>> to contain
>> option menus?
>>
>> I have set the default column behavior property for the datagrid
>> but suing
>> debug shows that the script is only executed for columns that hve
>> not been
>> customised in some way.
>>
>
> When you create a custom column the behavior script of the column
> template
> is assigned to the behavior that is created alongside the column
> template.
> The default column behavior only applies to column templates that do
> not
> have a behavior assigned. Just set the behavior of your new column
> template
> to empty and then it will inherit the default behavior.


>
> --
> Trevor DeVore
> Blue Mango Learning Systems
> ScreenSteps: http://www.screensteps.com
> Releasable Revolution Resources for Developers:
> http://revolution.bluemangolearning.com
>

_______________________________________________

J. Landman Gay

unread,
Oct 4, 2010, 5:27:08 PM10/4/10
to How to use Revolution
On 10/4/10 12:39 PM, Mark Wieder wrote:
> David-
>
> Monday, October 4, 2010, 10:18:03 AM, you wrote:
>
>> Has anybody else experiences this issue or have any ideas about what
>> could be the cause?
>
> Try upgrading the Win7 video drivers (!)
>

Wow, who woulda thought? Video driver issues cause file dialog problems?
I believe you, but I can't imagine why that would be. Any idea?

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com

Monte Goulding

unread,
Oct 4, 2010, 5:54:26 PM10/4/10
to How to use Revolution
> In the dgDragMove handler update the code that sets the dragAction to this:
>
> ## Make sure data grid control will accept drop
> if the dragSource contains the long ID of me and (the mouseControl is not
> empty and the long id of the mouseControl contains the long ID of me) then
> set the dragAction to "move"
> end if


Thanks Trevor, that did the job.


--
Monte Goulding
M E R Goulding Software Development
Bespoke application development for vertical markets

InstallGadget - How to create an installer in 10 seconds
revObjective - Making behavior scripts behave

_______________________________________________

Mark Wieder

unread,
Oct 4, 2010, 7:57:40 PM10/4/10
to use-rev...@lists.runrev.com
Jacque-

Monday, October 4, 2010, 2:27:08 PM, you wrote:

> Wow, who woulda thought? Video driver issues cause file dialog problems?
> I believe you, but I can't imagine why that would be. Any idea?

Absolutely none. Just passing on what I've been told.

--
-Mark Wieder
mwi...@ahsoftware.net

J. Landman Gay

unread,
Oct 4, 2010, 8:48:18 PM10/4/10
to How to use Revolution
On 10/4/10 6:57 PM, Mark Wieder wrote:
> Jacque-
>
> Monday, October 4, 2010, 2:27:08 PM, you wrote:
>
>> Wow, who woulda thought? Video driver issues cause file dialog problems?
>> I believe you, but I can't imagine why that would be. Any idea?
>
> Absolutely none. Just passing on what I've been told.
>

I wrote it down in my Weird Tales and Strange Associations diary. Thanks
though. I've passed the info to my client. He didn't even blink.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com

Trevor DeVore

unread,
Oct 5, 2010, 8:29:03 AM10/5/10
to How to use Revolution
On Mon, Oct 4, 2010 at 1:18 PM, Peter Haworth <pe...@mollysrevenge.com>wrote:

> I have a datagrid table with two option menu columns in it. It's OK to
> initialise the first one per your reply but the contents of the second one
> need to be set differently depending on the currently selected value in the
> first option menu. Any recommendations as to how to do that?
>

You will need to populate the menu in the FillInData message in this case.
Just fetch the value of the column that dictates the values and then
populate.

http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7313-How-Do-I-Get-Data-Associated-With-a-Row-or-Column-

Trevor DeVore

unread,
Oct 5, 2010, 8:37:07 AM10/5/10
to How to use Revolution
On Mon, Oct 4, 2010 at 3:44 PM, Peter Haworth <pe...@mollysrevenge.com>wrote:

> I guess I'm not understanding this correctly. Here's what I did, assuming
> the column with the option menu in it is named "OptionColumn"
>
> On the Datagrid Templates card, I see a button named "OptionColumn
> Behavior". I deleted all the lines from the script for that button then hit
> Apply. Then I opened the card containing my datagrid but still my default
> column script is only executed for columns that have not been customised.
>

Deleting the script doesn't change the fact that the button is assigned as
the behavior for the "OptionColumn" column. You need to set the behavior
property of the "OptionColumn" group on you template card to empty.
Otherwise you have a column template with no script at all (because you
deleted the script in OptionColumn Behavior).

Trevor DeVore

unread,
Oct 5, 2010, 8:43:13 AM10/5/10
to How to use Revolution
On Mon, Oct 4, 2010 at 1:15 PM, Peter Haworth <pe...@mollysrevenge.com>wrote:

> Maybe I'm misunderstanding something but I don't see any code for handling
> drag/drop in the default datagrid behavior script I got when I installed
> LiveCode 4.5


The code is in the data grid behavior script: edit script of btn "Data Grid"
of stack "revDataGridLibrary"

Our good friend the Slug posted some links to some example stacks I've made
showing how to use it. The code snippet I posted for Monte and Monsieur Le
Slug was to fix an issue with setting the dragAction. The code snippet goes
in the "Data Grid" button script.

Trevor DeVore

unread,
Oct 5, 2010, 8:43:26 AM10/5/10
to How to use Revolution
On Mon, Oct 4, 2010 at 1:15 PM, Peter Haworth <pe...@mollysrevenge.com>wrote:

> Maybe I'm misunderstanding something but I don't see any code for handling
> drag/drop in the default datagrid behavior script I got when I installed
> LiveCode 4.5

The code is in the data grid behavior script: edit script of btn "Data Grid"
of stack "revDataGridLibrary"

Our good friend the Slug posted some links to some example stacks I've made
showing how to use it. The code snippet I posted for Monte and Monsieur Le
Slug was to fix an issue with setting the dragAction. The code snippet goes
in the "Data Grid" button script.

--

zryip theSlug

unread,
Oct 6, 2010, 1:49:23 PM10/6/10
to How to use Revolution
On Mon, Oct 4, 2010 at 3:40 PM, Trevor DeVore <li...@mangomultimedia.com> wrote:
> On Sat, Oct 2, 2010 at 9:32 AM, zryip theSlug <zryip....@gmail.com>wrote:
>
>> Just to clarify, this is a change in the datagrid library itself not
>> in the LiveCode engine.
>> I have tried this by using the revdatagridlibrary stack from the
>> LiveCode 4.5 into my version of Revolution 4.5 dp2 and now I have to
>> set the dragAction to make the reorder perform.
>
>
> In the dgDragMove handler update the code that sets the dragAction to this:
>
> ## Make sure data grid control will accept drop
> if the dragSource contains the long ID of me and (the mouseControl is not
> empty and the long id of the mouseControl contains the long ID of me) then
>   set the dragAction to "move"
> end if


Thanks Trevor 8-)


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

Reply all
Reply to author
Forward
0 new messages