Professional Web Applications Themes

Dynamic popup control - Mac Programming

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 ...

  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. #2

    Default Re: Dynamic popup control

    In article <3f1fcc1f$0$15337$626a54cenews.free.fr>,
    "David Scrève" <dscreveclickteam.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

  3. #3

    Default Re: Dynamic popup control

    In article <BB4B240F9668192C1hinton.demon.co.uk>,
    [email]hitmanspammer.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

  4. Moderated Post

    Default Re: Dynamic popup control

    Removed by Administrator
    Graham Hinton Guest
    Moderated Post

  5. #5

    Default Re: Dynamic popup control

    In article <BB4BF4AE9668BC8D0.0.0.0>,
    [email]hitmanspammer.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

Similar Threads

  1. Creating a popup *custom* control
    By Don Huan in forum ASP.NET Building Controls
    Replies: 5
    Last Post: September 25th, 05:41 PM
  2. dynamic Popup window message
    By Mintyman in forum Dreamweaver AppDev
    Replies: 0
    Last Post: March 9th, 12:10 PM
  3. Launching a popup window via dynamic text?
    By walkskiprunglide webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: January 13th, 08:35 PM
  4. Javascript PopUp using Calendar Control
    By Stephajn Craig in forum ASP.NET General
    Replies: 3
    Last Post: July 23rd, 01:40 PM
  5. popup control
    By Getho in forum Macromedia Dreamweaver
    Replies: 2
    Last Post: July 12th, 12:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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