Dynamic popup control

Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default Dynamic popup control

    Hello,

    Has anybody successfully created a dynamic popup menu control (ie, without relying on Menu resource) ? I have some problems with
    the following code:

    Rect controlRect = {10,10,260,300};
    ControlRef mControlRef;
    MenuRef mMenuRef;


    mControlRef=NewControl(outWindow,&controlRect,NULL ,true,0,-12345,0,kControlPopupButtonProc+kControlPopupFixed WidthVariant,(SInt32)NU
    LL);
    Boolean bCheckCurrentTag;

    CreateNewMenu((MenuID)4096,0,&mMenuRef);

    AppendMenuItemText(mMenuRef, "\pItem #1");
    AppendMenuItemText(mMenuRef, "\pItem #2");
    AppendMenuItemText(mMenuRef, "\pItem #3");

    bCheckCurrentTag=true;
    SetControlData(mControlRef,kControlEntireControl ,kControlPopupButtonMenuRefTag,sizeof(mMenuRef),&m MenuRef);
    SetControlData(mControlRef,kControlEntireControl ,kControlPopupButtonCheckCurrentTag,sizeof(bCheckC urrentTag),&bCheckCurrentTag);


    The control is properly created, the menu is properly clickable, but the control never shows the current selection : It only shows
    an empty text ??

    Is there something missing ? And how can I track when the selection change ?

    Thanks for your help,

    David


    David Scrève Guest

  2. Similar Questions and Discussions

    1. Creating a popup *custom* control
      Hi How can I create a popup custom control so it can be compiled as a dll? I think of a "MessageViewer" Custom control that opens a new browser...
    2. dynamic Popup window message
      HI, My bank has a feature I would like to implement in my site. When you pay a bill online and click 'submit' a dialog window appears asking me...
    3. Launching a popup window via dynamic text?
      Hey all, Looking for a solution to launch a popup window from a link in a dynamic text box. I'm sure this is fairly easy to do - I just can't...
    4. Javascript PopUp using Calendar Control
      How can I implement the Calendar Control in a popup Window so that when a user selects a date that the selected date is passed into a textbox on the...
    5. popup control
      I'm using dreamweavers open browser window behaviour to open a pop, and then a body onblur selfocus on the popup to keep it in the front. Its not...
  3. #2

    Default Re: Dynamic popup control

    In article <3f1fcc1f$0$15337$626a54ce@news.free.fr>,
    "David Scrève" <dscreve@clickteam.com> wrote:
    > mControlRef=NewControl(outWindow,&controlRect,NULL ,true,0,-12345,0,kControlPop
    > upButtonProc+kControlPopupFixedWidthVariant,(SInt3 2)NU
    > LL);
    > Boolean bCheckCurrentTag;
    >
    > CreateNewMenu((MenuID)4096,0,&mMenuRef);
    >
    > AppendMenuItemText(mMenuRef, "\pItem #1");
    > AppendMenuItemText(mMenuRef, "\pItem #2");
    > AppendMenuItemText(mMenuRef, "\pItem #3");
    >
    > bCheckCurrentTag=true;
    > SetControlData(mControlRef,kControlEntireControl
    > ,kControlPopupButtonMenuRefTag,sizeof(mMenuRef),&m MenuRef);
    > SetControlData(mControlRef,kControlEntireControl
    > ,kControlPopupButtonCheckCurrentTag,sizeof(bCheckC urrentTag),&bCheckCurrentTa
    > g);
    >
    > The control is properly created, the menu is properly clickable, but the
    > control never shows the current selection : It only shows
    > an empty text ??
    >
    > Is there something missing ?
    Yes.

    InsertMenu(mMenuRef, -1);
    SetControlMaximum(mControlRef, CountMItems(mMenuRef));
    > And how can I track when the selection change ?
    When you've tracked the control, call GetControlValue() to see what the
    user has selected.
    Tom Dowdy Guest

  4. #3

    Default Re: Dynamic popup control

    In article <BB4B240F9668192C1@hinton.demon.co.uk>,
    [email]hitman@spammer.deathsquad.com[/email] (Graham Hinton) wrote:
    > Following on from that, how are you supposed to find what the selection is
    > with hierarchical menus?
    > GetControlValue returns the top menu item. GetControData() does not seem to
    > have the right information anywhere.
    Hmmm, don't know this one. I've never used hierarchical menus from a
    popup. Sounds like iffy UI, but if you need to, you need to.
    > Also, how do you change a menu item in a control? I tried
    > SetMenuItemText(), but nothing changed. Does the control have its own copy?
    You *can* change the item. However, you can only do so if you have
    created and installed the menu yourself PRIOR to creation of the
    control. If you let the control load the menu resource, then yes, it
    "has a copy" (not really, but for all itents and purposes it might as
    well).
    Tom Dowdy Guest

  5. #4

    Default Re: Dynamic popup control

    In article <dowdy-342420.11325428072003@news.apple.com>,
    Tom Dowdy <dowdy@apple.com> wrote:
    >Hmmm, don't know this one. I've never used hierarchical menus from a
    >popup.
    There is an example in Appearance SDK from a bevel button, but it is all
    show and no blow.
    > Sounds like iffy UI, but if you need to, you need to.
    Better than a menu the full height of the screen...
    The iffy part is all these controls that half work and are not properly
    documented.

    >You *can* change the item. However, you can only do so if you have
    >created and installed the menu yourself PRIOR to creation of the
    >control. If you let the control load the menu resource, then yes, it
    >"has a copy" (not really, but for all itents and purposes it might as
    >well).
    Both the control and original menu are resources. Can I still have them as
    resources and satisfy that condition? ie don't have the miniumum value
    pointing to the menu and then install the menu by program?


    Graham Hinton Guest

  6. #5

    Default Re: Dynamic popup control

    In article <BB4BF4AE9668BC8D@0.0.0.0>,
    [email]hitman@spammer.deathsquad.com[/email] (Graham Hinton) wrote:
    > >You *can* change the item. However, you can only do so if you have
    > >created and installed the menu yourself PRIOR to creation of the
    > >control. If you let the control load the menu resource, then yes, it
    > >"has a copy" (not really, but for all itents and purposes it might as
    > >well).
    >
    > Both the control and original menu are resources. Can I still have them as
    > resources and satisfy that condition? ie don't have the miniumum value
    > pointing to the menu and then install the menu by program?
    Yes, however if you want to be able to change the menu contents (either
    on the fly during the dialog/window, or prior to running it) you need to
    install it yourself prior to instantiating the control.

    Actually, it doesn't matter if you have the minimum value or not. If
    the menu is already in the menu bar, the control assumes you (the app)
    are managing the content.
    Tom Dowdy Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139