Refreshing a card

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Refreshing a card

Mark Smith
Hello all, by now most of you are probably familiar with my silly questions (born of, I am afraid, too many years engrossed in procedural programming languages). Here we go. I have a menu option called "Toggle Date Stamp" and it toggles on/off the display of a date stamp on the card. When you select it you might expect that the card goes from displaying the date stamp to not displaying the date stamp ad infinitum. Not so. In fact nothing changes. If I move off the card and then back on I see the correct behaviour but not while I am actually on the card (or any card). I am guessing that in the Toggle Date Stamp menu code (below) I need to send a message to the card to "refresh" itself. But what message?

 case "Toggle Date Stamp"
         set the showDateStamp of this stack to not the showDateStamp of this stack
         -- insert some message to get the current card to "redisplay" itself
         break
   end switch

(Note, yes the showDateStamp property is in the stack because it effects the behaviour of all of the cards, not particular ones. Hopefully I've got that bit of logic right :-)

Thanks for your patience,

-- Mark
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a card

Terry Judd
Mark - if you want to do a general refresh the card then just call openCard
in your handler. If all you want to do is refresh the date stamp object then
add something like...

Set the visible of grp/fld/whatever "dateStamp" to the showDateStamp of this
stack

...to your case statement

HTH,

Terry...


On 1/11/10 2:52 PM, "Mark Smith" <[hidden email]> wrote:

>
> Hello all, by now most of you are probably familiar with my silly questions
> (born of, I am afraid, too many years engrossed in procedural programming
> languages). Here we go. I have a menu option called "Toggle Date Stamp" and
> it toggles on/off the display of a date stamp on the card. When you select
> it you might expect that the card goes from displaying the date stamp to not
> displaying the date stamp ad infinitum. Not so. In fact nothing changes. If
> I move off the card and then back on I see the correct behaviour but not
> while I am actually on the card (or any card). I am guessing that in the
> Toggle Date Stamp menu code (below) I need to send a message to the card to
> "refresh" itself. But what message?
>
>  case "Toggle Date Stamp"
>          set the showDateStamp of this stack to not the showDateStamp of
> this stack
>          -- insert some message to get the current card to "redisplay"
> itself
>          break
>    end switch
>
> (Note, yes the showDateStamp property is in the stack because it effects the
> behaviour of all of the cards, not particular ones. Hopefully I've got that
> bit of logic right :-)
>
> Thanks for your patience,
>
> -- Mark

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a card

Monte Goulding
In reply to this post by Mark Smith
Hi Mark

What do you mean by moving off the card and back on? Go to a different card of that stack or suspend and resume stack / application?

Also you may need to provide your setprop handler for this property because there's nothing wrong with your menu code.

Cheers

Monte


On 01/11/2010, at 2:52 PM, Mark Smith wrote:

>
> Hello all, by now most of you are probably familiar with my silly questions
> (born of, I am afraid, too many years engrossed in procedural programming
> languages). Here we go. I have a menu option called "Toggle Date Stamp" and
> it toggles on/off the display of a date stamp on the card. When you select
> it you might expect that the card goes from displaying the date stamp to not
> displaying the date stamp ad infinitum. Not so. In fact nothing changes. If
> I move off the card and then back on I see the correct behaviour but not
> while I am actually on the card (or any card). I am guessing that in the
> Toggle Date Stamp menu code (below) I need to send a message to the card to
> "refresh" itself. But what message?
>
> case "Toggle Date Stamp"
>         set the showDateStamp of this stack to not the showDateStamp of
> this stack
>         -- insert some message to get the current card to "redisplay"
> itself
>         break
>   end switch
>
> (Note, yes the showDateStamp property is in the stack because it effects the
> behaviour of all of the cards, not particular ones. Hopefully I've got that
> bit of logic right :-)
>
> Thanks for your patience,
>
> -- Mark
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Refreshing-a-card-tp3021743p3021743.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

RE: Refreshing a card

Mark Smith
In reply to this post by Terry Judd
Thanks Terry, the following worked beautifully..

         set the showDateStamp of this stack to not the showDateStamp of this stack
         if there is a fld "dateStampField" then
            set the visible of field "datestampfield" to the showdatestamp of this stack
         end if
         break

(I wasn't able to figure out how to use openCard in this situation but since I have a solution I'l leave that problem
for another day).

Thanks again.

-- mark
________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Terry Judd [[hidden email]]
Sent: Sunday, October 31, 2010 10:57 PM
To: How to use Revolution
Subject: Re: Refreshing a card

Mark - if you want to do a general refresh the card then just call openCard
in your handler. If all you want to do is refresh the date stamp object then
add something like...

Set the visible of grp/fld/whatever "dateStamp" to the showDateStamp of this
stack

...to your case statement

HTH,

Terry...


On 1/11/10 2:52 PM, "Mark Smith" <[hidden email]> wrote:

>
> Hello all, by now most of you are probably familiar with my silly questions
> (born of, I am afraid, too many years engrossed in procedural programming
> languages). Here we go. I have a menu option called "Toggle Date Stamp" and
> it toggles on/off the display of a date stamp on the card. When you select
> it you might expect that the card goes from displaying the date stamp to not
> displaying the date stamp ad infinitum. Not so. In fact nothing changes. If
> I move off the card and then back on I see the correct behaviour but not
> while I am actually on the card (or any card). I am guessing that in the
> Toggle Date Stamp menu code (below) I need to send a message to the card to
> "refresh" itself. But what message?
>
>  case "Toggle Date Stamp"
>          set the showDateStamp of this stack to not the showDateStamp of
> this stack
>          -- insert some message to get the current card to "redisplay"
> itself
>          break
>    end switch
>
> (Note, yes the showDateStamp property is in the stack because it effects the
> behaviour of all of the cards, not particular ones. Hopefully I've got that
> bit of logic right :-)
>
> Thanks for your patience,
>
> -- Mark

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a card

Mark Smith
In reply to this post by Monte Goulding
Hi Monte, sorry if I missed replying. The problem was that on any specific card when I selected the "toggle date stamp" menu option, visibly nothing happened. In reality the property "showdatestamp" was changing from true to false on each menu selection based on the statement:

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

but the field itself (I think I've called it the datestampfield) did not appear or disappear as one might expect.

Going from the current card (where the toggle was selected) to another card did show the desired result. ie. if you toggled the "showdatestamp" to off (or false in this case) then going to another card suppressed displaying the datestampfield. There is a line of code each time you open a card that stays


   if there is a fld "dateStampField" then
         put the dateStamp  of this card into field "dateStampField"
   end if

but what I was doing (which did not work) was trying to make it visible or not by doing something like this


   if there is a fld "dateStampField" then
         put the dateStamp  of this card into field "dateStampField"
   else
         put " " into field "dateStampField"
   end if

sort of trying to make it visible or not visible myself. I did not know about the "set the visible of..." command sequence. By adding that into the menu handler (if that is the correct term) so that it says

    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. The "mechanics" of doing it have some pieces here, some pieces there, and its not entirely clear to me how they all work together. And I guess the critical portion to understand is that there is a large junk of this visibility thing which I'm NOT doing. Now its something that reunrev handles when you set the visibility property of the field through the menu.

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.

-- Mark

Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a card

Monte Goulding
>
>
>    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_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Refreshing a card

Mark Smith
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