Refreshing a card

Monte Goulding monte at sweattechnologies.com
Mon Nov 8 17:08:07 EST 2010


> 
> 
>    case "Toggle Date Stamp"
>         set the showDateStamp of this stack to not the showDateStamp of
> this stack
>         -- new stuff added to make it visible/invisible
>         if there is a fld "dateStampField" then
>            set the visible of field "datestampfield" to the showdatestamp
> of this stack
>         end if
> 
> works fine. Its still a bit tricky to wrap my head around this.

I think this is the simplest solution to your problem. Alternatively you could put the same code in a setprop handler in your stack script. Something like:

setprop showdatestamp pBoolean
    if there is a fld "dateStampField" then
        set the visible of field "datestampfield" to pBoolean
    end if
   pass showdatestamp
end showdatestamp

or another option would be to put this field into a background that's placed on all the cards and then you probably wouldn't need the custom property at all because showing and hiding the field would happen on all cards at the same time.

> Put another way, previously I was trying to make it appear or not by putting
> the date in the field, or a space. Now, I don't worry about it. I put the
> date in the field (if there is one) and let the "visibility" property handle
> whether it gets displayed or not.
> 
> If that makes any sense. Anyway, I appreciate your feedback.

Either way will work although using the visible property makes more sense to me. If you want to go back to your old way just change your menu code to what you have in your preopencard handler. If not you will need to change your preopencard handler to show or hide the field otherwise you will end up with a date in the field but it's not visible.

Cheers

Monte


More information about the Use-livecode mailing list