1. William Beale
  2. PowerBuilder
  3. Tuesday, 18 May 2021 02:27 AM UTC

In an MDI configuration,  want to call a function that is in an already opened widow (say w_main) from another opened widow (say, w_detail) and, once the function is executed, close the calling widow (w_detail) to return to the original window, (w_main).

Using Active Sheet to get a handle on w_main does not help because w_detail is the active sheet.  I do not want to create another instance of  w_main by using OpenwithParm(..).

In a simplified version of the code in w_detail, I’ve tried:

If IsValid(w_main) Then

                li_rc = w_main.of_perform_function()

End If

Once the function is executed, I code to close the calling window, w_detail, for w_main to be the active sheet.

I’m using PM 2019 R3

Any advice would be appreciated.

Accepted Answer
Arthur Hefti Accepted Answer Pending Moderation
  1. Tuesday, 18 May 2021 03:46 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi

you can loop through the open windows like 

lw_Sheet = w_frame.GetFirstSheet()
DO WHILE IsValid( lw_Sheet )
  IF lw_Sheet.ClassName() = "w_main" THEN
      lw_Sheet.DYNAMIC of_XXX()
      Close( ls_Sheet ) //<<-- Could be done here or in w_main 
      EXIT
  END IF
  lw_Sheet = w_frame.GetNextSheet(lw_Sheet)
LOOP

Regards
Arthur

Comment
  1. William Beale
  2. Tuesday, 18 May 2021 04:27 AM UTC
Much appreciated Arthur. That solution seems to make sense.
  1. Helpful
There are no comments made yet.
William Beale Accepted Answer Pending Moderation
  1. Tuesday, 18 May 2021 06:25 AM UTC
  2. PowerBuilder
  3. # 1

Arthur's solution implemented and worked fine - matter resolved.  Thanks again, Arthur.

Comment
  1. Kevin Ridley
  2. Tuesday, 18 May 2021 14:35 PM UTC
Please help others by marking his answer as the solution.
  1. Helpful
  1. William Beale
  2. Tuesday, 18 May 2021 21:35 PM UTC
Hi Kevin, I had acknowledged Arthur's solution 'worked fine'. I gather there's something else I need to do?
  1. Helpful
  1. John Fauss
  2. Tuesday, 18 May 2021 22:04 PM UTC
On the right side of the heading of Arthur's reply to your question, you will see a button "Accept As Answer" since you are the person that created the thread. Please click this and the thread will be marked as Resolved and Arthur will be credited with providing the solution. Thank you, William!
  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.