Ask Dr. DePhobia - Questions and Answers about Clarion
by Jim DeFabia
Published 1999-04-01
Printer-friendly version
Q:
What's new in the Clarion 5A release?
A:
Lots of exciting stuff! While Clarion 5A is primarily a bug fix
release, there are several enhancements that enable you to easily
add functionality to your applications. Here is a short list:
- The most exciting feature is the Beta 2 release of the
Wizatrons. You will find full instructions on using them in the
Wizatron Handbook PDF. There are many changes to the
Wizatrons.
- Print Preview now has an option to specify Pages to Print (File
-> Pages to Print). Yes, you get this in every report which uses
Print Preview without changing a thing in your application.
- There are also new properties in the PrintPreviewClass to
control this in code. I cover a few of these in another question in
this column.
- There is a new EIPManager class and an EditSpinClass.
- The QBE List interface has been implemented. This is described
on page 131 of the Application Handbook. (It was documented, but
not implemented in prior releases). I cover some of this
functionality in another question in this column.
- There are several new classes in the ABC Class Library. These
are all documented in the revised Application Handbook PDF file and
a separate PDF of the new portions is also provided. This gives you
a printable version you can tuck in the back of your Application
Handbook.
- An Entry Control with a lookup enabled now has the ability to
perform additional field assignments (on the Actions Tab of an
Entry control).
- The TopScan database utility now has online help.
Q:
I want to use the built-in QBE feature to limit a list to a range
of values, but the Query form only allows a field to be populated
once. Is there an easy way to query on a range?
A:
Query, Query on the range, where the deer and the antelope...
Sorry, got lost in song for a moment.
So you want to query on a range of values, well Clarion 5A now
has the QueryListVisual and QueryListClass with full template
support for a list-type query.
Let's look at how this works.
- On a Browse procedure, populate a BrowseQBEButton
control template.
- Right-click on the BrowseQBEButton and select Actions.

- Press the QBE Options button.This allows you to set the options
for the QBE process.

- Choose List from the drop-list of QBE interface
choices.
Next, you would either check the Auto
-populate box, or Press
the Fields button to select the fields to populate. For the purpose
of this article, let's assume that you only want to enable QBE for
a single field -- the LastName field.
- Make sure the Auto-populate box is not checked and press
the Fields button to select the fields to populate.
- Press the Insert button.

- Press the ellipsis button next to Field and select the field
from the file schematic dialog.
- Provide a Title for the field. This is the label that will
appear in the QBE drop-list.
- Press the OK buttons all the way out to the Window Formatter,
then Close the formatter (saving your changes).
- Make and run the application.
The browse procedure now has the functionality you wanted. When you
run a query, the window looks like this:

And it allows you to specify a range by inserting two query
lines--one with a >= and the other with a <= operator. This
specifies a range and gives you the query you want.
Q:
I have several reports that provide a summary on the last page.
Some users need the entire report, and others only need the
summary. Is there any way I can use the same report to print in
either format? I know I can copy the procedure and modify it to
print only the summary, but I don't want all that duplication. Is
there any way I can print only the last page? Can you save me from
this duplication of effort?
A:
The new, improved PrintPreview class has come to your rescue. All
you need to do is set the PagesToPrint property of the Previewer
object.
Look for the following embed point:
Local Objects--
Previewer--
SetDefaultPages
CODE
Parent Call
<embed your code here>
Embed this code:
SELF.PagesToPrint = RECORDS(SELF.ImageQueue)
SELF.CurrentPage = RECORDS(SELF.ImageQueue)
This specifies that only the last page should print and that that
page should display.
To use your report for dual purposes, merely wrap a condition
around that line; i.e.,
IF <some Condition>
SELF.PagesToPrint = RECORDS(SELF.ImageQueue)
END
Now you can use the same report for both purposes.
Q:
I like the way you can specify the action after a successful add in
the SaveButton control template; however, I want to let my users
decide whether they want repetitive adds or not. How can I let them
set this in a "User Preferences" procedure?
A
You want your user to control the way your application behaves?
GOOD IDEA! The best software allows users to define behavior. You
have mastered the art of good user interface design.
Now, let's look at how we can easily accomplish this in Clarion
5.
- First, create a global variable and define it so it can has a
value of 1, 2, 3, or 4.
- Next, populate this as a control on your user preferences
procedure. This allows the user to set it.
-
I used an OPTION control defined as follows:
OPTION('Insert Mode'),AT(253,20,50,78),USE(GLO:InsertModeFlag),BOXED
RADIO('Default'),AT(261,38),USE(?GLO:InsertModeFlag:Radio1),VALUE('1')
RADIO('Caller'),AT(261,50),USE(?GLO:InsertModeFlag:Radio2),VALUE('2')
RADIO('Batch'),AT(261,62),USE(?GLO:InsertModeFlag:Radio3),VALUE('3')
RADIO('Ask'),AT(261,73),USE(?GLO:InsertModeFlag:Radio4),VALUE('4')
END
Next in the Update Procedure, embed this code in the embed point immediately
before opening the window (WindowManager, INIT, Priority 7800)
EXECUTE GLO:InsertModeFlag
SELF.InsertAction = Insert:None ! default
SELF.InsertAction = Insert:Caller ! return to caller
SELF.InsertAction = Insert:Batch ! add another
SELF.InsertAction = Insert:Query ! prompt user to add another
END
Of course, you may not want all four choices (setting the default behavior to
default seems redundant, don't you think?). Just adjust this to your preferences.
You can read more about the InsertAction property in the Application Handbook.
Printer-friendly version

Copyright © 1999-2009 by CoveComm Inc. All Rights Reserved.
Reproduction in any form without the express written consent of CoveComm Inc.,
except as described in the subscription
agreement, is prohibited.
Clarion Magazine ISSN 1718-9942