Refreshing a card

Mark Smith Mark_Smith at cpe.umanitoba.ca
Mon Nov 8 23:54:46 EST 2010



Monte Goulding wrote:
> 
>> 
> 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.
> 
> 

Hi Monte, 

You've definitely provided some homework there as I have not looked at
setprop yet. Interesting you should mention the background issue because
basically everything on my card is in the background (its a simple notepad
app, gee... I wonder how many of those have been created!). So every element
of the UI shows up on every new card. I thought some people might like to
see the date the note/notes were made although personally it drives me batty
seeing the date so I decided to create the menu Option called "Toggle Date
Stamp" (actually originally I wanted to make the menu item dynamic so that
if it was in the "show" state it would say "Hide Date Stamp" and if it was
in the "hidden" state it would say "Show Date Stamp" but my
transcript/livecode (I'm still using 4.5.0 dp 3) skills are not yet there so
the simplest solution was to have a static menu item that conveyed the same
sense of choice so "Toggle Date Stamp" it is. The datestampfield is in the
background. The datestamp (value) is a custom property. Datestamp gets
stored in the datestampfield (now automatically) each time a card or note is
created/accessed. The question becomes, if I am going to toggle it on/off I
need to know what state of visibility it is in now. That state of visibility
(called showdatestamp) is stored as another custom property with values of
true/false. When I first implemented the menu code that does the toggling:

         set the showDateStamp of this stack to not the showDateStamp of
this stack

that would change the value of showdatestamp (the flag) reliably, but had no
effect on the actual field called datestamp. Connecting those two pieces up
was the challenge which "set the visible of fld "datestamp" to the
showdatestamp of this stack" accomplished. It is still not reliably 100%
clear in my mind but I guess the more you work with it the more ingrained it
becomes. 

I appreciate all of the feedback I have been getting here so thanks for the
reply.... and the homework :-)

-- Mark
 
-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Refreshing-a-card-tp3021743p3033072.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list