How would I attempt to change the order of a row in a datagrid?
Example: I have a list of items that are populated from a database. Lets say I want to change
the order of them so they display in the exact order I want them on the datagrid. I would like
to do this by selecting the row and pressing down the CONTROL and arrow up/down key.
How could I accomplish something like this? My long term goal is to have a field in database
that controls the display order so I can save this ordering change on a more permanent basis
so next time the datagrid loads it will be in the order expected.
Changing datagrid row order
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Changing datagrid row order
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392
Re: Changing datagrid row order
Couldn't you get the dgText, maybe with the dgHilitedLines property, switch the row data, and reset the dgText?
It would be much cooler to be able to drag and drop entire rows. I do this with list fields all the time, but never in a DG.
Craig Newman
It would be much cooler to be able to drag and drop entire rows. I do this with list fields all the time, but never in a DG.
Craig Newman
Re: Changing datagrid row order
Drag and drop would be great but I guess thats not possible. Any suggestions what I would use to trigger the re-order?
I tried the code below assuming I would hold down the F10 and double click at the same time
but it didn't work apparently. I never got by answer F10.
I tried the code below assuming I would hold down the F10 and double click at the same time
but it didn't work apparently. I never got by answer F10.
Code: Select all
on mousedoubledown
if keyNo = '65479' then
answer "F10"
else
answer "Nope"
end if
end mousedoubledown
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392
Re: Changing datagrid row order
Hi Gery,
try this:
The way you tried to query the functionKey does not work. You get the number only if you watch for rawKey events.
You can only query the modifier keys for being "down" in a on mouseWhatever handler.
Kind regards
Bernd
try this:
Code: Select all
on mousedoubledown
if the altkey is down then
answer "AltKey"
else
answer "Nope"
end if
end mousedoubledown
Code: Select all
on rawKeyDown theKey
put theKey && the milliseconds into field 1
end rawKeyDown
Kind regards
Bernd