Q: I am using an ON KEY LABEL in my program which I have active while using a screen form to edit records. My screen form contains a memo window. Pressing the ON KEY jumps to another work area, opens another database, and enters BROWSE mode. Upon quitting the BROWSE, I return to the original work area. The memo window is now a memo marker and an error message displays the message Window Not Defined. What has happened?
A: The Form.gen file, which is responsible for compiling your screen form, defines windows (for the memo window) to a default memory variable named window1. Merely activating another format file in another work area with a memo window caused the second format file to also DEFINE WINDOW WINDOW1. The second format file also does a DEACTIVATE WINDOW and RELEASE WINDOW WINDOW1 which eliminates the window defined by the first format file.
It would be necessary in this case for you to modify the .fmt file of either of the two windows and change the name of one of the windows so they are not in conflict.
The Bottom Line
Q: Why is it that Ctrl-Y does not work when I attempt to delete the last line in a band during my report design?
A: Ctrl-Y was modified in version 1.1 for use in the MODIFY COMMAND editor where there existed a problem with the ability to physically delete the last line. Correcting the problem there altered the functionality when editing bands in reports. The workaround is to move the second-to-last line down using F6 Select and then deleting the now-blank second-to-last line.
Windows With (Status) Bars
Q: After creating a screen form, I received the message Illegal Value when I attempted to display the data. From the way the information displayed, it appears as if a memo window which I have toward the bottom of my screen is causing it. How do I prevent the error?
A: You will need to move the window up where it will not overlap the status bar.
While in the design screen, you might not realize that the memo window will overlap the status bar because dBASE IV displays the status bar two lines above the position it will ultimately appear at in the final screen form. This is because the status bar always appears on line 22 and the virtual screen of the form designer is positioned two lines lower than the actual screen (to allow for the Menu and Ruler).
If you place a memo as a marker on row 20 or 21, and then proceed to size the window from that upper-left position (row 20/21) to a lower-right position and the status bar is on, you will get the error message you saw when you try to display data using the screen form. The window size will be truncated to accommodate the status bar. However, the resulting window size will be too small and will cause the error message.
Summary Commands Don't Echo Anymore
Q: I've made the switch from dBASE III PLUS to dBASE IV and everything has been pretty smooth with one exception. I have programs that produce reports that were summarized with record counts that are no longer being printed. It seems to me like the commands are either being ignored or some functionality has changed. Could you shed some light on this?
A: Actually, this is an issue that first presented itself when dBASE IV was originally introduced. In dBASE III PLUS, SET PRINT ON gave printed results to commands like COUNT and SUM. In dBASE IV, it is necessary to direct the result of a COUNT, SUM or AVERAGE statement to a memory variable. Then use a syntax such as
to print the result on the page. Although this would appear to be a removal of functionality, all the summarizing features noted here are now directly implementable in a dBASE IV report. The only reason COUNT and SUM statements appearing after REPORT FORM commands were implemented in this way is because there was no way to include them in the more limited dBASE III PLUS report generator.
High Resolution Error
Q: While attempting to run a program I made with the Application Generator, the program was halted by an error referencing a variable called gn_error and the message said the variable was not found. I did not create this variable. What causes this error?
A: There is a problem with Menu.gen when generating code for EGA43 video mode. The .prg file references the variable gn_error before it initializes it. This results in an error when you try to run the program that says Variable not found gn_error. The workaround is to avoid using 43 line mode when generating or, if 43 lines are required, modify the .prg file generated by the Applications Generator and comment out two IF structures near the beginning of the code. The first begins with
IF gc_display <> "EGA43"
and the other is right after it and starts with
IF gn_error <> 0
These two structures just make sure that the display mode was actually set to 43 line mode and give an error message if it couldn't set it. Commenting them out just removes this safety feature.
QBE Takes Over the Show
Q: I am developing an application where I want to give the users access to the QBE interface but do not wish for them to be able to change or update any records while in QBE. I tried to USE the data file with the NOUPDATE qualification and then enter QBE to create the query. When I press F2 to view the selected data, I am still able to edit it. Since I can't trap the F2 key here, the situation looks bleak. Have you any suggestions?
A: The .qbe file is overwriting your preferences for NOUPDATE by opening any specified files again. Try copying the code from the .qbe into a .prg file and executing the view as a program. If the view is not complex (that is it does not CREATE, SORT, or INDEX but can USE, SET INDEX, SET FILTER and SET FIELDS), you can set this up as a .vue file that is still called from your program using SET VIEW TO.
Print Menu Availability
Q: When I start to print a report from the Control Center, I highlight the report name and press Enter. The Print menu will appear. I then go to the Print: Destination menu to select the printer I want to print with. It's not actually a pop-up menu but more like a multiple choice list within a single window. If you run the report from a .prg or the dot prompt, you don't get the Print menu. Is there any way to activate it?
A: No, sorry. You can program a list of printer drivers into a pick list using the Application Generator without a lot of trouble. A pick list in a popup can be used with the PROMPT FILES LIKE *.pr2 option. You also might try saving different drivers into different print form (.prf) files and name the .prf files so that they are easily associated with the different printers you have.
If you're running from the dot prompt or a program and it is not necessary to give the user a choice, simply issue the command
_pform = ".PRF"
_pdriver = ""
right before you run the report.
Q: I'm using a name and address database and normally work from the dot prompt. After making an append and pressing Ctrl-End to save it, the record pointer always goes to the last record in the index. I would like to be able to call a program to print some information from this newly appended record, but the record pointer does not follow it. dBASE III did not work this way; it followed the new addition.
A: Under the Records menu is the option Follow record to new position. Change this to YES and the pointer should follow the record in the index.
Macro File Swapping
Q: I have an application wherein I can call several macros from an edit routine. So many, in fact, that I need to be able to change macro files. Is there a way I can do this without leaving the edit routine?
A: By using ON KEY LABEL, you can call a UDF that could allow you to change macro files. The ON KEY LABEL statement would appear in the setup portion of your program (or in a setup program that loads when you first begin a dBASE IV session). The statement would appear as