Re: Exact number of a radio button in a group

2009-10-25 Thread Richmond Mathewson

tareq_tawaiha wrote:

This might be a simple question. I have 4 buttons in a group. Each buttons
name and label are similar for that button. If i edit the group then select
a button and check its Size and position in the property inspector , at
the end of the inspector there is a field called number, is there a way to
use that number in a script ? 


I have made sure that for all the buttons in my group (top to bottom) the
number of the buttons are  (1, 2 , 3, 4) (In the picture i attached , if i
inspect button simple it is one , button colorful it is 2 see attached
picture). 


 I want to be able to assign a letter (A,B, C and D) for every button when
selected. If a user selects colorful then i want to put b. I could use a
switch statement IF i could get that assigned number . 

I use this code , its not working ( any other way of doing this ?) 


on mouseDown
   get the  hilitedButtonName of me 
   put it into bname

   put bname
   
   get the number of button bname

   put it into X

switch X

case 1 
put A
break 

case 2 
put B


case 3
put C
http://www.nabble.com/file/p26050917/Picture%2B1.png 
case 4

put D

end switch 


end mouseDown
  

What an incredibly complicated way of doing things!!

I made a stack with a copy of your group and put these scripts into
buttons simple, colorful, large and visible respectedly:

on mouseUp
  put a into fld fOUTPUT
end mouseUp

on mouseUp
  put b into fld fOUTPUT
end mouseUp

on mouseUp
  put c into fld fOUTPUT
end mouseUp

on mouseUp
  put d into fld fOUTPUT
end mouseUp

no stress, no mess!

Love, Richmond.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Exact number of a radio button in a group

2009-10-25 Thread tareq_tawaiha


That would be GREAT if i had 1 group , but i have over 80 groups, each group
has 4 possible answers (radio buttons). That would mean i would have to go
into every button's script and add that script. Which could be my last
resort , but i would prefer to edit 80 groups , instead of over 300 buttons
. Is there away to control it from the group itself instead of editing every
button ?







Richmond Mathewson-2 wrote:
 
 tareq_tawaiha wrote:
 This might be a simple question. I have 4 buttons in a group. Each
 buttons
 name and label are similar for that button. If i edit the group then
 select
 a button and check its Size and position in the property inspector , at
 the end of the inspector there is a field called number, is there a way
 to
 use that number in a script ? 

 I have made sure that for all the buttons in my group (top to bottom) the
 number of the buttons are  (1, 2 , 3, 4) (In the picture i attached , if
 i
 inspect button simple it is one , button colorful it is 2 see
 attached
 picture). 

  I want to be able to assign a letter (A,B, C and D) for every button
 when
 selected. If a user selects colorful then i want to put b. I could
 use a
 switch statement IF i could get that assigned number . 

 I use this code , its not working ( any other way of doing this ?) 

 on mouseDown
get the  hilitedButtonName of me 
put it into bname
put bname

get the number of button bname
put it into X

 switch X

 case 1 
 put A
 break 

 case 2 
 put B

 case 3
 put C
 http://www.nabble.com/file/p26050917/Picture%2B1.png 
 case 4
 put D

 end switch 

 end mouseDown
   
 What an incredibly complicated way of doing things!!
 
 I made a stack with a copy of your group and put these scripts into
 buttons simple, colorful, large and visible respectedly:
 
 on mouseUp
put a into fld fOUTPUT
 end mouseUp
 
 on mouseUp
put b into fld fOUTPUT
 end mouseUp
 
 on mouseUp
put c into fld fOUTPUT
 end mouseUp
 
 on mouseUp
put d into fld fOUTPUT
 end mouseUp
 
 no stress, no mess!
 
 Love, Richmond.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution
 
 

-- 
View this message in context: 
http://www.nabble.com/Exact-number-of-a-radio-button-in-a-group-tp26050917p26051143.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Exact number of a radio button in a group

2009-10-25 Thread Richmond Mathewson

tareq_tawaiha wrote:

That would be GREAT if i had 1 group , but i have over 80 groups, each group
has 4 possible answers (radio buttons). That would mean i would have to go
into every button's script and add that script. Which could be my last
resort , but i would prefer to edit 80 groups , instead of over 300 buttons
. Is there away to control it from the group itself instead of editing every
button ?

  
I am sorry I took so long: after about 9 years with Runtime Revolution I 
have

never really worked with groups before . . .   :)

Try this:

on mouseUp
  if the mouseLoc is within the rect of btn 1
 then
 put a into fld fOUTPUT
  end if
   if the mouseLoc is within the rect of btn 2
 then
 put b into fld fOUTPUT
end if
   if the mouseLoc is within the rect of btn 3
 then
 put c into fld fOUTPUT
  end if
   if the mouseLoc is within the rect of btn 4
 then
 put d into fld fOUTPUT
 end if
end mouseUp

It works !

Love, Richmond.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Exact number of a radio button in a group

2009-10-25 Thread Terry Judd
What about using custom properties? You would set a property (e.g. CID) for
each of the four buttons in a group to A, B, C or D and then use a script in
the group something like this...

on mouseUp
  if the cID of the target = B then
doStuff
  end if
end mouseUp

...to react when the user clicked the correct answer.

This way you could simply copy and paste your group to create a new set of
options, change the labels of the buttons to whatever you wanted and only
have a single script to deal with for each group.

Alternatively, you could use a single handler in all groups to catch the
group name and the button property and pass these to a stack handler that
deals with all you groups...

on mouseUp
doStuff (the short name of the owner of the target),(the cID of the
target)
end mouseUp

And then in the stack script...

on doStuff grpName,btnID
  switch grpName
case someGrp
  if btnID = B then...
  break
case someOtherGrp
 if btnID = D then...
 break
  end switch
end doStuff

Or you could use a behaviour.

HTH,

Terry...


On 26/10/09 6:19 AM, tareq_tawaiha tareq_tawa...@yahoo.com wrote:

 
 
 This might be a simple question. I have 4 buttons in a group. Each buttons
 name and label are similar for that button. If i edit the group then select
 a button and check its Size and position in the property inspector , at
 the end of the inspector there is a field called number, is there a way to
 use that number in a script ?
 
 I have made sure that for all the buttons in my group (top to bottom) the
 number of the buttons are  (1, 2 , 3, 4) (In the picture i attached , if i
 inspect button simple it is one , button colorful it is 2 see attached
 picture). 
 
  I want to be able to assign a letter (A,B, C and D) for every button when
 selected. If a user selects colorful then i want to put b. I could use a
 switch statement IF i could get that assigned number .
 
 I use this code , its not working ( any other way of doing this ?)
 
 on mouseDown
get the  hilitedButtonName of me
put it into bname
put bname

get the number of button bname
put it into X
 
 switch X
 
 case 1 
 put A
 break 
 
 case 2 
 put B
 
 case 3
 put C
 http://www.nabble.com/file/p26050917/Picture%2B1.png
 case 4
 put D
 
 end switch 
 
 end mouseDown

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Exact number of a radio button in a group

2009-10-25 Thread tareq_tawaiha

It works

Thanks !! 





Richmond Mathewson-2 wrote:
 
 tareq_tawaiha wrote:
 That would be GREAT if i had 1 group , but i have over 80 groups, each
 group
 has 4 possible answers (radio buttons). That would mean i would have to
 go
 into every button's script and add that script. Which could be my last
 resort , but i would prefer to edit 80 groups , instead of over 300
 buttons
 . Is there away to control it from the group itself instead of editing
 every
 button ?

   
 I am sorry I took so long: after about 9 years with Runtime Revolution I 
 have
 never really worked with groups before . . .   :)
 
 Try this:
 
 on mouseUp
if the mouseLoc is within the rect of btn 1
   then
   put a into fld fOUTPUT
end if
 if the mouseLoc is within the rect of btn 2
   then
   put b into fld fOUTPUT
 end if
 if the mouseLoc is within the rect of btn 3
   then
   put c into fld fOUTPUT
end if
 if the mouseLoc is within the rect of btn 4
   then
   put d into fld fOUTPUT
   end if
 end mouseUp
 
 It works !
 
 Love, Richmond.
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution
 
 

-- 
View this message in context: 
http://www.nabble.com/Exact-number-of-a-radio-button-in-a-group-tp26050917p26051662.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution