Move object forward/backward
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9664
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Move object forward/backward
CAsba.
Stam makes a point. Lock the screen so you do not see any of this hiding and showing. With such a small amount of activity, you might not notice anything, but certainly this is good practice with this sort of shenanigans, and would likely be really necessary with large numbers of controls doing possibly large amounts of moving around.
Locking the screen does just that, hiding all activity going on under script control. The screen automatically unlocks when the handler ends, leaving you with only the resultant state.
Craig
Stam makes a point. Lock the screen so you do not see any of this hiding and showing. With such a small amount of activity, you might not notice anything, but certainly this is good practice with this sort of shenanigans, and would likely be really necessary with large numbers of controls doing possibly large amounts of moving around.
Locking the screen does just that, hiding all activity going on under script control. The screen automatically unlocks when the handler ends, leaving you with only the resultant state.
Craig
Re: Move object forward/backward
Hi Craig,
It's now working fine, and I didn't group the buttons, I just did this:-
on mouseUp pMouseButton
if field moresales = "xx" then
set the layer of button "print a quotation" to top
set the layer of button "Manage products" to top
put "yy" into field moresales
exit mouseup
end if
if field moresales = "yy" then
set the layer of button "view current debtorss" to top
set the layer of button "Raise a proforma invoice" to top
put "xx" into field moresales
end if
end mouseUp
Yes, I will add an initial line of lockscreen
Thanks.
It's now working fine, and I didn't group the buttons, I just did this:-
on mouseUp pMouseButton
if field moresales = "xx" then
set the layer of button "print a quotation" to top
set the layer of button "Manage products" to top
put "yy" into field moresales
exit mouseup
end if
if field moresales = "yy" then
set the layer of button "view current debtorss" to top
set the layer of button "Raise a proforma invoice" to top
put "xx" into field moresales
end if
end mouseUp
Yes, I will add an initial line of lockscreen
Thanks.
Re: Move object forward/backward
Hi CAsba,
please dd the CODE tags above -> <> after pasting your script here.
This way the formatting will be preserved, see below.
And in your own interest please ALWAYS use quotes around object names:
Best
Klaus
please dd the CODE tags above -> <> after pasting your script here.
This way the formatting will be preserved, see below.
Code: Select all
on mouseUp pMouseButton
beep
end mouseUp
Code: Select all
## field moresales
...fld "moresales"
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9664
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Move object forward/backward
CAsba.
Always good to have a solution.
But do you see why I am promoting the idea of hiding the unwanted controls instead of "buryIng" them under others? In my mind, especially if you will ever have more than just two levels, layering will become unmanageable. And what happens if you ever need to actually place certain controls in specific layers, or to switch layers among others? You have to "reserve" specific layer values for this particular functionality. It is really not the right way to do it.
Something to consider as you learn more LiveCode is to try to make your efforts robust. That means that they are built in such a way that allows flexibility in the future. Hiding has none of the baggage that layering does. There is no "hierarchy" when you hide or show. All hidden controls are just that, hidden. And all visible controls are just that, visible. This cuts through the traps inherent in putting one thing on top of another. Hide/Show does not matter how many controls are in play or whether you add or subtract controls as you develop.
Craig
Always good to have a solution.
But do you see why I am promoting the idea of hiding the unwanted controls instead of "buryIng" them under others? In my mind, especially if you will ever have more than just two levels, layering will become unmanageable. And what happens if you ever need to actually place certain controls in specific layers, or to switch layers among others? You have to "reserve" specific layer values for this particular functionality. It is really not the right way to do it.
Something to consider as you learn more LiveCode is to try to make your efforts robust. That means that they are built in such a way that allows flexibility in the future. Hiding has none of the baggage that layering does. There is no "hierarchy" when you hide or show. All hidden controls are just that, hidden. And all visible controls are just that, visible. This cuts through the traps inherent in putting one thing on top of another. Hide/Show does not matter how many controls are in play or whether you add or subtract controls as you develop.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9664
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Move object forward/backward
Jacque. Just don't.
CAsba. For homework, change your current effort to a Hide/Show one. There will be a test later.
Craig
CAsba. For homework, change your current effort to a Hide/Show one. There will be a test later.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Move object forward/backward
Heh. I've given up on you Craig, you're incorrigible.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com