Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox Newsgroups  |  Paradox Web Sites  |  Paradox Book List  |  FAQs From The Corel FAQ Newsgroup  



Version 1.1 (2000.03.25) 
edited by Paradox FAQ Team
Reposted by Mike Irwin: 2001.02.10
 
==================== 
0. Introduction 
==================== 

This FAQ addresses problems of maintaining the 
Windows Z Order when calling and returning between forms. 

------------------------------- 
 0.1 Legal Info and Disclaimers 
------------------------------- 

Paradox is a trademark of Corel. 
Borland Database Engine (BDE) is a trademark of Inprise. 

The information provided in this FAQ is provided "as is" 
and is not warranted in any way. The information provided 
in this FAQ is not endorsed or authorized by Corel or 
Inprise in any shape, form, or manner. 

The editors claim NO responsibility for ANY illegal 
activity regarding this file, or as a result of someone 
reading this file. 

You may distribute this file, as long as the copies are 
complete, unaltered, and are in electronic form only. 

------------- 
 0.2 Feedback 
------------- 

Please send feedback in a Corel Paradox newsgroup or the 
news:comp.databases.Paradox newsgroup to any of the FAQ 
Team mentioned in the "FAQ: FAQ FAQ" document. 
Please preface the subject of your post with the string 
"PDXWIN FAQ" to alert Team members to the function of 
the message. 

Please specify the FAQ name and section number the 
comment applies to, if any. 

============================== 
1. General Information 
============================== 

Within ObjectPAL, one form can open another. 
Prior to version 9, the following code may be used 
within a form (called Form1.fsl, for example): 

var 
   foForm2     Form 
endVar 
   foForm2.open(":alias:Form2", 
                WinStyleDefault+WinStyleHidden) 

and the programmer can expect that the called form 
(Form2.fsl here) will become visible as soon as it 
executes a "show()" command, very often in the 
page::arrive() method. 

When Form2 closes one will expect to see Form1 on top 
of the Z Order, as before. 

In version 9 neither one of these assumptions holds true. 

======== 
2. Why ? 
======== 

This appears to be the result of at least two minor bugs in 
Paradox 9. 

========== 
3. Workaround 
========== 

In this section we provide the recommended code for 
invoking a form and for getting rid of it, with reasons. 
This code is also available in a separate FAQ. 

========== 
3a. Recommended Calling Procedure 
========== 

var 
   foMySelf    Form 
   foForm2     Form 
endVar 
   if foForm2.open(":alias:Form2", 
      WinStyleDefault+WinStyleHidden) 
   then 
      if foForm2.wait() then 
         foForm2.close() 
      endif 
      foMySelf.attach() 
      foMySelf.bringToTop() 
   else 
      msgStop("Error", "Unable to open Form") 
   endif 

In this technique we see the following points: 

1. Use a separate variable for each form, so you don't get 
   confused about which form is being opened, etc. 

2. Use a naming convention. A naming convention makes it 
   easy to see what sort of an object a variable represents 
   without having to look for a declaration. A naming 
   convention is available in the Paradox FAQs, and is the 
   convention used in the code examples in the FAQs. 

3. In this case the code waits for the user to finish with 
   the secondary form (this is not necessary). Paradox will 
   provide a False value if the form is crashed, taken into 
   Design Mode, or closed with the system menu (or the "X" 
   button). In any of these cases there will be no form to 
   close. See (3b) below for more information. 

4. A second Form variable, foMySelf, is used to attach to 
   the calling form and to bring it to the top of the Z 
   order. This counters part of the Z order problem. 

========== 
3b. Recommended Returning Procedure 
========== 

page::arrive() 
;  This code ensures that the form comes to the top of the 
;  Z order, and then gets displayed. If operations have to 
;  be carried out before display, such as filtering, they 
;  can be done before these two lines of code. 

   bringToTop() 
   show() 
  
  

ReturnButton::pushButton() 
;  This is an example of what code might go into a button  
;  used by the user to signify the closure of the form; an 
;  "OK" or Cancel" button, for example. 

   formReturn(True) 

This last is therefore the only way that the form will 
return a True value. 

Note that the called form also issues a bringToTop(). This 
is to ensure that it will show as the uppermost form in the 
Z order. 

With version 9 of Paradox this behaviour is no longer 
guaranteed. 


Paradox Community Newsgroups


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.