Sean,
evalTop_ allows us to declare variables and functions that are accessible by multiple different DXL programs that may be executed separately. This is not the need in this case.
I have a single program that provides a Main Window listing any number of proposed changes to a spec. The user is able to open these proposed changes in a window that allows them to view or modify the proposal. These View/Modify windows all contain some consistent menus, including for example View, which provides View-->Base and View-->Change.
Depending on the type of change proposal and the current state of the window, the availability and behavior of this menu will be different. A proposed deletion should only allow Base to be viewed, a proposed New should only allow Change to be viewed, and a proposed Modify should allow both to be Viewed. Depending on whether the user is currently viewing Base or Change, the check should be on one or the other when the user clicks the menu.
Depending on whether the change is against a requirement, glossary term, figure, etc. the tool will launch a different View/Modify window since each item has different things that are needed.
I have a method already to allow the user to open multiple View/Modify windows at once as long as they are different types, ie view/modify glossary and view/modify requirement may be opened at the same time.
This is because they do not share the same global DB window variable. However, multiple instances of a View/Modify requirement window would share the same global DB window variable. I'm trying to get away from this construct so that the user can open more than one of the same type of window. In order to do that, I have to get rid of the global DB window variable and store a list of open windows. This is all fine, but when the user clicks on a callback function that takes neither a DB nor a DBE, I need some way of knowing from which window the callback was executed. I haven't been able to find anything that would give me this information. I considered a global variable DB activeWindow, which would be updated on function gotFocus, but I can't seem to find a way to register a callback for window got focus. The other option is to get a handle on the active DB through some function that already exists or get the name of the active window if that is available, which could give me a hook into the list of open windows I could use.
I know that's a lot to read, and I appreciate you response. I did not know about evalTop_ and I'm certain it will be helpful to me for some reason or another in the future, but I'm still looking for a way of determining the active window.
Respectfully,
Ryan
------------------------------
Ryan Wood
------------------------------
Original Message:
Sent: Tue December 06, 2022 09:25 AM
From: Sean F
Subject: DXL Get Active Window
Hi Ryan,
>>For now, I am exploring the idea of having an external C# script executing in the background that sets an environment variable
Been a few years but I think you can define a top context global variable during DOORS startup using evalTop_ in
C:\IBM\Programs\DOORSClient9725\lib\dxl\startup.dxl
e.g.
-----
evalTop_ "string MenuWindow"
//MenuWindow has been defined as a top context global string so it can be referenced by any other DXL program during the DOORS session
MenuWindow = "abc"
print MenuWindow
----
This would keep the implementation inside DOORS rather than involving the operating system
------------------------------
Sean F
Original Message:
Sent: Wed November 30, 2022 03:41 PM
From: Ryan Wood
Subject: DXL Get Active Window
I have developed a large scale DXL program that utilizes multiple Windows. When dealing with the callback functions for MenuBar DBE elements, I would like to know from which Window the user clicked the MenuBar because, depending on certain states of the window, the availability and behavior would be different. Since the Sensitivity and the click event callback functions take nothing but an integer, I need some sort of function that I can use to determine the Active Window. Something like current() that returns DBE. Even a function that just returns the title of the Active Window would be enough. Or a function that executes when a Window gets focus. Any one of those options would allow me to know from the Sensitivity or click event call back function which window is triggering the callback.
There is nothing I can find in the DXL Reference Manual, and my search of all DXL Perms that existed as of version 9.3 (SmartDXL website has a list) has not yielded anything useful.
There must be something available if multiple View Module Windows can be open at once, and the application knows which File menu was clicked, etc.
------------------------------
Ryan Wood
------------------------------
#Sustainability
#EngineeringRequirementsManagement