ToolClick event handler does not fire

Posted by rbf on 16-Jul-2012 04:50

I created a menu for an embedded GUI screen that is properly visualized in the parent form. However, whatever I try the ToolClick event handler does not fire.

If I remove the event handler I get a runtime error saying the event handler is not found (it sits in a procedure) but when I put it back it does not fire.

What am I missing? Something with scope maybe? I have not come accross that before in .NET (like PERSITENT-RUN in the equivalent GUI statement).

All Replies

Posted by asthomas on 16-Jul-2012 04:51

I am not in the office until Augst 13th 2012. I will not be checking my mail and phone on a regular basis, but will reply to your mail as soon as I can.

If you need support from appSolutions, please send your mails to support@app-solutions.com. Our offices are closed during weeks 30, 21 and 32 of 2012. Urgent administrative and support requests should therefore be adressed to admin@app-solutions.com.

If you need Roundtable support, please send mails to :

support-europe@roundtable-tsms.com.

Jeg er væk fra kontoret indtil den 13. august, og checker ikke mail og telefon regelmæssigt. Jeg vil dog svare på din mail så snart som muligt.

Hvis du har behov for support, kontakt venligst support@app-solutions.com, så vender vi tilbage så snart det er muligt. Kontoret er dog lukket i ugerne 30, 21 og 32 20 12. Hastersager kan derfor rettes til admin@app-solutions.com.

Administrative henvendelser kan ske til : admin@app-solutions.com.

Med venlig hilsen / Regards

Thomas Hansen

appSolutions a/s

Posted by Keerthy Yeddula on 16-Jul-2012 06:08

Hi Peter,

ToolClick event is working fine for buttons and it is not working for menus. Seems Toolclick events will not work for menus. Refer below link:

http://www.infragistics.com/community/forums/t/70325.aspx

Hope this helps.

Thanks,

Keerthy.

Posted by rbf on 16-Jul-2012 06:20

Hi Keerthy,

Thank you for your reply. I am aware of that limitation, but my menu items *are* ButtonTools (I should have mentioned that in my orginal post).

Any ideas?

Posted by Keerthy Yeddula on 16-Jul-2012 07:06

Hi Peter,

This is working fine for me. I did the following steps:

1. Added Toolclick event for UltraToolsbarsManager and added a message statement in even handler.
2. Added buttons in menu.
3. In run window, selected button from menu item. Now my message is shown properly.

Thanks,

Keerthy.

Posted by rbf on 16-Jul-2012 07:12

kyeddula wrote:

This is working fine for me.


I wish I could say the same

Posted by marko.rueterbories on 16-Jul-2012 08:21

Hey Peter,

are you sure your initialization method, where you subscribe the EventHandler method to the event is executed correctly?

I never had such behavior when working with the ToolClick Event and I do that quite often.

Regards,

Marko

Posted by rbf on 16-Jul-2012 08:33

marko.rueterbories wrote:

Hey Peter,

are you sure your initialization method, where you subscribe the EventHandler method to the event is executed correctly?

I never had such behavior when working with the ToolClick Event and I do that quite often.

Regards,

Marko

What could I possibly do wrong? My code contains the following lines:

ultraToolbarsManager1:ToolClick:Subscribe("ultraToolbarsManager1_ToolClick").

...

PROCEDURE ultraToolBarsManager1_ToolClick:

  DEFINE INPUT PARAMETER sender# AS System.Object.
  DEFINE INPUT PARAMETER e# AS Infragistics.Win.UltraWinToolbars.ToolClickEventArgs.

  MESSAGE PROGRAM-NAME(1)
  VIEW-AS ALERT-BOX.

   ...

END.

Obviously my problem is that the message does not appear when I click on a buttontool.

If I remove the first line I receive a runtime error so it seems the subscribe is executed and succeeds.

Is it possible to subscribe at the wrong moment?

Is it possible to go out of scope while the menu is still visible?

Posted by marko.rueterbories on 16-Jul-2012 09:01

I did the output with

MESSAGE e#:Tool:Key

VIEW-AS ALERT-BOX.

But that is just detail and works pretty well. Have you more then one UltraToolbarsManager in your Form hierarchy? Possibly your form derives from another Form BaseClass?

I have never seen a subscribe at the wrong moment and couldn't emagine when except when destroying the form the wrong moment could be.

If you don't delete the procedure the scope should still be corret.

Please try this with juts an empty form. Something like this in a procedure and a Form with the UltraToolbarsManager with Modifiers set to public:

DEFINE VARIABLE oForm AS test.TestForm NO-UNDO.

PROCEDURE ultraToolBarsManager1_ToolClick:

DEFINE INPUT PARAMETER sender# AS System.Object.

DEFINE INPUT PARAMETER e# AS Infragistics.Win.UltraWinToolbars.ToolClickEventArgs.

MESSAGE e#:Tool:Key

VIEW-AS ALERT-BOX.

END.

oForm = NEW test.TestForm ().

oForm:ultraToolbarsManager1:ToolClick:Subscribe("ultraToolBarsManager1_ToolClick").

WAIT-FOR System.Windows.Forms.Application:Run(oForm).

That should work like it does for me.

Posted by rbf on 16-Jul-2012 10:00

Hi Marko,

Thank you for your help. It works fine with an empty form, but I am using an embedded GUI form (MDIChild) in an MDI parent. Could that be the problem?

I am creating an ultraToolbarsManager in the MDIChild as well as one in the MDI parent. The menu of the MDIChild is properly displayed in the parent when the child gets focus but ToolClick does not fire.

This is the first time I am trying this so maybe I am missing something.

Posted by rbf on 16-Jul-2012 10:29

YES!!! I found it!

Of course it was the subscribed Progress procedure that went out of scope... the equivalent of PERSISTENT-RUN!!

Thanks all for your input.

Posted by marko.rueterbories on 16-Jul-2012 10:31

Now I got it

You are trying to catch the ToolClick Event in the MDIParent and hope that the Childs Event fire there aswell.

Sorry but they don't. You have to implement then Handler for each UltraToolbarsManager. So if you subscribe the Handler method to the ToolClick Event of the child window you will see your messagebox to be displayed.

That’s how you separate the logic for each window. It completely stays as if it would run standalone without the MDIParent.

Posted by rbf on 16-Jul-2012 14:07

No that is not what I am trying. It works now as expected (see my other post).

This thread is closed