Resolved Command a window from another

Hi everyone ,

This time it's not about the query system, but about the widget.

I know that my request is not a real issue but a solution to bypass it.

I have a window that was developp by our resseler (it's our product sheet). In this sheet there is a button to delete (more like to disable a product when you don't use it anymore). And I don't know what this button do exactly (witch data are modified by using it).

So I was thinking of this:
  1. Make a window app (MA: Mother App) or a procedure that called the product sheet window app (CA: Child App)
  2. Using the MA to use the trigger I want to use on the CA, like APPLY "CHOOSE":U TO BT-Delete in CA

Is it possible ? Or is it a dream ?

Best-Regards,

- Vivien -
 

andre42

Member
I suppose you don't have the source code for that window?

It should be possible to do some automation without having the source code or resorting to AutoIt. Get the handle to the window, get the handle to the frame in the window (or the viewer in the container first), iterate the widgets inside the frame until you get the handle to the button, apply "CHOOSE" to the button. Just look at the FIRST-CHILD and NEXT-SIBLING attributes. You can check several attributes to make sure you are getting the correct objects/handles (FILE-NAME for the window, TYPE and LABEL for the button ...)
If the windows is not a concurrent window a dialog this might be a bit more difficult.

Alternatively you could give Pro*Spy Plus a go. If the window doesn't contain the logic for this operation but only calls an API you could call that API yourself.
 

Osborne

Active Member
Is the problem that you have a Progress window developed by someone else, you want to interact with the delete button on that window but do not have the source code for that window. Is this correct?

If so, then as andre posted one way is to get the handle of the window and iterate the widgets. This thread discussed something similar:

 
Is the problem that you have a Progress window developed by someone else, you want to interact with the delete button on that window but do not have the source code for that window. Is this correct?

If so, then as andre posted one way is to get the handle of the window and iterate the widgets. This thread discussed something similar:

Excatly I don't have The source code that's why I wanna try it this way.
 
Hi everyone. What was writing there was intersting but not what I need.

I code this in a first button :
Code:
 RUN m01/wdpram01.w PERSISTENT SET hWindow (INPUT ?).

Where hWindow is define as a handle.

in a Second Button, I code this:
Code:
DEFINE VARIABLE hHandle AS HANDLE      NO-UNDO.
    DEFINE VARIABLE hFrame  AS HANDLE      NO-UNDO.

MESSAGE hWindow:NAME SKIP
      hWindow:TYPE
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
    
 hFrame = hWindow:FIRST-CHILD .


  
   MESSAGE hFrame:NAME
       VIEW-AS ALERT-BOX INFO BUTTONS OK.

   ASSIGN
        hHandle = hFrame:FIRST-CHILD
        hHandle = hHAndle:FIRST-CHILD  .

   DO WHILE VALID-HANDLE(hHandle) :
       IF hHandle:TYPE = "BUTTON" THEN
           MESSAGE hHAndle:NAME
               VIEW-AS ALERT-BOX INFO BUTTONS OK.

        hhandle = hhandle:NEXT-SIBLING .
   END.
The thing is when I tried to get the FIRST-CHILD of the hWindow Handle. But progress tell me I can't because the hWindow:TYPE is "PROCEDURE".

So, is there a way to go below my hWindow handle? Or maybe it's the way I get my hWindow handle in first place?

Thank you in advance,

Best Regards
 

andre42

Member
According to the OpenEdge help a procedure object handle does have a current-window attribute, but after reading about that attribute I'm not sure if it set automatically.
Alternatively you could try to iterate through all open windows with next-sibling.
 
Andre42, you are right. i didn't see this "current-window" attribute and it works perfectly:
Code:
 MESSAGE hWindow:NAME SKIP
      hWindow:TYPE
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
 
 hWindow = hWindow:CURRENT-WINDOW.

 MESSAGE hWindow:NAME SKIP
      hWindow:TYPE
      VIEW-AS ALERT-BOX INFO BUTTONS OK.

 
  hFrame = hWindow:FIRST-CHILD .


   MESSAGE hFrame:NAME
       VIEW-AS ALERT-BOX INFO BUTTONS OK.

   ASSIGN
        hHandle = hFrame:FIRST-CHILD
        hHandle = hHAndle:FIRST-CHILD  .

   DO WHILE VALID-HANDLE(hHandle) :
       IF hHandle:TYPE = "BUTTON" THEN
           MESSAGE hHAndle:NAME
               VIEW-AS ALERT-BOX INFO BUTTONS OK.

        hhandle = hhandle:NEXT-SIBLING .
   END.
 
Top