Re: setEnable MENU

new topic     » goto parent     » topic index » view thread      » older message » newer message

Vlado Kusnirak wrote:
> 
> Derek Parnell wrote:
> > 
> > Vlado Kusnirak wrote:
> > > 
> > > Hello,
> > > 
> > > is it possible to disable Menu with command setEnable in Win32lib? 
> > > I can disable menuItem, but no Menu. I tried it with arwen and it worked.
> > > 
> > 
> > I've found a solution ( I think).
> > 
> > You need to make a small change to the setEnable() routine inside
> > win32lib.ew.
> > 
> > Replace
> > 
> >   if w32Func( xEnableMenuItem, {
> >         lHandle,        -- menu handle
> >         id,                     -- id
> >         flag} )= #FFFFFFFF      -- enable/disble
> >   then
> > 
> > 
> > with 
> > 
> >   if w32Func( xEnableMenuItem, {
> >         lHandle,        -- menu handle
> >         w32iff(ctrl_Family[id]=MENU, ctrl_Menu[id][3],id),
> >         flag} )= #FFFFFFFF      -- enable/disble
> >   then
> > 
> 
> Hmm...it doesn't work. I have version 0.60.6 of WinLib. There is a code...
> 
> }}}
<eucode>
> include win32lib.ew
> 
> without warning
> atom void
> 
> 
> constant win_title = "Demonstration of Menu features in ARWEN"
> constant CHECKSUBMENU = {"Check SubMenu", "Uncheck SubMenu"}
> 
> constant DEMO = create(Window,  win_title, 0, 0, 10,10,650,350)
> 
> constant MENU = create(Menu, "&A Menu" , 0, DEMO, 0,0,0,0)
> 
> constant MENU1 = create(MenuItem,  "&These are" , 0, MENU, 0,0,0,0)
> constant MENU2 = create(MenuItem,  "t&ypical" , 0, MENU, 0,0,0,0)
> void =  create(MenuItem, "-" , 0, MENU, 0,0,0,0)
> constant MENU3 = create(MenuItem,  "menu" , 0, MENU, 0,0,0,0)
> constant MENU4 = create(MenuItem,  "entries" , 0, MENU, 0,0,0,0)
> void =  create(MenuItem,  "-" , 0, MENU, 0,0,0,0)
> constant MENU5 = create(MenuItem,  "[ Exit ]" , 0, MENU, 0,0,0,0)
> 
> openWindow(DEMO, 0)
> 
> setEnable(MENU, w32False)
> setEnable(MENU1, w32False)
> 
> WinMain(DEMO, SW_NORMAL)
> 
> </eucode>
{{{


And it couldn't work:
<MSDN>
An application must use the MF_BYPOSITION flag to specify the correct menu 
handle. If the menu handle of the menu bar is specified, the top-level menu 
item (an item in the menu bar) is affected. To set the state of an item in 
a pop-up or nested pop-up menu by position, an application must specify the 
handle of the pop-up menu. 
</MSDN>

In the mods I'm working on, I changed a few "by command" actions to 
"by position" ones, because they wouldn't work on pop up menus, but only on 
menu items (because menus have no id). Note that getMenuPosn() has the same 
problem, for the same reason.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu