Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I make a package with one Functionnamed as IpopupMenuand also setting the Options to that function.

  (*Options for IpopupMenu*)
  Options[IPopupMenu]=
          {mouseAppearence-> LinkHand,
           pName-> "PopupMenu",
           panelPopName->True,
           pTextColor-> White,
           pTextSize-> 20,
           pImageSize-> {150,60},
           pBackground-> Black,
           pTextAlignment-> {Left,Center},
           aTextColor-> White,
           aTextSize-> 20,
           aImageSize-> {30,60},
           aBackground-> Black,
           aTextAlignment-> {Left,Center},
           menuStyle-> Directive[Bold,20,Blue],
           menuEnable-> True
           };
(*defination of IPopupMenu*)
 IPopupMenu[menuName_,menuList_,OptionsPattern[]]:=
(
 If[
    (*it cheacks wheather panelPopName=True or not?*)
    (OptionValue[panelPopName]==True),
    (SetOptions[IPopupMenu,pName->menuName]),
    (SetOptions[IPopupMenu,pName->OptionValue[pName]])
  ];
MouseAppearance[
                (

                    PopupMenu[
                            menuName,
                            menuList,
                            "",
                            Row[{
                                    Panel[
                                           Style[
                                                OptionValue[pName],
                                                Bold,
                                                OptionValue[pTextColor],
                                                OptionValue[pTextSize],
                                                FontFamily->"Helvetica"
                                                ],
                                            ImageSize->OptionValue[pImageSize],
                                            Background->OptionValue[pBackground],
                                            Alignment->OptionValue[pTextAlignment]
                                         ],
                                    Panel[
                                           Style[
                                                "\[DownArrow]",
                                                Bold,
                                                OptionValue[aTextColor],
                                                OptionValue[aTextSize],
                                                FontFamily->"Helvetica"
                                                ],
                                            ImageSize->OptionValue[aImageSize],
                                            Background->OptionValue[aBackground],
                                            Alignment->OptionValue[aTextAlignment]
                                         ]
                                }],
                            MenuStyle->OptionValue[menuStyle],
                            Enabled->OptionValue[menuEnable],
                            Appearance->None
                            ]
                ),
                OptionValue[mouseAppearence]
               ]
)

I am calling this function in two cases:

Case1:

If you can select any value from the popupMenuList,that value is visible on the PopupMenu.for this purpose,I am calling this function without mentioned option(pName,panelPopName). it's working fine.

   ghsk = "Hi";
  AssociatedPopupMenu`IPopupMenu[Dynamic[ghsk], {1, 2, 3, 4, 5, 65}]

case2:

If you can Select any value from the list,that value is not visible on the PopupMenu,but dynamically that value change,for this purpose I am calling this function with Options

ghs = "HI";
{AssociatedPopupMenu`IPopupMenu[Dynamic[ghs], {1, 2, 3, 4, 5, 65}, 
 panelPopName -> False], Dynamic[ghs]}

case 2-1 :

in the case2 code,I didn't mention the pNameoption so,pName default value only visible on PopupMenu.

case 2-2 :

If you can mention any value to pName,that value visible on PopupMenu.

case1 is working fine,case2 is not working...

I think If condiction code is wrong in my code...

can anybody help me?

share|improve this question
I did not dissect your code but since you believe the If condition is wrong, perhaps you will get a better result with OptionValue[panelPopName] === True (using SameQ) or TrueQ @ OptionValue[panelPopName]. – Mr.Wizard Jan 9 at 9:56
I tried that one also,still not get it.. – subbu Jan 9 at 10:24

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.