1. Tracy Lamb
  2. PowerBuilder
  3. Wednesday, 15 June 2022 15:38 PM UTC

Hi folks,

I have an ancestor window with several descendants, w_masterlist. I'd like to disable or ignore the DoubleClicked event if the dw is in query mode.  If the dw is not in query mode, the descendant code for the doubleclicked event should run.  Doubleclicked event has only one return code, 0 (continue processing).  I don't know how to prevent the doubleclicked code in the descendants from running.

Any ideas/advice?  I'm using PB2021 and PFC 12.5.

~~~Tracy

 

Accepted Answer
Tracy Lamb Accepted Answer Pending Moderation
  1. Thursday, 23 June 2022 15:39 PM UTC
  2. PowerBuilder
  3. # Permalink

I just decided to leave the Ancestor code empty and check for the query status in the descendants. 

if this.inv_querymode.of_GetEnabled() = TRUE then
   return
end if

Thanks all for your ideas.

~~~Tracy

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 17 June 2022 14:35 PM UTC
  2. PowerBuilder
  3. # 1

1. Create an instance BOOLEAN      ib_in_query_mode = FALSE

2. In your code when the DW goes into Query mode, set the flag to TRUE.
    When your DW exits Query mode, set it to FALSE.

3. At line 1 in the DoubleClicked event:
       IF (ib_in_query_mode) THEN RETURN

 

 

 

 

Comment
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Thursday, 16 June 2022 08:36 AM UTC
  2. PowerBuilder
  3. # 2

Hi Tracy,

you cannot prevent a descendant script fom running in the ancestor event.

What you could do is create an empty event or function on the ancestor and call that one in the doubleclicked event but only if your conditions are met. Then you'd have to move any code in your descendant objects from doubleclicked to the new function that is inherited from the ancestor.

 

 

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 15 June 2022 15:51 PM UTC
  2. PowerBuilder
  3. # 3

override the event in the descendent object. that means the ancestor event will NOT run.  if you do want it to run (not in querymode) then use super::

 

the 'extend event' is hidden on the edit menu.  if it is NOT checked (you must uncheck it) then you did the override. 

 

 

Comment
  1. Tracy Lamb
  2. Wednesday, 15 June 2022 16:09 PM UTC
Just as simple not to put anything in the ancestor.... was trying to get the ancestor to trap the query status before the descendant gets it.
  1. Helpful
  1. Brad Mettee
  2. Thursday, 16 June 2022 14:31 PM UTC
Like Mike said, override the ancestor script. Check the help index for "ancestor script, call". If you override the ancestor script, you can call it, or not, depending on results of code running the descendant script.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 15 June 2022 15:49 PM UTC
  2. PowerBuilder
  3. # 4

Hi Tracy;

  Before the Return statement, have you tried ...

Message.Processed = TRUE

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 16 June 2022 17:42 PM UTC
Thanks for trying that. In that case, the next alternative would be to overload the Double-Click event with another argument that directs the descendant(s) to ignore the processing as the ancestor has handled this already. I use this technique in my STD framework quite often. Food for thought. The same in the reverse direction when calling SUPER::Event / Function to let the Ancestor know that a descendant has already handled the processing and/or an "Extension" layer descendant needs to ignore this processing and pass it up to a higher ancestor.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 24 June 2022 04:21 AM UTC
Even though it likely won't cause any problems, please be aware that returning a value of -1 in a double clicked event doesn't make any sense. When you look at the help on specific events, you'll normally find the valid values for returns.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 24 June 2022 04:24 AM UTC
In the case of doubleclicked the only valid returnvalue = 0.

https://docs.appeon.com/pb2022/powerscript_reference/doubleClicked_event.html

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.