?
Solved

Locating response windows

Posted on 2003-02-26
5
Medium Priority
?
211 Views
Last Modified: 2013-12-26
Here is the situation...

The application has frame window.  This frame window has an instance of a custom user object and that object has a function.  That function has one argument passed into it, a window argument passed by value.  That window would be the frame window.  In the function I need to search through all the open windows in the application to find the one that matches the name of a window pulled from a database.  Unfortunately this application has a few windows that are opened as response windows instead of sheets in the frame.  I need to be able to find these windows too, but I cannot do it with just the GetFirstSheet() and GetNextSheet() functions.

Does anyone have any suggestions?

Thanks in advance

CartoonJon
0
Comment
Question by:CartoonJon
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
EAServer earned 200 total points
ID: 8027530
CartoonJon

Then you are going to have each window that opens and closes register themselves to your frame window.

On your frame, create an instance variable that is an array of windows.

When each of your windows opens they can call a function on the frame and pass a reference of themselves to the frame like...

w_frame.of_AddWindow(This)

and the same when they close

w_frame.of_RemoveWindow(This)

the functions on the frame can add the new reference to the array, and remove it when the window closes.  Then it is just a matter of looping through the array when you need to do your lookup from the database like...

for counter = 1 to upperbound(iw_windowarray)
   if isValid(iw_windowarray[counter]) then
      //do your check for the match and exit the loop
   end if
next

Once you setup your frame, f you've been using inheritence properly, then you will only have to do this on your ancestor window, and all the rest will inherit that functionality.  If all your windows don't have a common ancestor then, that will be a little more work.
0
 

Author Comment

by:CartoonJon
ID: 8028501
That's a great solution, but unfortunately this application is huge and resources are stretched.  So keeping an array of open windows is a last resort solution.  Is there any other way accomplish this task?  Does powerbuilder keep track of open windows in any way that I can tap into.
0
 
LVL 2

Expert Comment

by:EAServer
ID: 8028849
Actually an array of windows won't add much if any strain to your resources.  The array elements are just reference variables, so they only hold the address of the window not the entire window.  Basically it is the equivalent to having an array of longs, as far as memory is concerned.  I can't think of a more efficient way to accomplish your task.  Also, while there are a ton of windows in your application it's unlikely that a user would have more than 10 open at a time.  If you code the function that populates the array properly, the array will never be bigger than the maximum number of windows the user opens during a session.

0
 

Author Comment

by:CartoonJon
ID: 8028872
Thanks a bunch.
0
 
LVL 2

Expert Comment

by:EAServer
ID: 8028880
Actually an array of windows won't add much if any strain to your resources.  The array elements are just reference variables, so they only hold the address of the window not the entire window.  Basically it is the equivalent to having an array of longs, as far as memory is concerned.  I can't think of a more efficient way to accomplish your task.  Also, while there are a ton of windows in your application it's unlikely that a user would have more than 10 open at a time.  If you code the function that populates the array properly, the array will never be bigger than the maximum number of windows the user opens during a session.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question