1. Tracy Lamb
  2. PowerBuilder
  3. Friday, 4 November 2022 12:38 PM UTC

Hi Friends,

I have an MDI app.  In one of MDI sheets, I have a dw object and a tab object.  Both objects have code for the rbuttonup event that pops up a different menu depending on which object or tab is clicked.

When the user has the app running and this window/sheet is open, then changes the focus to another app, say Calculator, then right-clicks on the dw in my app (with Calculator still in the front), they get the spinning pointer style (busy) then my app always just closes without any message or warning.  If the user does the same thing, but right-clicks on the tab-object, my app regains focus, comes to the front (over Calculator) and processes the right-click event correctly. (This is what the app should do.) It's just when the user right-clicks on the dw object in the mdi sheet that this happens.  (Turns out, if the user left-clicks on the dw object from Calculator, my app still doesn't regain focus... sometimes my app crashes, sometimes it doesn't.)  It does the same thing in both the development environment and runtime.

It's not related to Calculator... does the same thing with notepad, Outlook, or any other outside app.  Is there some event I need to process first to force my app to get focus and come to the front?  Right now, my solution is to tell the customer "Don't do that", lol!  

Here's the relavent rbutton up code:

if this.RowCount() < 1 then return

m_bt_folder lm_popup
lm_popup = CREATE m_bt_folder

lm_popup.of_SetParent( this )
lm_popup.m_lab.m_instrument.PopMenu(PointerX(), PointerY() )

Using PB2021 Build 1509, PFC 12.5

TIA,
~~~Tracy

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 4 November 2022 13:15 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Tracy;

  This is what the Window class's Activate and Deactivate events are used for. Either you you left me or you came back to me.

My STD framework uses these on the "Controller" window (primary window for the app) to track exactly how much time the App user uses the App vs is away doing something else (like playing solitaire - LOL).

HTH

Regards ... Chris

Comment
  1. Tracy Lamb
  2. Friday, 4 November 2022 20:52 PM UTC
Thank you Chris... I didn't find a Deactivate event. But found the info on the Activate event in the Help file. Turns out, the dw had a tab value of 0. I changed that to 1 and everything seems to work right. Customer will test their runtime version sometime in the next couple days (it's Friday afternoon, happy hour!)

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 4 November 2022 20:57 PM UTC
  2. PowerBuilder
  3. # 1

Hi Tracy;

  FYI: Every window class has these events ...

Regards ... Chris

Comment
  1. Tracy Lamb
  2. Friday, 4 November 2022 21:07 PM UTC
You are right... I didn't look far enough down the event list, as there's no ancestor code for it, so it shows up closer to the bottom. My bad.
  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.