IDE Save
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
IDE Save
I'm confused as to how the IDE determines if a card needs to be saved when you close it or quit Rev. Here's an example.
I have a card with an option menu, a datagrid, and several other objects. When the user makes a selection from the option menu, my scripts re-populate the data in the datagrid and in the other objects on the card.
If I now click the close button for the card, I get no dialog about saving it but when I open the card again, the data in it is as it was when I closed the card. So far, so good.
If instead of closing the card, I exit Rev I do not get a Save dialog and when I open the stack again, the data in the card is what it was prior to the user making a selection from the option menu.
If I manually save the card before exiting Rev, the correct data is displayed in the card next time I open the stack.
This behavior is also present in the standalone application I build from this stack. Close the card and re-open - correct data is displayed. Exit the app and rerun - wrong data is displayed.
This feels like a bug to me but is anyone else experiencing this?
Thanks,
Pete
I have a card with an option menu, a datagrid, and several other objects. When the user makes a selection from the option menu, my scripts re-populate the data in the datagrid and in the other objects on the card.
If I now click the close button for the card, I get no dialog about saving it but when I open the card again, the data in it is as it was when I closed the card. So far, so good.
If instead of closing the card, I exit Rev I do not get a Save dialog and when I open the stack again, the data in the card is what it was prior to the user making a selection from the option menu.
If I manually save the card before exiting Rev, the correct data is displayed in the card next time I open the stack.
This behavior is also present in the standalone application I build from this stack. Close the card and re-open - correct data is displayed. Exit the app and rerun - wrong data is displayed.
This feels like a bug to me but is anyone else experiencing this?
Thanks,
Pete
Re: IDE Save
I get asked if I want to save far more often than I think necessary. If a stack doesn't put any of its scripts into use, and I don't touch anything in it (not even choosing the pointer tool and then choosing to the browse tool without touching a thing) I can open a stack and close it without being asked to save. Anything else at all and I have to dismiss the dialog. Mac OSX 10.4 on a G5, Rev 4.0.
I almost wish I could be like you, though it is safer with the way I have it.
Craig Newman
I almost wish I could be like you, though it is safer with the way I have it.
Craig Newman
Re: IDE Save
I agree, the save dialog seems to happen way too much, that's why Im never sure what is being saved and what isn't. If you change the format of card (add/delete a control) and then decide you didn;t want to do that so tell the Save dialog to discard the changes, the card is changed anyway, so some stuff is saved immediatley you make the change.... but not others! Never sure if scripts are changed when you compile them or not
In this case though, it seems to be the opposite - stuff should get saved and it doesn't. All the data on my card changes yet it doesn't get saved. I can manually save in the IDE but there is no save in a standalone app and in any case, I want the data to be saved as soon as it's changed.
Help!
Pete
In this case though, it seems to be the opposite - stuff should get saved and it doesn't. All the data on my card changes yet it doesn't get saved. I can manually save in the IDE but there is no save in a standalone app and in any case, I want the data to be saved as soon as it's changed.
Help!
Pete
Re: IDE Save
Hi Pete,
Just never trust the IDE for saving your stacks. Always save your stacks manually before closing a stack.
The IDE tries to detect user actions that change the contents of a field, such as clicking or typing in a field. A script is no user action and won't trigger a save dialog.
The funny thing is that if you have a standard, unlocked text field in your stack, the IDE sends a message to make sure that it gets focus, but this message also makes the IDE think that the field changed. This happens when you close your stack (possibly only on Mac OS X).
Another weird thing is that a property is set right before you save a standalone and another script checks these properties and sets a flag to indicate that the stack has been changed. The result is that RunRev almost always thinks that you changed your stack, but not always.
Best,
Mark
Just never trust the IDE for saving your stacks. Always save your stacks manually before closing a stack.
The IDE tries to detect user actions that change the contents of a field, such as clicking or typing in a field. A script is no user action and won't trigger a save dialog.
The funny thing is that if you have a standard, unlocked text field in your stack, the IDE sends a message to make sure that it gets focus, but this message also makes the IDE think that the field changed. This happens when you close your stack (possibly only on Mac OS X).
Another weird thing is that a property is set right before you save a standalone and another script checks these properties and sets a flag to indicate that the stack has been changed. The result is that RunRev almost always thinks that you changed your stack, but not always.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: IDE Save
Pete,
look at the shutDownRequest message that is sent by Rev if a quit command has been issued, then save this stack and all substacks and make shure to pass the shutDownRequest.
Look at closeStack, ditto.
If you want to save data when a field changes look at the closefield message, it is sent if a field looses focus and its content has been changed. etc. Saving intermittendly is hardly noticed by the user.
If you want to be shure that your data is saved intersperse 'save this stack' in your scripts. That is what I do in an application where I want to be shure that the data is saved even if a power failure occurs or the user force quits the program. (of course it does not save if the power is cut off or the computer crashes but up to that point)
regards
Bernd
look at the shutDownRequest message that is sent by Rev if a quit command has been issued, then save this stack and all substacks and make shure to pass the shutDownRequest.
Look at closeStack, ditto.
If you want to save data when a field changes look at the closefield message, it is sent if a field looses focus and its content has been changed. etc. Saving intermittendly is hardly noticed by the user.
If you want to be shure that your data is saved intersperse 'save this stack' in your scripts. That is what I do in an application where I want to be shure that the data is saved even if a power failure occurs or the user force quits the program. (of course it does not save if the power is cut off or the computer crashes but up to that point)
regards
Bernd
Re: IDE Save
Thanks Mark and Bernd.
I now realise why I have just noticed this problem. I am using an SQL db to store my data and due to a bug in my code, the data was being reloaded into the card from the database each time it was opened even though it was the same as when it was closed. As a result of that bug, I had been under the impression that the data in a card was automatically stored by Rev but now I've fixed the bug, I see I was wrong!
I already use the closeField message (and a couple of others, to update the database when the user changes the value in a control so I guess I can just add a save this stack to those message handlers.
I also use a lot of custom properties to store behind-the-scenes information so I guess I'll have to make sure that data gets saved also.
I wish there was some sort of auto-save property that could be associated with a stack!
Thanks,
Pete
PS Mark - was it you that responded to my question on mailing list about sending out messages to multiple objects that "subscribed" an interest? If so, did you ever find that stack? That would be very useful to me because there are times when the data displayed in a card could change while it is closed so I would need to refresh it before it opened again.
I now realise why I have just noticed this problem. I am using an SQL db to store my data and due to a bug in my code, the data was being reloaded into the card from the database each time it was opened even though it was the same as when it was closed. As a result of that bug, I had been under the impression that the data in a card was automatically stored by Rev but now I've fixed the bug, I see I was wrong!
I already use the closeField message (and a couple of others, to update the database when the user changes the value in a control so I guess I can just add a save this stack to those message handlers.
I also use a lot of custom properties to store behind-the-scenes information so I guess I'll have to make sure that data gets saved also.
I wish there was some sort of auto-save property that could be associated with a stack!
Thanks,
Pete
PS Mark - was it you that responded to my question on mailing list about sending out messages to multiple objects that "subscribed" an interest? If so, did you ever find that stack? That would be very useful to me because there are times when the data displayed in a card could change while it is closed so I would need to refresh it before it opened again.
Re: IDE Save
Who are you on the mailing list, what was the subject of the e-mail, what is the date of the message, Peter?
Mark
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: IDE Save
I think Pete is looking for the MVC primer by Mark Wieder which is on the old RevOnline (accessible with Rev 3.0 and below)
It came up on the mailing list as an example for broadcasting messages.
I upload it here since some people might not have an old version of Rev to access it. And I hope Mark Wieder does not mind.
regards
Bernd
It came up on the mailing list as an example for broadcasting messages.
I upload it here since some people might not have an old version of Rev to access it. And I hope Mark Wieder does not mind.
regards
Bernd
- Attachments
-
- MVC primer.rev.zip
- (22.86 KiB) Downloaded 279 times