xsharp.eu • conversion problem (VO2.6 to 2.8) - Page 3
Page 3 of 3

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 10:39 am
by Plummet
Hi Jan,
A quick reply here as have not had the time to look thru yr code.

In all my (mdi)windows, dbf or text(mle), I pass the menucommand on up to the owner. It works fine for me (VO 2.8 ).

METHOD MenuCommand(oMCE) CLASS BasicDBFWindow
// pass it on
SELF:Owner:MenuCommand(oMCE)

HTH - sorry if it is irrelevant,
Don

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 10:50 am
by Jan@share.be
Don

Thanks, I'll play around with that idea

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 10:51 am
by Jan@share.be
In my previous demo app, there was a small mistake
I hereby upload the updated version

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 1:31 pm
by Jan@share.be
Don

Does this work on context menus as well?
In my case: no menucommand is called.

But, I'm using a dynamically build menu.
When I use the menueditor, it all works fine.

So I'm doing something wrong in building the menu, I suppose.

Anyone with experience to build menu's? dynamically?

thanks

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 1:31 pm
by Jan@share.be
Don

Does this work on context menus as well?
In my case: no menucommand is called.

But, I'm using a dynamically build menu.
When I use the menueditor, it all works fine.

So I'm doing something wrong in building the menu, I suppose.

Anyone with experience to build menu's? dynamically?

thanks

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 3:06 pm
by Chris
Hi Jan,

I checked the code in the SDK, apparently the MenuCommand() callback gets called only if there's no method that is directly handling your menu command. In your case, there are appropriate methods that get called for all the menu options, so MenuCommand() never gets called. Even if it got called, it would be sent to the "designwin" window, which owns the menu, not on the "DSRWin" class, where I see you have it defined.

But since you are already handling the menu commands, may I ask why you need the MenuCommand() functionality anyway? In case it is necessary for any reason to trap the menu commands before they are dispatched automatically, you can use the PreMenuCommand() callback like this:

Code: Select all

METHOD PreMenuCommand(oMenuCommandEvent) CLASS designwin
? oMenuCommandEvent:Name
RETURN TRUE // or FALSE 
If you return TRUE from the method, itmeans that you have handled the even yourself, so the associated method with the menu item will not be called. If you return FALSE, the event gets dispatched normally.

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 3:48 pm
by Jan@share.be
Chris

thanks for all the effort you put in this.

I'm trying to catch the items form the contextmenu that is attached to the DSRWin, and for which I defined all the methods as 'Dummy()'. So I would expect it to call menucommand, but it doesn't. I tried MenuSelect and PreMenuCommand as wel, I don't get any result.
take a look at DSRWin:setmenu()

I my demo, the context menu is build dynamically although all options are predefined. But I also need the same thing working when I build the menu from entries that are in de database (in casu: different machines they are using, and that changes over time).
The only way to do that in my opinion is built the menu dynamically and determine in menucommand wich option has been chosen.

This setup worked fine in VO2.6.

thanks
Jan

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 6:58 pm
by Chris
Hi Jan,

Oh, it's a Context Menu that you were asking for from the beginning? I think I remember I've had issues with those myself in the past and ended up using ShowAsPopup() manually, but do not remember the details. I will look into them and will get back to you. Of course also anyone else please do not hesitate to give your input!

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 7:43 pm
by Jan@share.be
Chris

YES, this works.
events are a bit weard, still figuring out the details.
Not all callback events get the correct event.
But I'll manage this way.

Thank you very much!!!

We'll have a beer next time we meet!! OK?

see you

Jan

conversion problem (VO2.6 to 2.8)

Posted: Mon Nov 02, 2020 7:46 pm
by Chris
Hi Jan,

Oh, you used the ShowAsPopup() method? OK, nice, so I am not gonna look more closely why the ContextMenu way did not work, and yes I really appreciate the beer offer :)

cheers!