?
Solved

Locating response windows

Posted on 2003-02-26
5
Medium Priority
?
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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 NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

801 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