REALBasic Help - Apple Menu

  • Avatar

    Posted: 27 January 2002 12:09 PM

    This has been driving me nuts!!  I am somewhat new to coding, so please bear with me. (I am also a bit new to REALBasic…)

    I have the menus created for the app.

    I have the About Box created for the app.

    Now how do I map the About Box to the “About This Program” menu in the Apple Menu in REALBasic?

    I cannot find a way to bring up any coding window for the menus nor the about box.. Everything else I can.

    I am going insane!!

    Somebody please help me…..



    Remember what Obi-Wan said to Luke: “Oops! There goes your shirt!”

    Silent Hill Resorts - A forum for the intelligent, mature Silent Hill fan to visit.

  • Posted: 24 January 2002 07:28 AM #1

    I’m assuming that’s a classic app?  (bad spider, bad )

    I don’t know diddly about Real Basic, but in c that would be something like

    AppendResMenu(GetMenuHandle(mApple), 'DRVR');    /* add DA names to Apple menu */

    where mApple is a resource specified in a .r file as

    resource 'MBAR' (rMenuBarpreload{
        { mApple
    mFilemEditmYourOtherMenus};    /* menus */

    resource 'MENU' (mApplepreload{
    AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
    "About YourAppName",

    don’t know if that helps at all. 

    [edit] oops, you wanted to map a menu event to open a window… more c code… does REAL basic use a standard event loop? 

    /* Figure out that you just recieved a menubar event */
    switch ( event->what {
    case mouseDown:
    part FindWindow(event->where, &window);
                switch ( 
    part {
    case inMenuBar:                /* process a mouse menu command (if any) */
    /* Once we've got the menu command figure out if it was an apple menu about this app call. */
    void DoMenuCommand(long    menuResult)
    HiWord(menuResult);    /* use macros for efficiency to... */
    menuItem LoWord(menuResult);    /* get menu item number and menu number */
    switch ( menuID {
    case mApple:
                switch ( 
    menuItem {
    case iAbout:        /* bring up alert for About */
    itemHit Alert(rAboutAlertnil);
    /* all non-About items in this menu are DAs */
                        /* type Str255 is an array in MPW 3 */
    GetMenuItemText(GetMenuHandle(mApple), menuItemdaName);
    daRefNum OpenDeskAcc(daName);

    a lot of this code was taken straight from online apple documentation on how to make a simple app.  but again, I don’t know if any of this is even remotely applicable to REAL basic. 

    <font size=-1>[ This Message was edited by: EDGar on 2002-01-24 11:36 ]</font>


    All statements are to be taken with a grain of salt

  • Posted: 24 January 2002 07:39 AM #2

    so looking at the above code it looks like it would be nice if we could get tab stops every ~4 spaces instead of the current 8 within ubb snippets


    All statements are to be taken with a grain of salt

  • Avatar

    Posted: 24 January 2002 08:38 AM #3

    In your project window, double-click the “Menu” item.

    In the Application Menu window that opens, click on the Apple Menu and click once in the blank square that appears below. In the Properties palette, you can enter the text that will be shown for the menu item under Appearance -> Text and name the menu under ID -> Name (say, “about”).

    You can then add about.enable under the EnableMenuItems event for your main window. Also add an “about” menu handler to open the window you’ve defined as your “about window” (something like “aboutWindow.showmodal”).

    Hopefully that’s a good start.



    widgets :: music :: photos :: twitter

  • Posted: 27 January 2002 12:09 PM #4

    Create a new class. Set its super class to “Application”. Double-click it. Find the EnableMenuItems event. In it, put the line of code:

    [Name of your About menu item].enable

    Note, the name of the About menu item is the NAME property, the first property in the property window, not the text that appears in the menu item.

    Now, add a new menu handler (I think that’s in the Edit menu) for your menu item. In it, put the line of code:

    [Name of your About window].show

    If your about box is a dialog box, then the line should say “showModal” instead of “show.”

    Again, when I refer to the “name” of the something, I mean the first property in the Property window, and in the case of a window and a few other types of objects, the text that actually shows in the Project window.

    Hope this helps.