[futurebasic] Re: [FB] Enable - disable NIB menu

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

From: Robert Purves <listrp@...>
Date: Thu, 24 Sep 2009 09:21:28 +1200
Piet wrote:

> The enabling or disabling is working now with these fn’s
> err = fn GetIndMenuItemWithCommandID( 0,_"fil1", 1, @mR,  
> @mI ):DisableMenuItem( mR, mI )
> err = fn GetIndMenuItemWithCommandID( 0,_"fil2", 1, @mR,  
> @mI ):DisableMenuItem( mR, mI )
> ....
>
> But is there a possibillity to pass the NIB identifiers _"fil1",   
> _"fil2",...   to a litlle short fn by some type of variable
> Something like : fn enable ("fil1") and fn disable ("fil1"),...
> “dos1” will then comes then in the fn like a string -> can be made  
> _”fil1” again of it or can it be called in anothers way ?
> To make work the function
> err = fn GetIndMenuItemWithCommandID( 0, ..... , 1, @mR,  
> @mI ):DisableMenuItem( mR, mI )
>
> In fact :  can    _"fil1"   be token over by some type of variable   
> to transport is to a FN ?


local fn Enable( cmd as MenuCommand )
'~'1
dim as OSStatus       err
dim as MenuRef        mR
dim as MenuItemIndex  mI
err = fn GetIndMenuItemWithCommandID( 0, cmd, 1, @mR, @mI )
if ( err == _noErr ) then EnableMenuItem( mR, mI )
end fn


fn Enable( _"fil1" )


Robert P.