Amiga_DOS_Shell
Each window contains a pointer to the next window. The last window contains a zero. Thus, we can scan this list in a loop until we get a zero window pointer. Let's get the next window. Enter: mywind s@ wd_NextWindow -> mywind mywind (This is on the above line !!!)
\ Is it zero?
Since the Amiga is a multi-tasking system, it is possible for windows to be opening and closing while we scan the list of windows. When scanning any system lists you should first call Forbid() and Permit(). We did not do this in our interactive example because it is impolite to Forbid() other tasks for too long a time. To see how FindWindow uses the above technique to get the window names, see the following words in the listings:
GET.ACTIVE.SCREEN in popup_Menus.f
FindWindow filters out windows with blank titles, BACKDROP windows, and its own windows. POPUP MENUS
I wanted the user to be able to place the program's main window anywhere
on the screen and have the menu pop up right over that window. I also wanted
to use the left mouse button. Thus, I could not use Intuition Menus.
I decided to implement a pop.up menu toolbox as a stand-alone toolbox so
that it could be used with other programs as well.
COMPILING FindW!ndow
You can type in the source code for FindWindow or download it from GENIE
in the Amiga section. It is item number 14135.
|
RUN COM:JForth INCLUDE make_fw
To test the program, enter in JForth or the CLI: FindWindow -X 260 -F 3 You can modify and test the program directly from JForth without cloning it. To make this a permanent part of your Workbench, copy FindWindow to your C: directory; then RUN it from your startup sequence. I hope this program will be useful to you. If you have comments or questions, or would like to get the FindWindow program and source on a floppy disk, please feel free to contact me. All source code and executable files for In Search of the Lost Window can be found on the ACs TECH Disk Vol 2 Number 4 |