[futurebasic] Re: [FB] Check/Unchecking Menu Item

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: GBeckman@...
Date: Sun, 16 May 1999 11:22:55 EDT
Some of the guys may take issue with the below...I am sure there is a better 
way in places, however, these work and don't break...so far.  *smile*

First, it is important to note that you must be careful in your loop when 
deleting menus.  If in the delete routine below, I am deleting myMen&,1 each 
time...the first one.  Putting counter where the 1, will leave some menus 
laying around because when you delete one they all move up.  This also gets 
rid of the insert problem.

  myMen&=FN GETMHANDLE(_WhateverMenu)
  Counter= FN COUNTMITEMS(myMen&)                 'how many?
  FOR x=1 TO counter                              'better clear them
  NEXT x

then I put back the new set.  In this case I had them in an array so:

for x=1 to numberofItems
MENU _WhateverMenu,x,_enable,gMenuNames$(x)
next x

To clear the check, I clear them all and then place the check on the 
selected.  May seem like overkill, but it is quick and kept strange things 
from happening. The selected here is MenuItem%:

  FOR x=1 TO numberofMenuItems
    MENU _WhateverMenu,x,_enable                  'Clears the Checked Menu
  NEXT x

MENU _WhateverMenu,MenuItem%,_checked         'Puts The New Check

 Hope these help,