1. Win32Lib: setEnable not work for top menu "objects"?

I don't seem to be able to disable top menu's using setEnable; 
I can disable menu ITEMS, but not a TOP menu, like "File", or "Edit", etc.

I assume I've seen this occur in other windows programs, but I'm not sure.
Am I doing something wrong, or is it fundamentally not doable, or just
not (yet?) implemented?

Dan Moyer

new topic     » topic index » view message » categorize

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

Dan Moyer wrote:
> 
> 
> I don't seem to be able to disable top menu's using setEnable; 
> I can disable menu ITEMS, but not a TOP menu, like "File", or "Edit", etc.
> 
> I assume I've seen this occur in other windows programs, but I'm not sure.
> Am I doing something wrong, or is it fundamentally not doable, or just
> not (yet?) implemented?

A bug. Depending on which version of the library you have ...

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
        ctrl_Menu[id][3],
        flag} )= #FFFFFFFF      -- enable/disble
  then

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> Dan Moyer wrote:
> > 
> > 
> > I don't seem to be able to disable top menu's using setEnable; 
> > I can disable menu ITEMS, but not a TOP menu, like "File", or "Edit", etc.
> > 
> > I assume I've seen this occur in other windows programs, but I'm not sure.
> > Am I doing something wrong, or is it fundamentally not doable, or just
> > not (yet?) implemented?
> 
> A bug. Depending on which version of the library you have ...
> 
> 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
>         ctrl_Menu[id][3],
>         flag} )= #FFFFFFFF      -- enable/disble
>   then
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell


Thanks Derek,

I'm using 0.60.6, with the IDE.

Dan

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> Dan Moyer wrote:
> > 
> > 
> > I don't seem to be able to disable top menu's using setEnable; 
> > I can disable menu ITEMS, but not a TOP menu, like "File", or "Edit", etc.
> > 
> > I assume I've seen this occur in other windows programs, but I'm not sure.
> > Am I doing something wrong, or is it fundamentally not doable, or just
> > not (yet?) implemented?
> 
> A bug. Depending on which version of the library you have ...
> 

Derek,

I should have said:
Win32Lib v 0.60.6, with this note at top:
--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.

Dan

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> Dan Moyer wrote:
> > 
> > 
> > I don't seem to be able to disable top menu's using setEnable; 
> > I can disable menu ITEMS, but not a TOP menu, like "File", or "Edit", etc.
> > 
> > I assume I've seen this occur in other windows programs, but I'm not sure.
> > Am I doing something wrong, or is it fundamentally not doable, or just
> > not (yet?) implemented?
> 
> A bug. Depending on which version of the library you have ...
> 
> 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
>         ctrl_Menu[id][3],
>         flag} )= #FFFFFFFF      -- enable/disble
>   then
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell


Derek,

Fix didn't work for me :(

Dan

new topic     » goto parent     » topic index » view message » categorize

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

Dan Moyer wrote:
> 
> Derek Parnell wrote:
> > 
> > Dan Moyer wrote:
> > > 
> 
> Derek,
> 
> Fix didn't work for me :(
> 
> Dan


Scratch that, still trying to see which version (where) is actually running.
Dan

new topic     » goto parent     » topic index » view message » categorize

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

Dan Moyer wrote:
> 
> Dan Moyer wrote:
> > 
> > Derek Parnell wrote:
> > > 
> > > Dan Moyer wrote:
> > > > 
> > 
> > Derek,
> > 
> > Fix didn't work for me :(
> > 
> > Dan
> 
> 
> Scratch that, still trying to see which version (where) is actually running.
> Dan

Derek, et all,
Sorry for all the traffic, but I had to be sure that the Win32Lib version
that I patched was the one that's actually running, and now I'm sure it is.

So, as far as I can see, THAT FIX ISN'T WORKING.

Does anyone else get it to work??

Dan

new topic     » goto parent     » topic index » view message » categorize

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

Dan Moyer wrote:
> 
> Dan Moyer wrote:
> > 
> > Dan Moyer wrote:
> > > 
> > > Derek Parnell wrote:
> > > > 
> > > > Dan Moyer wrote:
> > > > > 
> > > 
> > > Derek,
> > > 
> > > Fix didn't work for me :(
> > > 
> > > Dan
> > 
> > 
> > Scratch that, still trying to see which version (where) is actually running.
> > Dan
> 
> Derek, et all,
> Sorry for all the traffic, but I had to be sure that the Win32Lib version
> that I patched was the one that's actually running, and now I'm sure it is.
> 
> So, as far as I can see, THAT FIX ISN'T WORKING.
> 
> Does anyone else get it to work??
> 
> Dan

See my reply to VladoBG a while ago. I confirm that the suggested fix doesn't
 work (using unmodified 0.60.6 and the code mod above), under XP Pro SP2.
In setEnable(), you have to access the menu by position (and getMenuPosn()
doesn't work for them in the official version).

As for setCheck(), you are right, Derek, I'll have to also take care
 of the implicit group associated to the window, thanks. 

CChris

new topic     » goto parent     » topic index » view message » categorize

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

CChris wrote:
> As for setCheck(), you are right, Derek, I'll have to also take care
>  of the implicit group associated to the window, thanks. 
Is it not just all radios with 'same parent'?
No need to care if it is a window or a group?
I believe TabItems are otherwise another case.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

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

Pete Lomax wrote:
> 
> CChris wrote:
> > As for setCheck(), you are right, Derek, I'll have to also take care
> >  of the implicit group associated to the window, thanks. 
> Is it not just all radios with 'same parent'?
> No need to care if it is a window or a group?
> I believe TabItems are otherwise another case.
> 
> Regards,
> Pete

Good catch. So every [logial] container container should keep track of its 
own radios... After all, that's what EiffelVision2 does with its boxes. 
Trouble is, there ain't boxes (so far), as they entail a philosophy about
 resizing which is alien to Windows.
By the way... If a radio button is visible on all tabs of a TabControl, 
is it supposed to interact with any that appears on only one of the tabs?
ie get unchecked if the radio on a single tab is checked?

CChris

new topic     » goto parent     » topic index » view message » categorize

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

Pete Lomax wrote:
> 
> CChris wrote:
> > As for setCheck(), you are right, Derek, I'll have to also take care
> >  of the implicit group associated to the window, thanks. 
> Is it not just all radios with 'same parent'?
> No need to care if it is a window or a group?
> I believe TabItems are otherwise another case.

Yes. That is actually how I'm coding it. When a radio gets created it gets added
to it's parent's radio list so that whenever a radio is clicked on or set on, the
other radios in the same list are set off. If you set off a radio that is already
on, the 'next' radio in the list is set on.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> Pete Lomax wrote:
> > 
> > CChris wrote:
> > > As for setCheck(), you are right, Derek, I'll have to also take care
> > >  of the implicit group associated to the window, thanks. 
> > Is it not just all radios with 'same parent'?
> > No need to care if it is a window or a group?
> > I believe TabItems are otherwise another case.
> 
> Yes. That is actually how I'm coding it. When a radio gets created it gets
> added
> to it's parent's radio list so that whenever a radio is clicked on or set on,
> the other radios in the same list are set off. If you set off a radio that is
> already on, the 'next' radio in the list is set on.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

I understtand from this that I don't need to add the fix in, as you are
 coding it. Good news...
I've already fixed setEnable() by changing the access mode to MF_BYPOSITION.

CChris

new topic     » goto parent     » topic index » view message » categorize

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

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

new topic     » goto parent     » topic index » view message » categorize

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

Dan Moyer wrote:

 
> Seems like there are more than one or two versions of 0.60.6
> floating around.  

Yes, That's totally my fault and I apologize. 

> 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.)

In the next few hours, I'll have uploaded the library to source forge's SVN
repository and we can all start using that as the basis for open-source
development. That is, anyone in the win32libex sourceforge project will be able
to checkout the code, update it and the check it in again. I think non-project
members will be able to download the source but not check anything in to its
repository.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

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

So, are there going to be new official releases as well? Not that I use it, but
I'm just curious.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view message » categorize

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

Derek Parnell wrote:
> 
> Dan Moyer wrote:
> 
>  
> > Seems like there are more than one or two versions of 0.60.6
> > floating around.  
> 
> Yes, That's totally my fault and I apologize. 

No biggie, I'm sure it'll get straightened out eventually.
And for the ENORMOUS amount of work you've put into Win32Lib after
David Cuny started it, and of course the subsequent UTILITY of  the library,
you got nothing but my respect & gratitude!  Thanks!

> 
> > 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.)
> 
> In the next few hours, I'll have uploaded the library to source forge's SVN
> repository and we can all start using that as the basis for open-source
> development.
> That is, anyone in the win32libex sourceforge project will be able to checkout
> the code, update it and the check it in again. I think non-project members
> will
> be able to download the source but not check anything in to its repository.
> 

That should be interesting :)

Dan Moyer

> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

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

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 message » categorize

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

Derek Parnell wrote:

> In the next few hours, I'll have uploaded the library to source forge's SVN
> repository and we can all start using that as the basis for open-source
> development.
> That is, anyone in the win32libex sourceforge project will be able to checkout
> the code, update it and the check it in again. I think non-project members
> will
> be able to download the source but not check anything in to its repository.
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

heh...
Are you serious?  Perhaps you can describe how the users of your library might
download this update of which you speak...  I'm not finding squat at the forge as
of <date-of-this-posting/>.

http://sourceforge.net/projects/win32libex/ shows 0.59.2.
 
If you finally do as you say, I might finally release a bunch of code that has
dependencies on a lib that is now several years old and counting since you've
grabbed the reigns.

--curious how I've managed to pick up on win32lib dicussion after all these
years of nothing...
*Brian

new topic     » goto parent     » topic index » view message » categorize

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

Brian Broker wrote:
> 
> Derek Parnell wrote:
> 
> > In the next few hours, I'll have uploaded the library to source forge's SVN
> > repository and we can all start using that as the basis for open-source
> > development.
> > That is, anyone in the win32libex sourceforge project will be able to
> > checkout
> > the code, update it and the check it in again. I think non-project members
> > will
> > be able to download the source but not check anything in to its repository.
> 
> heh...
> Are you serious?  Perhaps you can describe how the users of your library might
> download this update of which you speak...  I'm not finding squat at the forge
> as of <date-of-this-posting/>.
> 
> http://sourceforge.net/projects/win32libex/ shows 0.59.2.

Take a look at:
http://sourceforge.net/svn/?group_id=9153

There's a link from there that allows you to browse the repository with
your web browser, or, if you have svn installed:

$ svn co https://win32libex.svn.sourceforge.net/svnroot/win32libex/trunk
<target-directory>

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu