Page 1 of 1

Setting limits on xvalue inputs

Posted: Tue Feb 25, 2014 1:29 pm
by Annik
I was wondering if you can set boundaries on the possible inputs to an xvalue field editor - for example I have

Code: Select all

location_paired = 0
xvalue("Location of Paired Synapses","location_paired", 1,"procedure()", 1, 1 )
and I want the only possible values to be 0, 1, 2, 3.

Alternatively, if I instead write

Code: Select all

xmenu("Location of Paired Synapses")
xradiobutton("Soma", "procedure()")
xradiobutton("Proximal Dendrite", "procedure()")
xradiobutton("Middle Dendrite", "procedure()")
xradiobutton("Distal Dendrite", "procedure()")
xmenu()
Is there a way to display the selection beside the menu?

Thanks,
Annik

Re: Setting limits on xvalue inputs

Posted: Wed Feb 26, 2014 11:23 am
by ted
1. Use radiobutton.
2. Use xvarlabel. Try this first on a toy panel.

Re: Setting limits on xvalue inputs

Posted: Sat Mar 01, 2014 2:52 pm
by Annik

Code: Select all

location_prompt = 0
xmenu("Location of Synapses")  xvarlabel(location_string) 
xradiobutton("Soma", "set_location(0)")
xradiobutton("Proximal Dendrite", "set_location(1)")
xradiobutton("Middle Dendrite", "set_location(2)")
xradiobutton("Distal Dendrite", "set_location(3)")
xmenu()
This displays the location_string below the menu button. Is there a way to get the location string to appear beside the menu button?

Re: Setting limits on xvalue inputs

Posted: Sat Mar 01, 2014 3:22 pm
by ted
Layout of an xpanel is either vertical, as in
element1
element2
etc.
or horizontal, as in
element1 element2 element3

You could create an HBox and put two xpanels in it. The first xpanel would be on the left and would contain your xradiobutton statements, and the second xpanel would be on the right and would report the location string. Example:

Code: Select all

objref hbox
hbox = new HBox()
hbox.intercept(1)
xpanel("stuff") // left panel
xradiobutton("Soma", "set_location(0)")
xradiobutton("Proximal Dendrite", "set_location(1)")
// etc.
xpanel()
xpanel("morestuff") // right panel
xvarlabel(location_string) 
xpanel()
hbox.intercept(0)
hbox.map("Specify location")