Re: Debugging via tkcon [Was: Re: Dr. Dobb's Tcl-URL! - weekly Tcl news and links (Dec 10)

lvirden_at_gmail.com
Date: 12/13/04


Date: 13 Dec 2004 12:56:31 GMT


According to Frank Pilhofer <fp@fpx.de>:
: So, if I notice a bug in my code, I can fix it in an external editor,
:and hit the "Reload" button. If that bug involves the user interface,
:I hit the "Refresh" button to destroy and recreate the main toplevel
:window.
:
: For this to work,
:
:- UI setup must be done in a proc "SetupUI", rather than on "global"
: level.
:
:- Global state must be protected against "Reload", so that it is not
: re-initialized; e.g., protected by
:
: if {![info exist ::init]} {
: # initialize state
: }
: set ::init 1
:
:- There must be a proc "RebuildUI" that populates the UI from the
: global state.

You also have to make certain that you have a way to destroy anything
that the functions need to create - widgets, etc. - in a way that they
can then be recreated. But that's obvious I guess. Just not trivial.

-- 
<URL: http://wiki.tcl.tk/> MP3 ID tag repair < http://www.fixtunes.com/?C=17038 >
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:lvirden@gmail.com > <URL: http://www.purl.org/NET/lvirden/ >