How to get the Group name (sorted) when they are actived

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

Post Reply
shalu
Posts: 72
Joined: Fri Mar 20, 2015 1:05 pm

How to get the Group name (sorted) when they are actived

Post by shalu » Thu Oct 01, 2015 5:05 am

Hi All,

I have several group in my card when I click any one of the group it's name is assign to a variable, My problem is if I click the fifth group first and fourth group second then the variable shows according the group are placed, eg:(if I have group like "name","address","gender" and "grade" if i click grade first and gender second then the variable shows that gender, grade my requirement is if click the last group first then it's name should placed in first). How I solve this problem :roll:
The following code I have used.

Code: Select all

repeat with i= 1 to the number of buttons in this card
         if the is_group of btn i is true and  the hilite of btn i is true then 
            lock screen
         put the short name of btn i & cr after p
               end if   
   end repeat
Thanks
Shalu
--
Thanks
Shalu S

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

Re: How to get the Group name (sorted) when they are actived

Post by dunbarx » Thu Oct 01, 2015 5:21 am

Hi.

I may not be understanding, and I do not know how you initialize the selection sequence, but why not put this in the card script:

Code: Select all

global theGroupOrder
on mouseup
put the name of the target & return after theGroupOrder
end mouseUp
This may need some refinement, to validate the target, prevent duplication, or whatever. You might make a field and test this by placing the contents of the global into the field; see how it builds. I would use a custom property instead of a global, but that is a matter of style.

Craig Newman

shalu
Posts: 72
Joined: Fri Mar 20, 2015 1:05 pm

Re: How to get the Group name (sorted) when they are actived

Post by shalu » Thu Oct 01, 2015 5:58 am

Hi All,

My requirement is like Stack operation(First come items placed at last and top of the stack is last selected item) here first clicked group or button name is place last and last clicked item is placed in top.

Thanks
shalu
--
Thanks
Shalu S

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

Re: How to get the Group name (sorted) when they are actived

Post by dunbarx » Thu Oct 01, 2015 6:16 am

Ah.

Then try this. Make a field 1 to show the progression. Clear the global any way you want to, before you start:

Code: Select all

global theGroupOrder
on mouseup
   put the name of the target & return before theGroupOrder
   put theGroupOrder into fld 1
end mouseUp
But now you must experiment with the keywords "after", "into" and "before", and learn to use them.

Craig Newman

Post Reply