Changing the order of the items in a scrolling list field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Changing the order of the items in a scrolling list field
Hello community,
I am trying to create svg buttons which enable the user to change the order of the things in a scrolling list field.
It should work similarly to a music playlist where u can change the order of the songs that are to be played.
I have 4 buttons:
--- moveOneUp - (swap with the item above)
--- moveOneDown - (swap with the item underneath)
--- moveToFirst - (put the selected item all the way top)
--- moveToLast - (put the selected item all the way to the bottom)
In the attached img you can see it as well. I am able to get the data from the selected row, save it in a variable and read the one above or below the selected row but I still cant figure out how to swap them or to put the selected row as first/last.
Any tips/help would be much appreciated.
Best regards,
Radoslav
I am trying to create svg buttons which enable the user to change the order of the things in a scrolling list field.
It should work similarly to a music playlist where u can change the order of the songs that are to be played.
I have 4 buttons:
--- moveOneUp - (swap with the item above)
--- moveOneDown - (swap with the item underneath)
--- moveToFirst - (put the selected item all the way top)
--- moveToLast - (put the selected item all the way to the bottom)
In the attached img you can see it as well. I am able to get the data from the selected row, save it in a variable and read the one above or below the selected row but I still cant figure out how to swap them or to put the selected row as first/last.
Any tips/help would be much appreciated.
Best regards,
Radoslav
-
- Livecode Opensource Backer
- Posts: 9285
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Changing the order of the items in a scrolling list field
The scripts for the 4 possibilities are in the buttons.
Това е не много трудно, нали?
По принцип е само логика.
-
oneUp
Code: Select all
on mouseUp
put the selectedText of fld "fDATA" into MYLINE
put the selectedLine of fld "fDATA" into MYLINEnum
set the itemDelimiter to " "
put item 2 of MYLINEnum into MYnum
if MYnum > 1 then
put (MYnum - 1) into NEWnum
put line NEWnum of fld "fDATA" into SWOP
put MYLINE into line NEWnum of fld "fDATA"
put SWOP into line MYnum of fld "fDATA"
end if
end mouseUp
- Attachments
-
- SWAP SHOP.livecode.zip
- (1.53 KiB) Downloaded 120 times
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Changing the order of the items in a scrolling list field
Here is a stack similar to one I wrote about 30 years ago to do something similar. You may find it a better method.
Simply click on any line in the field, hold and drag to a new line location and release. The original drops into that spot, and the other lines adjust to allow it.
Craig
It is a bit simplistic, since I just recreated it here from memory. But you can always add bells and whistles...
Simply click on any line in the field, hold and drag to a new line location and release. The original drops into that spot, and the other lines adjust to allow it.
Craig
It is a bit simplistic, since I just recreated it here from memory. But you can always add bells and whistles...
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Changing the order of the items in a scrolling list field
Thanks Craig for resuscitate old stuff
I just add a mouserelease on fld script to hide fld "traveler"
Jean-Marc
I just add a mouserelease on fld script to hide fld "traveler"
Code: Select all
on mouserelease
hide fld "traveler"
end mouserelease
https://alternatic.ch
Re: Changing the order of the items in a scrolling list field
You are amazing guys, thank you so much!
I am really starting to like LiveCode
richmond62 :
Много благодаря, не мога да отговоря на личното съобщение понеже ми казва, че съм твърде нов юзър все още.
В Пловдив съм отраснал и аз иначе.
Appreciatively,
Radoslav
I am really starting to like LiveCode
richmond62 :
Много благодаря, не мога да отговоря на личното съобщение понеже ми казва, че съм твърде нов юзър все още.
В Пловдив съм отраснал и аз иначе.
Appreciatively,
Radoslav
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Changing the order of the items in a scrolling list field
Jean-Marc.
Craig
Very useful if the user strays from the field. Was that a bell or a whistle?I just add a mouserelease on fld script to hide fld "traveler"
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Changing the order of the items in a scrolling list field
Radoslav.
You will gain full privileges when you have, I think, seven posts.
Craig
You will gain full privileges when you have, I think, seven posts.
Craig
Re: Changing the order of the items in a scrolling list field
And can you please give me some hints on how to accomplish the same behavior on a DataGrid?
I basically want to build a music playlist, where the user can reorder the songs and choose where to start.
The user selects items(songs) from a dropdown list and adds them to a playlist(scrolling list field) and it is also inserted into an "invisible" DataGrid, where I store more detailed information like filePaths etc., so I am trying to in other words synchronize them.
Cheers, Radoslav
I basically want to build a music playlist, where the user can reorder the songs and choose where to start.
The user selects items(songs) from a dropdown list and adds them to a playlist(scrolling list field) and it is also inserted into an "invisible" DataGrid, where I store more detailed information like filePaths etc., so I am trying to in other words synchronize them.
Cheers, Radoslav