Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Vid / Subpanels / Dirty?

From: sanghabum::aol::com at: 31-May-2001 17:31

> As far as collecting changed fields for an update, you may wish to > peruse a thread from a few weeks ago. Although Brett's end purpose was > slightly different, in the end, he created a nifty way to collect > changed data and to capture for an inadvertantly closed dialog. You may > find some of this quite useful in order to save users from themselves > (namely, offer them a final chance to update or cancel the changes). > Just a thought.
Thanks again. I've solved the problem by adding an action to each data entry field. A (simplified) snippet of the code that build the layout reads: DataEntryFields: copy ["Name" "Age" "Favorite Poem"] foreach def DataEntryFields [ append layoutBlock to-word join "Data-" [Def ": "] append layoutBlock [Field] append layoutBlock [[Persistent-Dirty?: true]] Return ] So 'persistent-dirty? (a global variable) is set true if any field is changed. And then I can iterate around the DataEntryFields block to find the new values. What I can't do is tell which of the individual fields has changed, but I don't need that: any change will trigger the update processing. Incidentally, I don't recommend building a layout with variables directly into a block as the above example does. Returning the block from a function and then issuing the 'Layout command taught me rather more about context than I really wanted to know at the time. Code I've written today (as opposed to yesterday) builds dynamic layouts in strings. Stick a square bracket at each end and a simple 'Load will turn that into a block when needed without moaning about undefined variables. Thanks again, --Colin.