Empty fields and controls after testing

J. Landman Gay jacque at hyperactivesw.com
Wed Oct 26 00:09:38 CDT 2011


On 10/25/11 7:39 PM, Admin wrote:
>
> Is there a way to
> test a program and when you go back to edit mode, it initializes
> everything so that all controls are blank.
>
> As it stands now, I have to
> write a custom button that when pressed, wipes all fields/controls and
> puts them back to their empty original state. It's a pain in the
> ass.
>
> No other language I program in does this.

That's the trade-off in a language that doesn't require a compile/run 
cycle. Everything is live.

Like a lot of us, I have an initialization handler in most of my stacks. 
It's usually called in preOpenStack or preOpenCard. I make it a separate 
handler so I can also call it from the message box whenever I need to.

Another (riskier) way to handle it is to use the "revert" command in the 
message box. The Revert menu item in the File menu is similar, but adds 
a verification dialog for safety. I'm pretty used to doing this so I 
usually just type it.

Make sure that you've saved the stack in the state you want before you 
start testing, because everything you've done since the last save gets 
wiped out when the stack reverts. Keep good backups if you use this 
method. Don't use it if you have any doubts.

About that initialization handler: I learned the hard way to always 
include one. It's a long story, but I embarrassed myself. I also usually 
have a development handler that strips out all test data before building 
an app.

That's a long way of saying, I know what you mean. But for me the ease 
of development offsets the small responsibility of making sure I don't 
leave any tracks. It also helps to only have clients who think your test 
data is amusing.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list