[futurebasic] Re: PopUpMenu ID Numbers

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1998 : Group Archive : Group : All Groups

From: Michael Evans <mikonic@...>
Date: Thu, 20 Aug 1998 23:15:51 -0400
>I have a project which requires more than 25 PopUp Menus. The FutureBasic
>II Program
>Generator manual indicates that you can have a maximum of 25, e.g. menu ID
>numbers
>100-125 (inclusive). Does anyone know whether this limitation has been
>taken out of
>FutureBasic 2.3.1 or a way around it. Thanks. rick

All you need is one popup menu.

For each menu, store the menu items in a separate STR# resource and build
the popup menu
on the fly  before you display it.

I suppose somebody on the FB list or Chris Stazny
 knows how to detect a click on a popup menu be fore it's displayed....
I don't know how to do this part....

The following is from a PG project of mine and has been altered
but not tested. It should give you the idea.

CLEAR LOCAL
LOCAL FN StringListToMenu(myMenu%, myStringList%)
DIM menuHandle&, menuItemCount%, theItem%, theText$
DIM myCursor%, itemCount%
DIM ResErr%, osErr%

menuHandle& = FN installPop(myMenu%)

LONG IF menuHandle&
menuItemCount% = FN COUNTMITEMS(menuHandle&)
LONG IF menuItemCount%
FOR theItem% = 1 TO menuItemCount%
CALL DELMENUITEM(menuHandle&, 1)
NEXT theItem%
END IF

itemCount% = FN countStr(myStringList%)
LONG IF itemCount%
FOR theItem% = 1 TO itemCount%
theText$ = STR#(myStringList%, theItem%)
CALL INSMENUITEM(menuHandle&, theText$, theItem%)
NEXT theItem%
END IF

'if you want to save the menu, otherwise the menu
'reverts to it's previous state before start up
'*********************
CALL CHANGEDRESOURCE(menuHandle&)
CALL UPDATERESFILE(gResRef)
'*********************

FN deletePop(menuHandle&)

END IF

END FN


I hope you find this helpful...


Cheers,

--------------------------------------------------------------
Michael Evans
Manager of Software Development
Photo Systems, Inc.
3301 Wood Valley Road, NW
Atlanta, GA 30327-1515
Office: (404) 846-9386
Fax: (404) 240-0878
Home: (404) 240-0330
E-mail: evans@..., (mikonic@...)
--------------------------------------------------------------