PopUpMenu: Dynamical update of title

Dear All,

after the fast solution given by hrodstein I hope you can help me again.

Now I want to create a PopupMenu with the title should be displayed inside the popup menu (mode = 0)- just for saving space-. The disadvantage of this is that the user cannot see his choosen element therefore I like to display this as a new title:

PopUpMenu PopCom, mode = 0, title = root:choosedComPort, value = getComPortList(), proc = titlePopUp

and the procedure looks like that:

Function titlePopUp(PU_Struct) : PopupMenuControl
STRUCT WMPopupAction &PU_Struct
SVAR choosedComPort = root:choosedComPort
choosedComPort = PU_Struct.popStr
DoUpdate/W=PemControl
print "updated"
End

But, I don't no why, the title is not updated although the global variable "choosedComPort" is changed.

Thanks a lot, again.
This:
PopUpMenu PopCom, mode = 0, title = root:choosedComPort
sets the title to the value of the referenced global string at the time it is executed. It does not establish a permanent connection.

In your titlePopUp function reexecute the PopupMenu title= command to change the title.


Thanks hrodstein,

it works very well:). How could you know that there is no permanent connection?
I used "ModifyControl PopCom title = choosedComPort" to reexecute the title.

By the way, do you know if there a bug with the radio button? If I use the normal checkBox you can able/disable the box by just clicking the mouse if I use instead the radio button (mode = 1) this is not possible.

Thanks again and have a nice evening
Quote:
How could you know that there is no permanent connection?


Most commands evaluate their parameters at execution time, use the resulting value, and do not retain any connection to the original expression from which the value came. A very small number establish a connection. Usually the documentation will make it clear if it is the latter case.

Quote:
By the way, do you know if there a bug with the radio button? If I use the normal checkBox you can able/disable the box by just clicking the mouse if I use instead the radio button (mode = 1) this is not possible.


I'm not sure. Radio buttons are intended to come in groups with one of the buttons in the group on at any given time. I would need a simple but complete example to give a more specific answer.
Hello hrodstein,

I attached a very basic example. In this, a normal checkbox and a radio button is shown. By clicking the left mouse button you can activate/deactive the checkbox instead the radio button is always activated after one click. I did not find any way to reexecute the value although this value is already changed in the data browser and he command "ModifyControl" does not support this operation and also "DoUpdate" doesnt help.
Also I couldnt find how to change the color of the radio button.

Thanks,
CheckBoxTest.ipf (581 bytes)
I believe the answer is that clicking a radio button is supposed to always turn it on. That's how radio buttons work. A group of radio buttons is a one-of-many control.

See the help under Checkbox starting with this sentence:

Quote:
When using radio button controls, it is the responsibility of the Igor programmer to turn off other radio buttons when one of a group of radio buttons is pressed.


Because clicking a radio button always turns it on, Igor does not call your hook function if you click a radio button that is already on. (I verified that using the debugger.) Consequently you can not achieve what you apparently want - a single on/off radio button - using a checkbox control. If you really want that you will need to use a custom control.