Re: Win32Lib: setEnable not work for top menu "objects"?

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

Dan Moyer wrote:
> 
> CChris wrote:
> > 
> > Derek Parnell wrote:
> > > 
> > > Pete Lomax wrote:
> > > > 
> > > > CChris wrote:
> <snip>
> > I've already fixed setEnable() by changing the access mode to MF_BYPOSITION.
> > 
> > CChris
> 
> CChris,
> 
> Thanks for letting me know that it is my system OS plus specific instance of
> Win32Lib 0.60.6 that makes Derek's patch not work for me.
> 
> Is your fix available as a patch, or does it have to be put into a new
> version?  I'm using the modified version of 0.60.6 that is specified for use
> with Judith's IDE, as indicated by this header:
> 
> --This is a version of win32lib v0.60.6 by David Cuny and friends that has
> been
> --modified by Sascha Zindel with corrections as posted on EuForum by Derek
> Parnell.
> --Until a newer win32lib version is released, this will be the official
> version
> for
> --use with IDE.
> 
> Seems like there are more than one or two versions of 0.60.6
> floating around.  And is there an open-source type development for
> Win32Lib now?  I looked for such through EuWiki, but didn't find anything
> that looked active.  (Just curious.)
> 
> Dan

It would be better to wait for a newer version. However, what you can do 
right now is:
* locate the setEnable() function body (line 22457)
* replace the beginning of the function by this:
global procedure setEnable( object id, atom flag )
    -- enable/disable an item
    sequence lKids
    atom lHandle,hMenuBar
    integer lControl,menuPos

    if sequence(id) then
        for i = 1 to length(id) do
            setEnable(id[i], flag)
        end for
        return
    end if


    lHandle = getHandle( id )
    if ctrl_Family[ id ] = MENU
    or ctrl_Family[ id ] = MENUITEM then

        -- convert the flag
        flag = w32iff( flag, MF_ENABLED, w32or_all( {MF_DISABLED, MF_GRAYED} ) )

        hMenuBar = 0
        if ctrl_Family[ctrl_Parent[id]]=WINDOW then
            hMenuBar = ctrl_Menu[ctrl_Parent[id]]
            menuPos=0
            while lHandle!=w32Func(xGetSubMenu,{hMenuBar,menuPos}) do
                menuPos+=1
            end while
            lHandle = hMenuBar
        else
            menuPos = -1+find(id,ctrl_Group[ctrl_Parent[id]])
        end if

        -- enable/disable the menu
        if w32Func( xEnableMenuItem, {
    	        lHandle,        -- menu handle
    	        menuPos,        -- position
    	        or_bits(flag,MF_BYPOSITION)} )= #FFFFFFFF      -- enable/disble
        then
            -- item does not exist
            warnErr( Err_SETENABLE )
        end if

        -- if menubar, need to redraw
        if hMenuBar then
            VOID = w32Func( xDrawMenuBar, { ctrl_Parent[ id ] } )
        end if


Note that on XP Home, you have to click on the menu for it to appear grayed.
On XP Pro you don't need this. At least I get two different behaviours. 

As far as I know, more than a few people use modified win32lib versions,
 which ship with their apps. The IDE isn't the only one.

As I was writing the pages in the EuWIki win32lib category, I started adding
 and fixing stuff in the library. A few months ago, I called for testers for 
this modified version, as no news of official development was available.
There's a small team who got several versions already. The addition process
 isn't completely finished at the moment; I'm currently adding flexibility
 to the structure handling system.

The final status of these changes, which are quite extensive internally,
and led to a change file which is now incomplete and which I posted when
 calling for testers, depends on Derek, as he is the maintainer of the
 library. I understand that he plans to give a new life to the current
 SourceForge project; I'll have to integrate in that framework (or to fork - 
but I don't expect this).

There are changes that I'd think beneficial, but some decisions about how to
 support older OSes (mainly Win98) have to be taken. Basically, there are
 useful OS features that are available under XP only, or under win2K and
 higher only. And the question is: will the library support them?

I didn't write anything in EuWiki about the other versions, for lack of 
complete information. It looks like there weren't too many authors either.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu