How do I use a Tabbed Button???

Klaus Major klaus at major-k.de
Tue Apr 6 12:00:04 EDT 2004


Hi David,

> Hi All,
>
> Well I got my Tabbed Button Stack up and running! Many thanks to all 
> those who helped!
>
> In the end I decided to use seperate cards and a shared background 
> object - works fine - Except (why is there always *something*??!!):
>
> One of the fields that is in the Common Group is a Numeric Text Field 
> with a number associated with it. The user can change this field by 
> typing into it or they can increment/decrement it using an Arrow 
> control. However, each Card has it's own value for this field, so 
> switching between tabs loses the value.
>
> For example, on tab 1 if the user sets the value to 5 and then selects 
> tab 2, the value changes to blank.
>
> How can I maintain just one value for this field?

Set the "sharedtext" of that field to true :-)

> I am using a Library Object to increment/decrement the field and this 
> calls the closeField handler for the field in question. Could I do 
> something there. Will this work if the user types in a number?

Depends on what is in the "closefield" handler...

> I was thinking that I could copy the current value into a Global, and 
> then in the preOpenCard handler move the Global onto the field. But 
> this won't work the first time. I suppose I could set up the Global in 
> the preOpenStack handler.

On preopencard you could simply:
...
put fld "name of field of the other card" of cd x  into fld "name of 
field on this card"
## the number or name of the other card...
## no need for globals :-)

> One other thing is that this is a Numeric Only field, and if the user 
> tries to enter non-numeric characters into it, I want to beep and 
> throw away the bad characters.

Put this into the fields script...
This will limit the input to numbers only :-)

on keydown the_key
   if the_key is a number then
      pass keydown ## a number will be entered...
   else
      beep
   end if
end keydown

There is a bug in version < 2.2 that will let umlauts and accented chars
through yet... But Mac OS X only...

> Not sure what the best way to do this is? I am playing around now!

Hope that helps...

> All the Best
> Dave

Regards

Klaus Major
klaus at major-k.de
www.major-k.de



More information about the use-livecode mailing list