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
-
pajito
- Posts: 30
- Joined: Thu Apr 13, 2017 8:08 pm
Post
by pajito » Sat May 20, 2017 11:25 am
mrcoollion wrote:Just an idea...
Make use of segmented control widgets
step 1) add 2 segmented control widgets on the card and name them resp "ButtonRow1" and "ButtonRow2"
step 2) add a button TRANS with the code below.
Select an option on each button row then press button TRANS.
(Be aware that the widget initially has no highlited item, i did not code for this situation).
Code: Select all
on mouseUp
put the hilitedItems of widget "ButtonRow1" into tRow1
put the hilitedItems of widget "ButtonRow2" into tRow2
answer "Ok now switch"
set the hilitedItems of widget "ButtonRow1" to tRow2
set the hilitedItems of widget "ButtonRow2" to tRow1
end mouseUp
Friendly regards,
Paul
Hi Paul I tried it and it worked, if there is no hilited item at start,thank you so much. It is a good start for me.
thanks again
-
pajito
- Posts: 30
- Joined: Thu Apr 13, 2017 8:08 pm
Post
by pajito » Sat May 20, 2017 11:27 am
jacque wrote:Group the PGM buttons and name the group "PGM". Group the PRV buttons and name the group "PRV".
Script of group "PGM":
Code: Select all
on mouseUp
repeat with x = 1 to the number of btns of me
set textcolor of btn x of me to "black"
set the backcolor of btn x of me to "white"
end repeat
set textcolor of the target to "yellow"
set the backcolor of the target to "red"
end mouseUp
Script of group "PRV":
Code: Select all
on mouseUp
repeat with x = 1 to the number of btns of me
set the backcolor of btn x of me to "white"
end repeat
set the backcolor of the target to "green"
end mouseUp
Script of button "trans":
Code: Select all
on mouseUp
set the backgroundcolor of me to "YELLOW"
-- get the currently active btn in each grp:
repeat with x = 1 to the number of btns in grp "PGM"
if the backcolor of btn x of grp "PGM" = "red" then
put x into tPGMBtn
exit repeat
end if
end repeat
repeat with x = 1 to the number of btns in grp "PRV"
if the backcolor of btn x of grp "PRV" = "green" then
put x into tPRVBtn
exit repeat
end if
end repeat
-- reverse swap:
send "mouseUp" to btn tPGMBtn of grp "PRV"
send "mouseUp" to btn tPRVBtn of grp "PGM"
end mouseUp
Is that what you need to happen? This method doesn't require any global variables.
Klaus is right, radioBehavior only works on radio buttons, at least in newer versions of LC, even though the property is available in the inspector. Craig, what button type are you using? I only checked rectangle buttons, but historically the behavior was named "radioBehavior" for a reason.

Hi jacque
you saved the game, I tried your codes and they work prerfectly. It was a very smart way to handle everything. Thank you so much.
-
pajito
- Posts: 30
- Joined: Thu Apr 13, 2017 8:08 pm
Post
by pajito » Sat May 20, 2017 11:31 am
Hey everybody,
first of all I had to thank each and every one of you. Either your suggestions worked or partially worked, you gave me lot of ideas of how to continue.
The software I am stragling to create its quite big in coding, you will have some screenshots and videos as soon as I get to a satisfying point.
Thank YOU ALL again
Warm Regards
Pajito
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sat May 20, 2017 3:06 pm
Hi Craig,
dunbarx wrote:Jacque, Klaus.
All types, in v.6.7.
Odd that this would have changed in later versions, since hardly anyone even knew about it.
Craig
just made a test with Metacard, LC engine 5.5.4) and it did not work, "the hilitedbutton of grp 1" returned 0!
Too funky, but since it was not supposed to work this way, I don't care
Best
Klaus
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sat May 20, 2017 3:32 pm
I tried your codes and they work prerfectly.
Glad to help. You will get smoother screen updates if you put "lock screen" at the top of each handler and "unlock screen" at the end. I forgot to do that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com