niteshmourya / app-inventor-for-android

Automatically exported from code.google.com/p/app-inventor-for-android
Apache License 2.0
1 stars 0 forks source link

Radio button #113

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This seems like a fairly important form element that is not currently available 
in App Inventor.  I would like to see a radio button element in addition to 
check boxes.

Original issue reported on code.google.com by stevo...@gmail.com on 17 Sep 2010 at 1:08

GoogleCodeExporter commented 9 years ago
I would assume that this would include the option to group radio buttons to 
force the selection of just one radio button option.

Original comment by manny.m...@gmail.com on 19 Sep 2010 at 11:03

GoogleCodeExporter commented 9 years ago
Indeed, that would be wonderful also.

Original comment by stevo...@gmail.com on 19 Sep 2010 at 11:36

GoogleCodeExporter commented 9 years ago
Yep.  Radio button is common amongst UI designers.  However it can be achieved 
with the current implementation via a hack on the Checkbox component.

when Checkbox1.Click 
  do => 
    set Checkbox1.Value = true 
    set Checkbox2.Value = false 
    set Checkbox3.Value = false 
when Checkbox2.Click 
  do => 
    set Checkbox1.Value = false 
    set Checkbox2.Value = true 
    set Checkbox3.Value = true 
when Checkbox3.Click 
  do => 
    set Checkbox1.Value = false 
    set Checkbox2.Value = false 
    set Checkbox3.Value = true 

don't let a nonexistent component hinder you from completing your app!  :)

Original comment by pup...@gmail.com on 21 Sep 2010 at 6:42

GoogleCodeExporter commented 9 years ago
I'd sure like to see radio buttons! They are a standard input form function.

Original comment by theh...@gmail.com on 21 Sep 2010 at 6:44

GoogleCodeExporter commented 9 years ago
@pu:

Yeah, I've used that hack multiple times already.  It's handy, but I'd prefer 
radio buttons.

Original comment by stevo...@gmail.com on 21 Sep 2010 at 7:10

GoogleCodeExporter commented 9 years ago
Radio buttons are a MUST have for many applications.

Original comment by jim.stephen@gmail.com on 24 Sep 2010 at 8:44

GoogleCodeExporter commented 9 years ago
I actually tried to implement with the checkboxes but it's generating erratic 
behavior (FYI the example seems to have 2 'true' values for checkbox2 which 
shouldn't be).  Has anyone else gotten this working, or are the checkbox values 
buggy themselves?

Original comment by jmdigi...@gmail.com on 24 Sep 2010 at 9:46

GoogleCodeExporter commented 9 years ago
Actually the above implementation that I wrote up did not work (yep you're 
right, AI did something erratic with the way it handle event calls).  You need 
to make use of if-then blocks to make it successful.

Original comment by pup...@gmail.com on 24 Sep 2010 at 10:03

GoogleCodeExporter commented 9 years ago
i need too
lorenz

Original comment by lorenzo....@gmail.com on 25 Sep 2010 at 5:48

GoogleCodeExporter commented 9 years ago

Original comment by sha...@google.com on 7 Oct 2010 at 9:19

GoogleCodeExporter commented 9 years ago
The radio buttons will be a great addition!  Until then, the suggestion by 
[pup] is feasible, except that checkbox.click doesn't exist.  For a "realistic" 
radio button, try this:

when: Checkbox1.Changed 
  do => 
    if test => 
      Checkbox1.Value
    then-do =>
      set Checkbox2.Value = false 
      set Checkbox3.Value = false 
when: Checkbox2.Changed
  do =>
    if test => 
      Checkbox2.Value 
    then-do =>
      set Checkbox1.Value = false 
      set Checkbox3.Value = false 
when: Checkbox3.Changed
  do =>
    if test => 
      Checkbox3.Value
    then-do =>
      set Checkbox1.Value = false 
      set Checkbox2.Value = false

Original comment by knmb...@gmail.com on 30 Dec 2010 at 3:20

GoogleCodeExporter commented 9 years ago
Thanks for [pup] and [knmb]'s workaround, thought I encountered an error: while 
user tap on a checkbox the others are unchecked, but the one I just tapped 
still remain unchecked. So user have to tap again the same checkbox to enable 
it. Don't know if this is a bug, anyway here is my way to fix it:
(note that in actual version of Blocks Editor the Checkbox.Value seems changed 
to Checkbox.Checked, they are the same.)

when: Checkbox1.Changed 
  do => 
    if test => 
        Checkbox1.Checked = true
    then-do =>
               IF
               Checkbox2.Checked = true
               Then-do => set Checkbox2.Checked = false 

               IF
               Checkbox3.Checked = true
               Then-do => set Checkbox3.Checked = false 

Original comment by noixda...@gmail.com on 30 Jan 2011 at 5:37

GoogleCodeExporter commented 9 years ago
@Noix: The reason behind why a checkbox will stay unchecked after touching it 
is because the event for it is not .Click but rather .Changed so the checkbox 
is noticing that it's value is changing, but you still have to code it properly 
for it to actually check the box and uncheck the others.  Check out my 
"Checkboxes as radio buttons" tutorial located here: 
http://sites.google.com/site/stevozip/home/text/checkboxes

Original comment by stevo...@gmail.com on 30 Jan 2011 at 5:55

GoogleCodeExporter commented 9 years ago
@stevo: That's really amazing, thank you very much, please keep on working on 
your tutos that helps alot !

Original comment by noixda...@gmail.com on 30 Jan 2011 at 6:20

GoogleCodeExporter commented 9 years ago
Some want this to be really difficult but actually, Radio Buttons using Check 
Boxes is pretty simple. See the attached...

Original comment by tedSchwa...@gmail.com on 30 Apr 2011 at 4:56

Attachments:

GoogleCodeExporter commented 9 years ago
Some want this to be really difficult but actually, Radio Buttons using Check 
Boxes is pretty simple. See the attached...

Original comment by tedSchwa...@gmail.com on 30 Apr 2011 at 4:56

Attachments:

GoogleCodeExporter commented 9 years ago
Is there any way to code this into a reusable procedure. I can't seem to 
evaluate dynamic string variables?

Original comment by alessand...@gmail.com on 20 Jun 2011 at 7:32