how to detect stack needs to be saved

Jan Schenkel janschenkel at yahoo.com
Mon Sep 8 13:52:01 EDT 2003


--- MisterX <x at monsieurx.com> wrote:
> That's one way but dont forget a style or a script
> or a control's rect may
> change...
> have fun
> 
> for each card
>  for each cd control
>    for each property
>  for each group
>    for each group's card
>      for each control
>        for each property
>     ...
> 

I would say it depends on the type of stack you're
building ; if you're merely trying to keep track of
whether or not the user changed some data in the
fields, it can be as simple as adding the following to
the mainStack script :
--
on closeField
  -- first determine what stack to flag
  put the long ID of the target into tTargetID
  -- the long ID of a field is of the form
  --   fld ID 123 of card ID 123 of stack "Foo" 
  --       of stack "c:\bar.rev"  [if saved to disk]
  --   fld ID 123 of card ID 123 of stack "Foo" 
  --                              [if not yet saved]
  if word -4 of tTargetID is "stack"
  then put word -3 to -4 of tTargetID into tStackRef
  else put word -2 to -1 of tTargetID into tStackRef
  -- now flag the stack as dirty
  set the uDirty of tStackRef to true
end closeField
--
Now when you can check the uDirty property of the
stack to determine if there are changes to save.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the use-livecode mailing list