On 11 Apr 2006, at 17:24, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote:
Scenario:
The application is database oriented, with the user double-clicking
on a table row to open a stack that displays all the fields,
and data related to that selected row.
The user is now on the sub-stack. If the user doesn't change
anything, and presses Esc, the sub-stack should close
with no warnings.
If the user has changed data, and then presses Esc,
I'd want to pop up an alert to the affect that they
need to save or cancel changes.
How is this done in RunRev?
This just one way.
First, you need a way to know if the user has changed data. The
details of this will depend on your stack, but let's say you maintain
a custom property that tracks whether changes have been made. So you
might have a preOpenStack handler in the stack script to initially
set the custom property to its "clean" state. Something like:
on preOpenStack
set the cDirtyState of this stack to false
end preOpenStack
Then in the places you determine that a change has been made, you
would set the custom property to true. For example, this might be in
an exitField handler in a text field.
on exitField
set the cDirtyState of this stack to true
end exitField
(But probably something more elaborate is needed, depending on your
stack.)
Then in the stack script, you could have the following handler to
catch the Escape Key.
on escapeKey
if the cDirtyState of this stack then
put "Do you want to save your changes?" into tString
answer tString with "Save" or "Don't Save"
if it is "Save" then
## do whatever you need to save the data here
else
close this stack
end if
else
close this stack
end if
end escapeKey
Cheers
Dave
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution