[futurebasic] Re: [FB] pop-up menus

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2000 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Fri, 29 Sep 2000 15:34:05 -0700
Hi Eric,

The RefCon is the Menu ID number times 65536.

Sorry, as soon as I sent the last eMail, I knew you'd have this question.

Joe Wilkins

Eric Parks wrote:

> I changed the RefCon to 720896 (from 655360) for MENU ID = 11 as suggested
> by Joe and it worked just fine.  However, I really need 4 pop-up menus and I
> have no idea where the number 720896 came from.  How do I get the right no.
> for the next two pop-up menus.  Thanks for your help!
>
> I also tried Chris's suggestion of adding a CALL SETCREFCON(cntrlH&,menuResID%)
> after the GETNEWCONTROL call, but then it didn't recognize any of the ID's
> and the program just quit once.
>
>             Eric
>
> >Hi Eric,
> >
> >In your CNTL Resources, you should have:
> >
> >For the Menu ID 11:
> >
> >Min. 11
> >ProcID 1008
> >RefCon 720896
> >Title "WhateverItsNameIs"
> >
> >I think this is where your problem is.  I'll bet your RefCon Number is 655360.
> >
> >Joe Wilkins
> >
> >PS  --  If Ken S. hadn't worked this out as a Demo for "the Book" I'd be lost
> >too.
> >
> >Eric Parks wrote:
> >
> >> I am trying to get two popup menu's in a window and while the
> >> following program does do that and selects the correct item in
> >> each popup menu, it always comes back in the doDialog function
> >> with the same button ID, i.e., 10, the ID of the _first_ popUp
> >> menu, independent of which popUp was clicked.  The resource file
> >> has two menus (ID's 10 and 11) and two CNTL resources (ID's 10 and 11).
> >> Why do I always get 10 for the _btnClick ID?  Pop-up menus are new
> >> to me.  Any help would be appreciated.
> >>
> >>     Eric
> >>
> >> RESOURCES "popUp.rsrc"
> >>
> >> Begin GLOBALS
> >> DIM gProgramEnds% AS INT
> >> END GLOBALS
> >>
> >> LOCAL FN newPrefItem$                     'Standard popup function
> >> dim pref&;0,menuID%, itemID%
> >> pref& = fn menuchoice
> >>   mHndl&= FN GETMHANDLE(menuID%)
> >>   LONG IF mHndl& > 0
> >>     CALL GETITEM(mHndl&,itemID%,item$) 'get the name of the current value
> >>   END IF
> >> END FN = item$
> >>
> >> LOCAL FN popUpMenu(menuResID%)            'Standard popup function
> >>   wndH&=WINDOW(_wndPointer)
> >>   LONG IF wndH&>0
> >>     cntrlH&=FN GETNEWCONTROL(menuResID%,wndH&)
> >>   END IF
> >> END FN
> >>
> >> LOCAL FN buildWnd
> >>   WINDOW #1,"PopUp Menu Demo",(0,0)-(300,100),_docNoGrow
> >>   MENU 1,0, _enable, "File"
> >>   MENU 1,1, _enable, "/QQuit"
> >>   EDIT MENU 2
> >>
> >>   MENU 10,-2,_enable,"Item List"
> >>   FN popUpMenu(10)
> >>   menu 11,-2,_enable,"New List"
> >>   fn popUpMenu(11)
> >>   TEXT _geneva, 11
> >>   EDIT FIELD 1,"",(20,70)-(60,84),_statFramed,_centerJust
> >>   EDIT FIELD 2,"",(120,70)-(160,84),_statFramed,_centerJust
> >> END FN
> >>
> >> local
> >> DIM evnt% as INT
> >> DIM id% as INT
> >> LOCAL FN doDialog
> >>   evnt% = DIALOG(0)
> >>   id% = DIALOG(evnt)
> >>
> >>   SELECT evnt%
> >>     CASE _btnClick
> >>       SELECT id%
> >>         CASE 10                      'popUp menu 10
> >>           item$ = FN newPrefItem$
> >>           edit$(1) = item$
> >>         CASE 11                      'popUp menu 11
> >>           edit$(2) = item$
> >>           item$ = fn newPrefItem$
> >>      END SELECT
> >>    CASE _wndClose
> >>      gProgramEnds = _true
> >>    CASE _wndRefresh
> >>    END SELECT
> >>
> >> END FN
> >>
> >> LOCAL FN doMenu
> >>   gProgramEnds = _true
> >> END FN
> >>
> >> '------------Main-------------------------
> >> ON DIALOG FN doDialog
> >> on menu fn doMenu
> >> FN buildWnd
> >>
> >> DO
> >>    HANDLEEVENTS
> >> UNTIL gProgramEnds%
> >>
> >> --
> >> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
> >
> >
> >--
> >To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
>
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>