[futurebasic] Re: Overflowing Font Menu problem

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2002 : Group Archive : Group : All Groups

From: Ken Shmidheiser <k.shmidheiser@...>
Date: Sat, 19 Jan 2002 14:27:08 -0500
Robert asked:

> sing the below code when building my dialog for a text entry window and
> popup menus, I get a nice font menu (resource menu, id is _FontPopup)
> ...the first time.
>
>
>
> Problem is that if I close the dialog window , and then open it again, 
> the
> font menu is double filled now, with the list appearing twice. If I 
> close
> the dialog, then open again, now I have 3 head to tail lists of the 
> fonts
> in the same one menu. So if the font list should be 20 items, it is now 
> 60,
> 3 repeats of the same 20 fonts.
>
> ?
>
> What disposing or other handling is called for to make this behave?
>
> Is it getting (re)built on top of itself on subsequent dialog openings?

Robert,

Not necessarily an answer, but try playing with these prior to the next 
menu rebuild and see what happens.

Ken

'~'2
LOCAL FN DisposeFontMenu
gFontPopHndl& = FN GETMHANDLE(_FontPopup)
CALL DELETEMENU(_FontPopup) 'delete name from menu bar
CALL DISPOSEMENU(gFontPopHndl&)'dispose of old menu to build another
END FN
'~'2

'~'2
LOCAL FN EmptyMenuForRebuild
DIM AS INT i, mItems

gFontPopHndl& = FN GETMHANDLE(_FontPopup)
        mItems = FN CountMenuItems (gFontPopHndl&)

FOR i = 1 TO mItems'should leave menu title only
DeleteMenuItem (gFontPopHndl&,mItem)
NEXT i

END FN
'~'2