find and replace script in stack
tareq_tawaiha
tareq_tawaiha at yahoo.com
Sun Oct 25 18:40:48 EDT 2009
Terry setting a custom property worked as well !
Terry Judd wrote:
>
> 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_tawaiha at 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 at 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-tp26050917p26052590.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list