1. setEnable MENU
- Posted by Vlado Kusnirak <daduko at great.sk> Feb 12, 2007
- 492 views
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. Thanks Vlado
2. Re: setEnable MENU
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 12, 2007
- 475 views
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 -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
3. Re: setEnable MENU
- Posted by Vlado Kusnirak <daduko at great.sk> Feb 12, 2007
- 483 views
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...
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)
4. Re: setEnable MENU
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Feb 12, 2007
- 473 views
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
5. Re: setEnable MENU
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 12, 2007
- 463 views
Vlado Kusnirak wrote: > > Hmm...it doesn't work. I have version 0.60.6 of WinLib. There is a code... Does for me. I ran your code verbatim and the "A Menu" was disabled. You can use the win32lib.ew that I used http://www.users.bigpond.com/ddparnell/win32lib.ew -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
6. Re: setEnable MENU
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 12, 2007
- 472 views
CChris wrote: > And it couldn't work: And yet it does. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
7. Re: setEnable MENU
- Posted by ZNorQ <znorq at holhaug.com> Feb 12, 2007
- 468 views
Derek Parnell wrote: > > Vlado Kusnirak wrote: > > > > > Hmm...it doesn't work. I have version 0.60.6 of WinLib. There is a code... > > Does for me. I ran your code verbatim and the "A Menu" was disabled. > > You can use the win32lib.ew that I used > > <a > href="http://www.users.bigpond.com/ddparnell/win32lib.ew">http://www.users.bigpond.com/ddparnell/win32lib.ew</a> > Derek, Are there major changes in this version compared to 0.60.6? > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell
8. Re: setEnable MENU
- Posted by Vlado Kusnirak <daduko at great.sk> Feb 12, 2007
- 460 views
Derek Parnell wrote: > > Vlado Kusnirak wrote: > > > > > Hmm...it doesn't work. I have version 0.60.6 of WinLib. There is a code... > > Does for me. I ran your code verbatim and the "A Menu" was disabled. > > You can use the win32lib.ew that I used > > <a > href="http://www.users.bigpond.com/ddparnell/win32lib.ew">http://www.users.bigpond.com/ddparnell/win32lib.ew</a> > > Thank you very much. It works now. Vlado
9. Re: setEnable MENU
- Posted by c.k.lester <euphoric at cklester.com> Feb 12, 2007
- 488 views
Derek Parnell wrote: > You can use the win32lib.ew that I used > <a > href="http://www.users.bigpond.com/ddparnell/win32lib.ew">http://www.users.bigpond.com/ddparnell/win32lib.ew</a> > Derek, your version doesn't have getTVChildren(). It's in my win32lib as modified by Sascha Zindel and Derek Parnell. Here's the added code in my version. Maybe you can add it to yours...? --BEG CJT01 ----------------------------------------------------------------------------- --/topic Tree View Control --/func deleteTVChildren( TheTreeView, position ) --/desc Deletes all children at "position" in the /i tree view. -- -- Example: --/code -- atom position -- position = getTVIndex(TheTreeView) -- /deleteTVChildren( TheTreeView, position ) --/endcode global procedure deleteTVChildren( atom id, integer pos ) atom iItem -- Is a treeview? if ctrl_Type[ id ] = TreeView then -- take care of any children iItem = find(pos, tvitem_parent) while iItem do VOID = deleteItem( id, iItem ) iItem = find(pos, tvitem_parent) end while end if end procedure ----------------------------------------------------------------------------- --/topic Tree View Control --/func getTVChildren( TheTreeView, position ) --/desc Returns all child items for the passed item in the /i tree view. -- -- Example: --/code -- atom position -- sequence children -- -- position = getTVIndex(TheTreeView) -- children = /getTVChildren( TheTreeView, position ) --/endcode global function getTVChildren(atom id, integer pos) sequence children children = {} -- Is a treeview? if ctrl_Type[ id ] = TreeView then -- take care of any children for i = 1 to length(tvitem_parent) do if tvitem_owner[i] = id and tvitem_parent[i] = pos then children &= i children &= getTVChildren(id, i) end if end for end if return children end function --END CJT01
10. Re: setEnable MENU
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Feb 12, 2007
- 491 views
- Last edited Feb 13, 2007
Derek Parnell wrote: > > CChris wrote: > > > And it couldn't work: > > And yet it does. > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell Interesting, because I had the same problem as Vlado. And I cant remember any note about this popup menu id issue being diffrent across OS versions... CChris