Closing windows programmatically
Closing windows programmatically
How can I close a GUI window (as if I hit the "close" button) programmatically?
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
destroying, unmapping, and mapping graphical objects
If you want to destroy an object, re-initialize all objrefs that point to it. Works for objects
spawned from any of NEURON's object classes, not just Graphs.
Example:
For more information about hoc's object model, see chapter 13 of The NEURON Book,
or this fragment from the old "reference manual":
http://www.neuron.yale.edu/neuron/stati ... n/obj.html
An alternative to destroying a Graph is to unmap it (in the above example, gr.unmap()).
It can then be displayed on the screen with the Graph class's view() method. Other
classes of graphical objects, e.g. VBox, have map and unmap methods. To learn more,
see the relevant entries in the Programmer's Reference.
spawned from any of NEURON's object classes, not just Graphs.
Example:
Code: Select all
objref gr
gr // hoc will print NULLobject
gr = new Graph() // creates a new Graph object and maps it to the screen
gr // this will print the "real" name of the Graph
objref gr // gr no longer points to the Graph object, which is destroyed
gr // hoc prints NULLobject again
gr = new Graph() // another new Graph object
objref foo
foo = gr // now both gr and foo reference the same Graph
objref gr // the Graph persists because foo still points to it
ojbref foo // the Graph vanishes
or this fragment from the old "reference manual":
http://www.neuron.yale.edu/neuron/stati ... n/obj.html
An alternative to destroying a Graph is to unmap it (in the above example, gr.unmap()).
It can then be displayed on the screen with the Graph class's view() method. Other
classes of graphical objects, e.g. VBox, have map and unmap methods. To learn more,
see the relevant entries in the Programmer's Reference.