Skip to Content
author's profile photo Former Member
Former Member

Event firing twice for button click

I have an add-on that puts a new button on the Item Master form. Clicking that item brings up a new data entry form. Everything works well except that it appears the click event is firing twice. I have this code to capture the click for the custom button:

If pVal.Before_Action = False And pVal.ItemUID = "btnMxSet" Then

..load my new form

End If

The problem is that the form tries to load twice because the event is fired twice. I added an SBO message box before loading the form and it only fires off once. I suppose I can check to see if the form is loaded, but I want to see why the event fires twice.

Any ideas? If not, what's the best way to check to see if a given form is loaded?

The people on this forum are very helpful!

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 18, 2005 at 06:09 PM

    You should also add a pVal.EventType == BoEventTypes.et_ITEM_PRESSED...

    Complete code:

    public static bool isButtonClick(string UID) {
       return (!pVal.BeforeAction && pVal.ItemUID==UID && pVal.EventType == BoEventTypes.et_ITEM_PRESSED);
    }
    

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Curtis,

      Another reason for your code executing twice is because it will be executed when BeforeAction is true and when BeforeAction is false. You should check this in your code as well.

      if pVal.BeforeAction = True then
      ...
      else
      ...
      end if

      Hope it helps,

      Adele

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.