1. Carlo Polo
  2. PowerBuilder
  3. Tuesday, 2 April 2024 09:49 AM UTC

Hello,

I have a sample project (derived from a more complex one) in which the response window "w_resp_1" has a button "cb_1" whose "clicked" event opens another response window named "w_resp_2".

In the "Open" event of "w_resp_2" there is this MessageBox statement:

MessageBox(“Info”, “w_resp_2 opening…”)

If I run the project, after closing the MessageBox the "w_resp_2" window appears over the "w_resp_1", but the active window remains "w_resp_1".

As a walkaround in "w_resp_2" I created the user event  "ue_manage" in which I moved the MessageBox statement, and in the "Open" event I inserted only:

PostEvent(“ue_manage”)

In this way I noticed that the active window after closing the MessageBox is correctly "w_resp_2".

I was wondering if there is another way to solve this problem… Is there a statement that forces the "w_resp_2" to be the active window?

I already tried this code in the "Open" event of "w_resp_2":

MessageBox(“Info”, “w_resp_2 opening…”)
PostEvent(“activate”)

and this one too:

MessageBox(“Info”, “w_resp_2 opening…”)
ParentWindow().PostEvent(“deactivate”)

but they don’t function (the active window is still "w_resp_1")

Thank you

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 4 April 2024 08:20 AM UTC
  2. PowerBuilder
  3. # Permalink
Hi Carlo; That old PB version on newer Windows O/S versions could be your issue. I can open a response from a Response window OK in my STD framework testing on newer Appeon PB releases and on W10 & W11 O/S versions. HTH Regards .. Chris
Comment
There are no comments made yet.
Carlo Polo Accepted Answer Pending Moderation
  1. Thursday, 4 April 2024 08:04 AM UTC
  2. PowerBuilder
  3. # 1

Hi Chris,

thank you.

I prepared the same sample project in PowerBuilder Classic 12.5.1 in my pc with W10 O/S version, and I confirm your hypothesis (in this case I have no problems).

Thanks, Regards

Carlo

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 4 April 2024 13:54 PM UTC
That is awesome news Carlo ... Thank you for the feedback! :-)
  1. Helpful
There are no comments made yet.
Carlo Polo Accepted Answer Pending Moderation
  1. Wednesday, 3 April 2024 08:04 AM UTC
  2. PowerBuilder
  3. # 2

Hi John,

thank tou for your answer.

I agree with you that a response window must be the active window until the user closes it.

The stange thing in this case (thing that I don't understand) is this one:

1) The user opens the first response window ("w_resp_1") and clicks on its "cb_1" button.

2) The "clicked" event of that button opens the second response window ("w_resp_2").

3) The "Open" event of "w_resp_2" displays the MessageBox.

4) The user clicks on the "OK" button of the MessageBox and closes it correctly.

5) At this point (after closing the MessageBox) I would expect the new active window to become "w_resp_2" (in fact "w_resp_2" is displayed OVER "w_resp_1"), but the new active window is "w_resp_1" instead.

If in the "Open" event of "w_resp_2" I put PostEvent("ue_manage") and in "ue_manage" I call the MessageBox, everything works correctly (when the user closes the MessageBox, the active window becomes "w_resp_2").

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 2 April 2024 15:04 PM UTC
  2. PowerBuilder
  3. # 3

Hi, Carlo - 

A PowerBuilder response window is what the Windows operating system refers to as an "application modal dialog box". The purpose of a response window is to (a) present information to the user, (b) wait for the user's response, and (c) return the user's response to the calling application. A message box displayed by the MessageBox PowerScript function is a simple example. When an application model dialog box/window, the application cannot proceed until the user responds to the message.

Although the Windows O/S supports modeless dialog box windows (where the application is allowed to proceed while the dialog box window remains open, an example of this is the find/replace window in Microsoft Word), PB does not support this style of response window.

In the scenario you have described, you are attempting to make a (modal) response window in PB act like a modeless response window. That's not a good user interface technique, and the PB response window is not going to allow that to happen.

Best regards, John

Comment
There are no comments made yet.
Carlo Polo Accepted Answer Pending Moderation
  1. Tuesday, 2 April 2024 09:52 AM UTC
  2. PowerBuilder
  3. # 4

P.S.: I use PowerBuilder 9.0.2

 

Comment
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.