Some problems with background behaviour

Peter Brigham MD pmbrig at gmail.com
Thu Apr 8 11:38:22 EDT 2010


On Apr 8, 2010, at 4:12 AM, planix wrote:

> ... Unfortunately, I think the problem I have is actually that one  
> of my
> "fields" is a dropdown list- so a button. It seems that these do  
> propogate
> across all backgrounds. So, I will work on remembering the state of  
> the
> dropdown buttons for each card, setting them back to a default  
> condition
> when the card is closed, and then re-instating the state from a card
> specific custom property in a pre-open statement. This will be a lot  
> easier
> using the modular approach to groups as backgrounds.
>
> Though if someone has some example code of this sort of management  
> of button
> status I would be grateful for a link.

Try this. Put the preopencard handler in the stack script, and the  
menupick handler in your pulldown button.

on menuPick pItemName
    put the short id of of this card into cID
    put the menuhistory of me into lineNbr
    set the bValue[cID] of me to lineNbr
    set the label of me to pItemName
end menuPick

on preopencard
    put the short id of this card into cID
    put the bValue[cID] of btn "pullDown" into bVal
    if bVal = empty then
       set the label of btn "pullDown" to "choose..."
       -- or whatever, for cards where the user has
       -- not chosen a value yet
    else
       set the menuhistory of btn "pullDown" to bVal
    end if
end preopencard

I wish that it were an option in Rev to set the sharedtext (or some  
equivalent) of a pulldown/popup menu to false, so this could be done  
authmatically. Until then, the above works fine.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list