Sorting...

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sorting...

Post by Klaus » Wed Feb 27, 2019 12:01 pm

jacque wrote:
Wed Feb 27, 2019 1:08 am
Erm, I think for openStack you'd have to 'send openStack to the mouseStack" from the message box, wouldn't you?
Nope. The message box doesn't send messages to itself, it aims for the defaultstack -- except when LC goes wacky, that is, but then there are other problems. ;)
If you put your cursor over the stack you want before hitting ENTER, then this will surely work
-> ...to the mousestack!

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sorting...

Post by bogs » Wed Feb 27, 2019 12:16 pm

Yah, thats how I thought it had to work Klaus, but Jacque says not necessary. I can see i'll be testing the limits of this later today :P
Image

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sorting...

Post by Klaus » Wed Feb 27, 2019 12:21 pm

Using "the mousestack" you can also target any NON defaultstack on the screen!

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sorting...

Post by bogs » Wed Feb 27, 2019 12:33 pm

Ah, gotcha. I think with me, it just became a habit to use it after the first time you pointed it out to me, along with 'the mouseControl' and so on.
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Sorting...

Post by jacque » Wed Feb 27, 2019 5:24 pm

Note that my suggestion will only work with topstacks that have a mode of 1. Palettes and modals aren't candidates. For those I use the mousestack trick.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Sorting...

Post by ValiantCuriosity » Wed Feb 27, 2019 8:37 pm

Well Bogs,

At least you have a focus. Mine is a total blur. :oops:

Jackie, thanks for jumping in. I am trying to familiarize myself with the message box.

I really enjoy the little short sample code snips too. The memory game is fantastic, but a little on the deep end for me yet. Everything helps. I'm trying out different bits of code with the LC commands, properties, etc. Some work as expected (for me). Others, don't. Still, "step by step..."

Right now, I'm having a lot of fun grabbing buttons, changing colors, font sizes, etc. Just playing. I got a little burned out on Android. For some reason, Android has been my nemesis even when using HTML5 technologies. I'm hoping that LC will allow me to put out my apps for both iOS and Android.

I've finished the great Amazon book. It has helped. The blinds have been raised on a few things. That is good news.

Thanks to all. Have a GREAT day.
-Rachel
May I never be cured of my curiosity! :D

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sorting...

Post by bogs » Wed Feb 27, 2019 8:59 pm

I've been pretty blurry on occasion (like in the blocking/non-blocking thread :oops: ). My wife tells me I'm in a fog on other occasions. Embrace the blurriness !
Image

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sorting...

Post by Klaus » Wed Feb 27, 2019 9:04 pm

Hi Rachel,
ValiantCuriosity wrote:
Mon Feb 25, 2019 2:26 am
...
1. I have a list that is "Dog, Cat, Rabbit, Monkey".
Klaus wrote:
Mon Feb 25, 2019 2:36 pm
...
"sort fld xyz" always does a LINE sort (like -> sort LINES of fld xyz), unless you tell LC otherwise.
You want:
...
sort ITEMS of fld "your field here"
...
you didn't explicitely say so, but your intial question should have been answered correctly so far, right?


Best

Klaus

ValiantCuriosity
Posts: 128
Joined: Thu Jun 30, 2016 3:08 am

Re: Sorting...

Post by ValiantCuriosity » Thu Feb 28, 2019 9:28 pm

Hi Klaus,
Yes, I have gotten the "sort" command code to work! :D I think the problem that I had was where I was placing the command. It finally worked when I created a new card and used the "preOpenCard" statement:

Code: Select all

preOpenCard
   sort field "Field" ascending
end preOpenCard
Then I accessed the script from a different card. The script ran perfectly. I need to look at "item" and delimiters some more.

I read that the main stack and first card should really not be used for much other than holding the new cards. It sounds like sub stacks and/or cards are the way to go. Could that be because the mainStack/card1 only runs once when the app opens or is it my ignorance of the finer points?

The script that Bogs gave me helped a lot. I could study it to see what it was doing. All the feedback here got my "baby steps" sort command issue solved. :wink:

Where to place the code is tricky for me. I've been studying your conference reference. That does a nice job of describing some of the information on Stacks and Cards, etc.

I do wish that the dictionary would give a real code sample at the bottom of the description. Sometimes it does and other times, it doesn't. A true code sample would help new people with the syntax. Ah, well, for such a few developers, LC is truly an amazing piece of work. I'm in awe of what they have done.

Thanks again to everyone.
-Rachel
May I never be cured of my curiosity! :D

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sorting...

Post by Klaus » Thu Feb 28, 2019 9:34 pm

Hi Rachel,

get used to know and use the message hierachy, check this great article:
http://www.fourthworld.com/embassy/arti ... _path.html
I read that the main stack and first card should really not be used for much other than holding the new cards. It sounds like sub stacks and/or cards are the way to go.
You can't generalize this, it depends, I'd say. :-)


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Sorting...

Post by jacque » Thu Feb 28, 2019 9:56 pm

I put stuff in the stack and first card all the time. More often than not, actually. Klaus is right.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sorting...

Post by bogs » Thu Feb 28, 2019 10:02 pm

I'm the odd duck, I tend to put almost everything in the main stack Image
(of course, I do separate it out later if I need to)

I think someone once said to me (but don't quote this) that you put it as high as it makes sense.

I.e. if it affects one control, put it in that control, several controls, card level, several cards/stacks, stack level, something like that.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Sorting...

Post by dunbarx » Thu Feb 28, 2019 11:37 pm

I wonder if Rachel may be alluding to the "splash stack" method in making standalones, where nothing of importance should be placed in the "mainStack" if that is to be the executable, since nothing can be saved there.

But historically, the mainStack is the central workhorse, with subStacks performing ancillary tasks or providing ancillary services. The splash stack is yet another "main" stack, and merely a vehicle for the "real" mainStack and its minions.

Craig

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Sorting...

Post by bogs » Thu Feb 28, 2019 11:49 pm

dunbarx wrote:
Thu Feb 28, 2019 11:37 pm
...and its minions.
...but not these guys :D
Image
Image

Post Reply