calling a section's properties window from hoc code

The basics of how to develop, test, and use models.
Post Reply
porio

calling a section's properties window from hoc code

Post by porio »

Hi,
I want to make what the subject says. I dived into the hoc files that build up the GUI and found that the "Tools > Distributed Mechanisms > Viewers > Name Values" menu calls an apparently internal function, nrnallsectionmenu().
I saved a session with the properties window and found out that there are two lines of code for each property box, making it a lot of code. I know I can copy and paste, but it will work only for a specific set inserted mechanisms.
Is there a command for invoking the Section Parameters window?

Thanks!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

how to unravel the secrets of the GUI's tools

Post by ted »

Excellent question. Instead of feeding you the answer, I will describe some of
my tactics for unraveling the secrets of NEURON's GUI tools

Tactic 1: Save the tool of interest to a session file.
This is what you did. But you found out that the parameter panel is just an xpanel--it
gives no clue to its own creation.

Tactic 2: Save the tool that creates the tool of interest to a session file.
I tried this, but the session file was basically empty (just a few "boilerplate"
statements), regardless of whether I did NEURON Main Menu / File / save session,
or instead used the PFWM to select and try to save the tool itself.

Tactic 3: Snoop around in NEURON's hoc library.
The tool's drag bar is labeled
Section Parameters (double click)
so I went to the directory that contains NEURON's library of hoc code
(/usr/local/nrn/share/nrn/lib/hoc on my Linux box, c:\nrnxx\lib\hoc under MSWin
(xx is the version number)) and searched for all files that contain the string
Section Parameters--
grep "Section Parameters" *hoc

This pointed me to shapebox.hoc

Reading through shapebox.hoc I discovered that the class definition for the
Section Parameters tool is specified in a template called MenuExplore, and
that double clicking a section causes execution of a proc called make_menu()

make_menu() in turn uses sprint() to assemble a command string that, when
execute()d, invokes nrnsecmenu()

Lo and behold, the alphabetical index of the Programmer's Reference (AKA
Documentation in the NEURON program group, under MSWin) contains
a link to the description of nrnsecmenu, which tells you exactly what you
wanted to know.

An aside for MSWin users--
c:\nrnxx\bin does contain grep.exe, which is usable from the cygwin xterm that
NEURON includes.
Post Reply