Want to check more than 1 checkbox.

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
abanowBUSTfGf
Posts: 63
Joined: Sat Dec 22, 2012 3:01 am

Want to check more than 1 checkbox.

Post by abanowBUSTfGf »

I have four checkboxes and want to be able to check more than one. If I do this the
system responds as if only the last one is checked. How can I get around this.
Thanks.
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Want to check more than 1 checkbox.

Post by sturgis »

Are they checkboxes or radio buttons? If they're checkboxes they should all be checkable individually. If they're radio buttons, and in a group, only 1 can be selected at a time. If they're outside a group (or in different groups) they can be selected individually. If you're using radio buttons inside a group and you wish them to behave separately, open the property inspector for the group and take the check out of the radioBehavior button. (might be called something slightly different depending on your preferences)


If you're speaking of checkboxes, and they aren't behaving as expected, can you explain how you set them up (in a group, out of group, what scripts are involved) so that its easier to help?
abanowBUSTfGf
Posts: 63
Joined: Sat Dec 22, 2012 3:01 am

Re: Want to check more than 1 checkbox.

Post by abanowBUSTfGf »

Hi, thanks, what I've done is set up 4 checkboxes (not grouped) and want to perform a sound the boxes have
been checked. What I'm getting is only 1 sound even if I click 2 or more boxes. The script is

if the hilite of button "EnglishLang"is true then
put specialFolderPath("engine") & "/soundwavs/Bell.mp3" into tSndPath
play tSndPath
end if
if the hilite of button "FrenchLang" is true then
put specialFolderPath("engine") & "/soundwavs/Bugle.mp3" into tSndPath
play tSndPath
end if
if the hilite of button "SpanishLang" is true then
put specialFolderPath("engine") & "/soundwavs/Bird.mp3" into tSndPath
play tSndPath
end if
if the hilite of button "IndonesianLang" is true then
put specialFolderPath("engine") & "/soundwavs/Banjo.mp3" into tSndPath
play tSndPath
end if

Regards
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Want to check more than 1 checkbox.

Post by Simon »

Hi,
Are you asking to play Bell and Bugle at the same time? Or any combinations of your sounds?
Because that is what you've asked, but not what you coded.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
abanowBUSTfGf
Posts: 63
Joined: Sat Dec 22, 2012 3:01 am

Re: Want to check more than 1 checkbox.

Post by abanowBUSTfGf »

Hi Simon yes I want all the selected sounds to play in sequence
But somehow they don't - just 1 plays
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Want to check more than 1 checkbox.

Post by Klaus »

Still no look into the "Release Notes"? 8)
----------------------------------------------------------
play soundFile [ looping ]
Executing such a command will first stop any currently playing sound, and then attempt to load the given sound file.
----------------------------------------------------------
"play" will one play ONE sound at a time, and that is the reason why you will only hear one sound and that is the one
of the last checked checkbox!

You could "collect" all sounds in a list, "queue" them and then use "mobilePlaySoundOnChannel sound, channel, type"
to play them one after another.
abanowBUSTfGf
Posts: 63
Joined: Sat Dec 22, 2012 3:01 am

Re: Want to check more than 1 checkbox.

Post by abanowBUSTfGf »

I am new to Livecode. What is the easiest way to play four MP3 sound files one after the next
perhaps with a 1second interval between them?

The sounds as follows play fine individually:

put specialFolderPath("engine") & "/soundwavs/Bird.mp3" into tSndPath
play tSndPath
put specialFolderPath("engine") & "/soundwavs/Cat.mp3" into tSndPath
play tSndPath
put specialFolderPath("engine") & "/soundwavs/Dog.mp3" into tSndPath
play tSndPath
put specialFolderPath("engine") & "/soundwavs/Elephant.mp3" into tSndPath
play tSndPath

but I can't get them to run in sequence.
Thanks
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Want to check more than 1 checkbox.

Post by Simon »

You just need the playStopped message.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Want to check more than 1 checkbox.

Post by Klaus »

The answer can be found in the "Android/iOS Release Notes" under "Basic sound playback support"!

Code: Select all

...
repeat for each item tSound in "Bird.mp1,Cat.mp2,Toad.mp3,Dodo.mp4,Archeopterix.mp5"
  put specialFolderPath("engine") & "/soundwavs/" & tSound) into tSndPath
  play tSndPath

  ## !!!
  wait until the sound = "done"
end repeat
...
Did I mention already that the "Release Notes" are better than their reputation? 8)
So it is not a bad idea to look up one thing or another there...
Post Reply