Problem with MENU's

Problem with MENU's

Postby Patrick Mast » Mon Sep 08, 2008 12:03 pm

Hello,

In METHOD Command() in CLASS TMenu there is a function ::GetMenuItem( nCommand ) to retreive oMenuItem.

Now, somethimes, when a user works for a while with my application, the menu's don't fire anything anymore. The menu's SHOW, I can see them, but the ACTION is not executed anymore.

I have found out this is because after some time, ::GetMenuItem( nCommand ) starts returning NIL. And when omenuItem = NIL, nothing is executed.

Any ideas on how to fix this?
Thanks!

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby driessen » Mon Sep 08, 2008 3:13 pm

Patrick,

I have noticed a similar problem.

In my application, the user is able to change his own menu.

After the menu has been changed by the user, this code is executed :
Code: Select all  Expand view
oWnd:SetMenu(oMenu)

If this is executed several times (somewhat between 15 and 20 times), the menus don't react anymore. Indeed the menu can be opened but the action is not executed.

The application has to be restarted and then everything is normal again.

Maybe it has something to do with SetMenu() ?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Antonio Linares » Mon Sep 08, 2008 3:31 pm

Patrick,

Please modify Method GetMenuItem() this way, so we can check what nItemId value fails:

METHOD GetMenuItem( nItemId ) BLOCK { | o | o := SearchItem( ::aItems, nItemId ), If( o == nil, MsgAlert( "MENUITEM " + Str( nItemId ) + " fails" ), ), o }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Patrick Mast » Mon Sep 08, 2008 3:52 pm

Antonio Linares wrote:Please modify Method GetMenuItem() this way, so we can check what nItemId value fails:

METHOD GetMenuItem( nItemId ) BLOCK { | o | o := SearchItem( ::aItems, nItemId ), If( o == nil, MsgAlert( "MENUITEM " + Str( nItemId ) + " fails" ), ), o }

Ok, done.

What do we know when we know what nItenID fails?

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Patrick Mast » Mon Sep 08, 2008 3:55 pm

Antonio Linares wrote:Please modify Method GetMenuItem() this way, so we can check what nItemId value fails:

METHOD GetMenuItem( nItemId ) BLOCK { | o | o := SearchItem( ::aItems, nItemId ), If( o == nil, MsgAlert( "MENUITEM " + Str( nItemId ) + " fails" ), ), o }

Hmm, we can't do it that way. Now cklicking on a menu always shows the MsgAlert().

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Mon Sep 08, 2008 6:21 pm

Patrick,

> What do we know when we know what nItenID fails ?

We need some info about that situation, as a start we will know what nItemId value is searched for.

> Now cklicking on a menu always shows the MsgAlert()

The MsgAlert() should be shown only if the menuitem is nil (not found).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 73 guests