How to find current program ADM / Classic ABL

JackSpratt

New Member
Progress version 11.6 on Windows.
I'm maintaining a legacy application that's using a mix of ADM and ADM2. One of the hardest parts is identifying which program I'm currently in. I'm having to resort to codebase searches and it's not an exact science. Particularly as each screen often has a plethora of tabs and sub programs.
So I'm trying to build in a way of identifying the active program on a hotkey. In the overarching menu program I've added a global hotkey which works beautifully, except that PROGRAM-NAME (1) is always the menu program, and not the active sub program.
Anyone got ideas how I can identify which program we're active in?
Code:
ON CTRL-F7 ANWEHRE DO:
  MESSAGE PROGRAM-NAME (1) VIEW-AS ALERT-BOX. 
END.
 
Don't know if this will help you, with your libraries and UI, but we do something similar. It looks like this:

Code:
on "F12" anywhere do:
   DEFINE VARIABLE v-callstack AS CHARACTER NO-UNDO INITIAL "CALL STACK~n~n".
   DEFINE VARIABLE v-level AS INT INITIAL 1.
   REPEAT WHILE PROGRAM-NAME(v-level) <> ?.
       FILE-INFO:FILE-NAME = PROGRAM-NAME( v-level ).
       ASSIGN v-callstack = v-callstack + "(" + STRING( v-level ) + " ) ".
       ASSIGN v-callstack = v-callstack +
               ( IF FILE-INFO:FULL-PATHNAME EQ ? THEN FILE-INFO:FILE-NAME
                                              ELSE FILE-INFO:FULL-PATHNAME ).
       ASSIGN v-callstack = v-callstack + "~n".
       v-level = v-level + 1.
   END.
   {pmgeamsg.i "v-callstack"}
end.
The include at the end just displays the call stack in an alert box.
 
Thanks Rob. Unfortunately that doesn't work. I'll try and explain my structure a bit better. The app is essentially started with a

prowin -p login.w

This then calls to one or more other .w files where the actual fun happens, depending on what the user selects to open.

It's in these sub programs that I need to identify where we're at on a trigger. But I don't have anywhere in these sub programs where I can add the trigger without editing the source. So I was hoping to add my trigger in login.w to capture the event globally and report on the current program. But at that point the only program in the call stack is login.w. So I sort of need to do the reverse.
 
I wonder if something like Pro*Spy Plus would be helpful? It has some limitations and bugs but I find it's helpful for some tracing/debugging scenarios.
 
Thanks for replying Rob. Appreciate it. I think I've found a workable solution by querying SELF:INSTATIATING-PROCEDURE:FILE-NAME. It's a bit cludgy, and doesn't always work, but it's a working solution.
 
Back
Top