I.T. Discussion Community!
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

November Edition
Subscribe now! It's Free!
Enter your email:

   ► KBParadox Knowledge Base  Print This    All Groups  

Paradox Flashcards Library

These FlashCards are contributed by you (our online community members). They are organized by our knowledge base topics. Specifically, by the Paradox sub-topics.

Contribute a Flashcard

95 Corel Paradox / ObjectPAL Coding FlashCards

Group: Corel Paradox / ObjectPAL Coding


Topic: Paradox & ObjectPAL

ObjectPAL Array (Array[] type)

Arrays in ObjectPAL use a 1-based indice.

Use size() to get the number of elements. size() returns 0 if the array has no elements.

var
  MyArray Array[4] String ;Fixed size array.
  i LongInt
endVar

MyArray[1] = "Mike"
MyArray[2] = "Lisa"
MyArray[3] = "Felicia"
MyArray[4] = "Nathan"

if MyArray.size() > 0 then
  for i from 1 to MyArray.size()
    msgInfo("", MyArray[i])
  endFor
endIf

Posted By Mike Prestwood, Post #102138, KB Topic: Paradox & ObjectPAL
Q&A: ODBC - Intersolv v3.11 driver with Pdx9 installation disk
Question:

Currently using Pdx 11.0.0.302 on laptop with Win7 64 bit, no problems with essentially interactive use for year past. 

Now have need for access to Pdx tables by ODBC. Have installed drivers supplied on the Pdx 9 install disk but the drivers do not show up on the Drivers tab of the ODBC Administrator window.

In past, have successfully installed drivers ex Pdx 9 cd with same Pdx 11 set up on machines running Win XP. Except this time used a backup cd copy of the original installation disk. Made 2 attempts, first prompted for licence code, entered and it ran. The driver files have copied to the default location as prompted by the setup procedure. Also accepted default installation path for Pdx 11.




Topic: Paradox ODBC Drivers

Tip: To Use ODBC, Set Up a DSN

If you add an ODBC data source, you must define its DSN before you can connect to that database.

Posted By Mike Prestwood, Post #100596, KB Topic: Paradox ODBC Drivers



Topic: Tool Basics

Q&A: 64-bit Version of Paradox for Windows
Question:

I wanted to check out if there was a 64 bit Paradox for Windows. I believe this database tool is excellent especially in defining a database.

Answer:

No 64-bit version of Paradox for Windows. Just the current 32-bit version and the older 16-bit version. However, 64-bit versions of Windows can run 32-bit programs very well. If you're running Vista 64-bit, you may wish to stick with Paradox 9 but Vista isn't a good OS for older programs. Interestingly enough, Paradox 9, 10, and 11 run fairly well on Windows 7 which means you can keep using your Paradox applications long into the future (just skip Vista).

Posted By Mike Prestwood, Post #101303, KB Topic: Tool Basics
Q&A: Paradox 14 Is Paradox 11 SP2
Question:

Does Paradox X4 have any new features over X3?

Answer:

No, Paradox X4 (version 14) is Paradox 11 with SP2 applied (build 11.0.0.411). There is no version 12, 13, or 14. In fact, no new features since version 10. Version 11 does have some significant bug fixes though and SP2 has even more fixes. Also, there are lots of rumors that Corel will release a patch for Paradox 11 soon that will address the Vista problems many users are struggling with.

Posted By Mike Prestwood, Post #101067, KB Topic: Tool Basics
Q&A: Purchasing Paradox
Question:

How can I purchase Paradox?

Answer:

Answer from Corel...

Paradox was not updated from Paradox 10. It was given a new look, but the functionality remains mainly the same. Paradox 11 is available in the WordPerfect Office Professional version and can be purchased through Corel's online store or by calling us [Corel].  Paradox is also available as a standalone if you already own WordPerfect Office, and is [available] through our licensing program.  Within North America, please call 1-800-772-6735, Corel's Customer Support Services, to purchase the Paradox upgrade. We are open from Monday - Friday, 9:00 am - 7:00 pm E.S.T. and would be happy to serve you. For customers outside of North America, please visit www.corel.com/contact to locate a Corel Customer Support Services Center nearest you.

Posted By Mike Prestwood, Post #100870, KB Topic: Tool Basics
Q&A: Whats new in Paradox 13 (Office X3 Pro)
Question: Whats new in Paradox 13? My Paradox Version is 9 Developer. Is it right what Paradox 9 forms are not compatible with Paradox 13? Is there anything else happens?

Answer:

[answered by Mike Prestwood] Paradox version 11 shipped with WPO X2 and Paradox 11 with SP2 ships with WPO X3 and WPO X4. Paradox 11 is essentially the same as Paradox 10 with NO NEW features (minor defects and compatibility issues were resolved). There is no Paradox 12, 13, or 14. Currently Corel states that Paradox is in maintenance mode (meaning no new features are planned).

As for your Paradox 9 forms, you can simply resave them and/or redeliver them in the new version. If you used the Application Framework in 9, it's not in 10 nor 11 so you have some work to do.

Posted By count-dowm , Post #100705, KB Topic: Tool Basics



Topic: Installation, Setup, & BDE

Q&A: Corel Paradox for Windows on Vista
Question:

Does Corel Paradox for Windows run on Vista? If so, are there any issues? What about Windows 7?

Answer:

Paradox 9, 10, and 11 run well on Windows 7, so skip Vista. Paradox 9 does run on Vista (not well, but you can do it) and Paradox 10 and above do run but there are some issues to keep an eye out here for detailed notes. If you have an earlier version, it will run on Vista but we do recommend you upgrade to Paradox 9 or Paradox Runtime. Refer to the links on this FAQ for complete and detailed instructions.

All the latest versions of Paradox run very well on Windows 7 including Paradox 9, 10, and 11. We are currently recommended to our clients that they skip Vista.

Posted By Mike Prestwood, Post #100449, KB Topic: Installation, Setup, & BDE
Q&A: FAQ: Corel Paradox crashes on startup
Question: I have recently started learning to work with Paradox 9 and have found your book Paradox 9 power programing extremely helpful. I have encountered a problem and hope that you will be kind enough to assist. The problem has occured twice now so I don't think it is a finger problem. When I nearly reach a stage of completion, on opening the program it goes into tile mode, a few seconds later the program tell me to abort (Corel Paradox crashes on startup). Should you be able to give me any assistance I would be most appreciative.

Answer:

Using Paradox 9 on XP with CorelDraw or any other programs is fine. No problem there. Not sure what the issue is though. You might want to try starting Paradox with a clear desktop using the -c command line option. You can search the help file for command line options for usage. If that isn't the problem, then you must have a bad installation of Paradox (try reinstalling) or some other program is causing it to crash (doubtfull with XP memory management).

Posted By Mike Prestwood, Post #100256, KB Topic: Installation, Setup, & BDE
ObjectPAL File Extensions

Paradox for Windows has two primary file types: source files and delivered files. Source files in Paradox are binary but can can be opened in later versions of Paradox and even in earlier versions if you don't use any new features: .FSL = Form, .RSL = Report, .SSL = Script, and .LSL = Library. Since Paradox source files do not compile to an EXE, Paradox developers tend to use a startup form or script to start the application.

Q&A: Paradox 11 & SQL Server-Cannot Select BDE Alias
Question:

I recently upgraded to Windows XP and now Paradox 11 cannot open SQL Server database tables. In the open-dialog-box, I see the aliases, but cannot select one which is linked to a SQL server database. The same thing happens, trying to create a QBE query, new form, etc... All existing queries, forms, ... are working (using these aliases).

Answer:

Solution was to apply the latest BDE patch, all works as it should.

Posted By Mike Prestwood, Post #100436, KB Topic: Installation, Setup, & BDE
Q&A: Paradox 11 Desktop Settings do not Save (PdxRegCl.exe)
Question:

Paradox does not remember desktop settings. I just installed Paradox 11 on a new computer and my working directory and other settings do not stick when I restart Paradox. Why?

Answer:

Paradox 11 installs a registry cleaner (PdxRegCl) and that is the culprit. The quick fix is to delete the PdxRegCl.exe file in the Paradox folder. For a more complete "cleanup", delete the PdxRegCl.ini file and any PdxRegCl registry entries you find.

Posted By Mike Prestwood, Post #101574, KB Topic: Installation, Setup, & BDE



Topic: Paradox Tables

Q&A: Copy Paradox Tables with Confidence
Question: What is the best way to copy my Paradox tables?

Answer:

What I recommend for our clients is to make sure no one is using the tables and then copy the entire folder. To make sure no-one is using the tables, check for .LCK lock files. If they exist, try deleting them. If you can delete them, then they were left over from an abandoned BDE session. Next, rename the folder to lock out users for the duration of the copy. Copy the folder, then rename the folder back.

To copy live tables, I suggest you write an application in Paradox, Delphi, etc. that uses the BDE copy table code. It's safe, effective, and you can build in error checking.

Posted By Mike Prestwood, Post #101177, KB Topic: Paradox Tables
Tip: Deleting .Val files is sometimes okay and necessary.
Referential integrity and other settings stored in .VAL files sometimes interfere with the development of a project. This particularly is a problem when you are restructuring a child table in a referential integrity link. If this happens to you and you don't mind losing the validity checks for a table or for a set of tables, go ahead and delete or, better yet, rename them.
Posted By Mike Prestwood, Post #100601, KB Topic: Paradox Tables
Tip: Equivalent Autoincrement Field Type
Autoincrement fields have the same type as a long integer. This is important to know when linking with detail tables.
Posted By Mike Prestwood, Post #100620, KB Topic: Paradox Tables
Tip: Know Your Field Types!
If you are developing an application using local tables and you know you are eventually going to move the data onto a SQL server, then do yourself a favor and spend a few hours studying the field and table naming rules of your target SQL server before you create your first table. While creating your local tables, use a naming convention that uses common rules. If you use the naming rules in common between the two database types, then you will save yourself time when you move your data to the SQL server because SQL servers often have different naming rules from the naming rules in Paradox.
Posted By Mike Prestwood, Post #100595, KB Topic: Paradox Tables
Q&A: Paradox 10 table structure?
Question: I was just reviewing the Paradox Table Specs in your Paradox developer reference area. I found specs through Paradox 7 only, and I'm really interested in Paradox 10. Is it available?

Answer:

No. Actually Paradox 7 "table structure" is the latest very flexible table structure. The only table structures are 1...3.x, 4.x, 5, and 7. No such thing as a Paradox 9 or 10 or 13 table structure.

Posted By Mike Prestwood, Post #100028, KB Topic: Paradox Tables
Tip: Paradox locking on edits
If your Paradox application appears to lock up when you attempt to edit a record, you may want to disable your virus scan application to see if that is the problem.
Posted By Daniel Fought, Post #100855, KB Topic: Paradox Tables
Definition

Paradox Net Dir

Definition:

Tip: Do not point the Net Dir to the system root. For example, if your operating system is installed on Drive C, then do not point your Net Dir to C:\. It is okay to point it to a folder within the system drive (i.e. C:\Temp).

Posted By Mike Prestwood, Post #100872, KB Topic: Paradox Tables
Tip: Table Lookups and Directory Paths (more than 8 characters)
Lookup tables for Paradox table level 5 or lower are limited to 8 characters. If you use lookup tables in other directories, upgrade all tables involved to the Paradox table level 7. You can do this with Table Repair or by defining a level 7 feature (for example, a descending index).
Posted By Mike Prestwood, Post #101195, KB Topic: Paradox Tables



Topic: OPAL: Language Basics

Tip: Before You Code

Before you code in ObjectPAL, ask yourself two questions. Does Paradox already do this? Is there a better and easier way? Remember, simple solutions for simple problems.

Posted By Mike Prestwood, Post #100591, KB Topic: OPAL: Language Basics
Definition

Camel Casing

Definition:

Camel Casing capitalizes the first character of each word except the first word, so it frequently looks like a one or two hump camel. Used by many languages including Paradox's ObjectPAL.

myAge
theBoxCar

You can contrast Camel Casing with Pascal Casing which capitalizes the first character of each word (including acronyms over two letters in length) and was popularized by Pascal.

Posted By Mike Prestwood, Post #101236, KB Topic: OPAL: Language Basics
Tip: Don't Leave Experiments In Your Code!

If, in experimentation, you use sleep(), doDefault, or DisableDefault to overcome some odd or misunderstood behavior, do not leave the commands in your code. If using the command didnt seem to make a difference, then take it out. Use commands only when they are called for. One great way to really learn the event model and the power of these and other commands is to experiment with adding them. Remember to take them out, however, if they do not do what you wanted.

Posted By Mike Prestwood, Post #100605, KB Topic: OPAL: Language Basics
Tip: Object.Method() Syntax

The syntax of object.method() is consistent throughout ObjectPAL. If an object with the name box has code on its mouseClick event, you can access that code with box.mouseClick() method from any other object. When this code executes, the UIObject method mouseClick() calls the mouseClick event.

How do you know when you can call the code in a built-in method of an object? Easy, if the run-time library has a method equivalent, then you can use itfor example, mouseClick() and pushButton().

Posted By Mike Prestwood, Post #100627, KB Topic: OPAL: Language Basics
Definition

ObjectPAL

Definition:

ObjectPAL stands for Object Paradox Application Language. The acronym portion of the name (PAL) comes from the DOS version of Paradox. The term Object was added to the name because ObjectPAL is an object-based event-driven programming environment that is much more advanced then its PAL predecessor.

Posted By Mike Prestwood, Post #100611, KB Topic: OPAL: Language Basics
ObjectPAL Assignment (=)

ObjectPAL uses = for it's assignment operator.

var
 FullName String
   Age SmallInt
endVar
  
FullName = "Randy Spitz"
Age = 42
Posted By Mike Prestwood, Post #101381, KB Topic: OPAL: Language Basics
ObjectPAL Case Sensitivity (No)

ObjectPAL is not case sensitive. My preference for ObjectPAL is to follow the camel casing promoted in the examples and help files originally developed by Borland.

All of the following are equivalent:

msgInfo "", "Hello"
MsgInfo "", "Hello"
msginfo "", "Hello"
MSGINFO "", "Hello"

Variables are not case sensitive.

Var
FullName String
endVar
fullname="Mike Prestwood"
msgInfo("", fullNAME)
Posted By Mike Prestwood, Post #101341, KB Topic: OPAL: Language Basics
ObjectPAL Code Blocks (endXxxx)

ObjectPAL code blocks are surrounded by statement ending keywords that all use End with camel caps such as endMethod, endVar, endIf, endSwitch, and endTry.

method
endMethod
 
var
endVar
 
if
endIf
 
switch
endSwitch
 
try
endTry
Posted By Mike Prestwood, Post #101495, KB Topic: OPAL: Language Basics
ObjectPAL Comments (; and { ... })

Commenting Code
ObjectPAL uses ; for a single line comment and { } for a multiple line comment.

;Single line comment.

{
Multiple line
comment.
}
Posted By Mike Prestwood, Post #101506, KB Topic: OPAL: Language Basics
ObjectPAL Comparison Operators (=, <>)

Common comparison operators:

= equal
<> not equal
< less than
> greater than
<= less than or equal
>= greater than or equal

'Does ObjectPAL evaluate the math correctly? No!
If .1 + .1 + .1 = .3 Then
msgInfo("", "correct")
Else
msgInfo("", "not correct")
endIf
Posted By Mike Prestwood, Post #101875, KB Topic: OPAL: Language Basics
ObjectPAL Constants (const..endConst)

In ObjectPAL, you declare one or more constant values within a const..endConst block. Optionally, you can specify the dataType by casting the value as part of the declaration. If you do not specify the data type, the data type is inferred from the value as either a LongInt, a Number, a SmallInt, or a String. As with variables, the const..endConst block can come within a method or procedure as the first bit of code, or in the Const window. Putting it above the method or procedure is allowed but has no significance so don't.

const
kFeetToMeter = Number(3.2808)
kMeterToFeet = Number(.3048)
kName = String("Mike")
  kCA = "California"     ;String inferred.
endConst
Posted By Mike Prestwood, Post #101730, KB Topic: OPAL: Language Basics
ObjectPAL Development Tools

Corel Paradox for Windows (was Borland Paradox). Also, Borland used to offer a Paradox for DOS tool which support it's Paradox Application Language (PAL) which is not compatible with ObjectPAL. The biggest drawback to Paradox is that Corel does not have anyone at Corel actively developing Paradox for Windows (as opposed to Microsoft Access which does).

ObjectPAL Edit Record (insertRecord, postRecord, edit)

In ObjectPAL, you use Cursor.InsertRecord to add a new record, Cursor.postRecord to post the record, and Cursor.deleteRecord() to delete it. To edit a record, you must put the cursor into edit mode, Cursor.Edit(). (A cursor applies to both a TCursor and UIObject.)

ObjectPAL gives you tremendous flexibility with editing data and includes many additional commands such as insertAfterRecord and isEdit. For dBASE tables, you can also use unDeleteRecord() to un-delete a record. See the ObjectPAL help for more commands.

The following code snippet adds a record to a given TCursor with FullName and Created fields:

tc.edit()
tc.InsertRecord()
tc.FullName = "Barack Obama"
tc.Created  = today()
tc.postRecord
Posted By Mike Prestwood, Post #102112, KB Topic: OPAL: Language Basics
ObjectPAL Empty String Check (isBlank() or not isAssigned())

In ObjectPAL, an empty variable can be unassigned (essentially null) or blank (equivalent to ""). You have to use both isBlank and isAssigned to check for an empty string.

var
 s String
endVar
  
;s = ""  ;Uncomment to test 2nd case.
 
if isBlank(s) or not isAssigned(s) Then
 msgInfo("", "empty string")
endIf
Posted By Mike Prestwood, Post #102041, KB Topic: OPAL: Language Basics
ObjectPAL End of Statement (whitespace)

Languages Focus: End of Statement

In coding languages, common End of statement specifiers include a semicolon and return (others exist too). Also of concern when studying a language is can you put two statements on a single code line and can you break a single statement into two or more code lines.

ObjectPAL End of Statement

ObjectPAL is a bit unique in that it doesn't use a semicolon nor a return to mark the end of a line, it uses whitespace which can be a return, space, or tab. This is a bit unusual but does allow for some nice formatting of code.

msgInfo("", "Hello1")
msgInfo("", "Hello2")
msgInfo("", "Hello3")

;The following single line of code also works.
msgInfo("", "Hello4") msgInfo("", "Hello5")

;Two or more works too:
msgInfo
("", "Hello6")
Posted By Mike Prestwood, Post #101694, KB Topic: OPAL: Language Basics
ObjectPAL If Statement (If..Else..EndIf, or switch)

ObjectPAL supports a simple If...Else...EndIf statement.

Notice ObjectPAL does not support an ElseIf feature as part of an if statement. Instead use a switch statement

'Does ObjectPAL evaluate the math correctly? No!
If (.1 + .1 + .1) = .3 Then
  msgInfo("", "Correct")
Else
  msgInfo("", "Not correct")
EndIf
 
'Switch statement example.
switch
case x = "Nate": MsgInfo("", "Hi Nate")
case x = "Felicia": MsgInfo("", "Hi Felly")
  otherwise: MsgInfo("", "Who are you?")
endSwitch
Posted By Mike Prestwood, Post #101386, KB Topic: OPAL: Language Basics
Tip: ObjectPAL Level Beginner or Advanced?
Whether your ObjectPAL level is set to Beginner or Advanced, you can use all the ObjectPAL methods, procedures, properties, constants, keywords, and so on. The level panel is a help filter used just for learning purposes. However, because you could in effect "hide" code from yourself, I recommend setting this to Advanced (never use beginner).
Posted By Mike Prestwood, Post #100608, KB Topic: OPAL: Language Basics
ObjectPAL Literals (quote)

Literals are quoted as in "Prestwood".  If you need to embed a quote use a slash in front of the quote as in \"

In ObjectPAL, string literals are limited to 255 characters but there's nothing preventing you from using multiple string literals together as in:

msgInfo("", "Hi Mike: " + "You can add literals together in ObjectPAL")
msgInfo("", "Hello")
msgInfo("", "Hello \"Mike\".")
  
;Does ObjectPAL evaluate this simple
;floating point math correctly? No!
If (.1 + .1 + .1) = .3 Then
 msgInfo("", "Correct")
Else
 msgInfo("", "Not correct")
EndIf
Posted By Mike Prestwood, Post #101529, KB Topic: OPAL: Language Basics
ObjectPAL Logical Operators

ObjectPAL logical operators:

and and, as in this and that
or or, as in this or that
Not Not, as in Not This

;Given expressions a, b, c, and d:
if Not (a and b) and (c or d) then
  ;Do something.
endIf
Posted By Mike Prestwood, Post #101898, KB Topic: OPAL: Language Basics
ObjectPAL String Concatenation (+)

String literals s are limited to 255 characters but you can simply add two strings together as in:

s = "A long string." + "Another long string."
var
FirstName  String
  LastName  String
endVar
 
FirstName  = "Mike"
LastName  = "Prestwood"
msgInfo("", "Full name: " + FirstName + " " + LastName)
Posted By Mike Prestwood, Post #101593, KB Topic: OPAL: Language Basics
ObjectPAL Unary Operators

The ObjectPAL unary operators are:

+
-
Not

ObjectPAL Variables (var x SmallInt endVar)

Declaring variables is optional unless you click Program | Compiler Warnings while in the ObjectPAL editor for every form, script, and library you create. Using Compiler Warnings is strongly recommended to avoid incorrectly typing an existing variable and to avoid any confusion about variable scope. Also recommended is turning on Compile with Debug for every form, script, and library too for tighter, cleaner code.

Undeclared variables are AnyType variables. Common data types include Currency, Date, Datetime, Logical, LongInt, Number, SmallInt, String, and Time.

Declare local variables within a method. If you want a local static variable (retains it's value because it is not destroyed), declare the varialbes above the method. Variables declared in an object's Var window are visible to all methods attached to that object, and objects that it contains.

var
    FullName String
    Age SmallInt
    Weight Number
endVar
 
FullName = "Mike Prestwood"
Age = 32
Weight =154.4
msgInfo("", FullName + ", age=" + String(Age) 
             + ", weight=" + String(Weight))
Posted By Mike Prestwood, Post #101568, KB Topic: OPAL: Language Basics
Tip: Study The Experts

Paradox provides experts that generate code at the field level, in the form open, etc. It is a good idea to study the ObjectPAL generated by these experts.

Posted By Mike Prestwood, Post #100604, KB Topic: OPAL: Language Basics



Topic: Interactive Paradox: Getting Going

Definition

Data Model

Definition:

A data model is a diagram of the tables used in a form or report. It identifies the tables, defines the relationships between them (links), and has features including the ability to filter each table and mark any table as read-only. You can save a data model (.dm) and reuse it with another form or report.

Posted By Mike Prestwood, Post #101253, KB Topic: Interactive Paradox: Getting Going
Tip: Disable Change Directory Warnings
You can disable the warning prompts that are displayed when you change working or private directories. Clear the check box for the Don't show warning prompts when changing directories option in the Preferences dialog (advanced tab). To do this, first display the Preferences dialog box by selecting Edit | Preferences. Then, select the Advanced tab and clear the check box for the Don't show warning prompts when changing directories option.
Posted By Mike Prestwood, Post #100623, KB Topic: Interactive Paradox: Getting Going



Topic: Interactive Paradox: Forms

Tip: Ctrl+Spacebar Displays Lookup Table
When users press CTRl-SPACEBAR to display a lookup table, remember to let them know that they can use CTRL-Q to locate a value. This is an interactive feature that can greatly enhance the user's perception of your application.
Posted By Mike Prestwood, Post #100600, KB Topic: Interactive Paradox: Forms
Tip: Design Your Apps to Look Like Windows
Design your forms using the default Windows color scheme. Your applications will look more professional and consistent with the predesigned Windows color schemes and various themes. I've seen WAY too many Paradox applications where the developer has used too many background colors on forms. Sometimes the use of a few nice colors for different areas of an application works well, most of the time it doesn't. I'm not saying don't add color, I'm just saying be tasteful. Some of the Paradox applications I've seen look HORRIBLE!
Posted By Mike Prestwood, Post #100603, KB Topic: Interactive Paradox: Forms
Tip: Objects On a Form Have Containership Hierarchy
You can alter the path of objects by moving objects around in the containership hierarchy. Move objects on the same level by selecting Format | Order | Bring to Front and Format | Order | Send to Back.
Posted By Mike Prestwood, Post #100609, KB Topic: Interactive Paradox: Forms
Tip: Paradox's Autofill Feature
Remember, autofill is a great feature that you should promote to your users. To automatically fill in a date field with today's date, for example, just press the SPACEBAR a couple of times. Make sure you add this type of help to any manuals or help files you develop for your application. Autofill works with Date, Time, Timestamp, and Logical fields and does not require a picture statement.
Posted By Mike Prestwood, Post #100599, KB Topic: Interactive Paradox: Forms
Tip: Rename Many Objects Quickly with the Object Tree
If you need to rename many objects one right after the other, use the Object Tree. By selecting and inspecting each object on the Object Tree, you can quickly rename many objects.
Posted By Mike Prestwood, Post #100626, KB Topic: Interactive Paradox: Forms
Tip: Study Apps and Build Great Forms!
The user interface is the first element of your application that a user sees. Because first impressions are important, the user interface carries more weight than any other part of your application. It deserves much planning and effort. Spend time just reviewing the applications on your computer. The more time you spend looking at various application user interfaces, the better your forms, reports, and applications will look.
Posted By Mike Prestwood, Post #100602, KB Topic: Interactive Paradox: Forms



Topic: OPAL: Language Details

Assocative Arrays in ObjectPAL

An associative array links a set of unique values (keys) to another set of values (not necessarily unique). In ObjectPAL associative arrays are known as dynamic arrays.

;Button :: pushButton
method pushButton(var eventInfo Event)
var
myDynArray   DynArray[] String
endVar

 
myDynArray["Last_Name"] = "Spitz"
myDynArray["First_Name"] = "Randy"
myDynArray.view()
endMethod
Posted By Mike Prestwood, Post #101198, KB Topic: OPAL: Language Details
ObjectPAL Associative Array (DynArray)

In ObjectPAL associative arrays are known as dynamic arrays.

var
myDynArray   DynArray[] String
endVar

 
myDynArray["Last_Name"] = "Spitz"
myDynArray["First_Name"] = "Randy"
myDynArray.view()
Posted By Mike Prestwood, Post #101518, KB Topic: OPAL: Language Details
ObjectPAL Exception Trapping (try...onFail)

ObjectPAL has a try...onFail statement but does not have a finally-type component. However, the code afer endTry will execute.

try
onFail
endTry
var
i SmallInt
endVar
try
i = 0
i = 1/i
onFail
msgInfo("", "You cannot divide by zero.")
endTry
Posted By Mike Prestwood, Post #101369, KB Topic: OPAL: Language Details
ObjectPAL Filter Records (setRanger, setGenFilter)

In ObjectPAL, you can filter set a TCursor, UIObject, and Table objects using setRange() and setGenFilter().

The following example loads, filters, and runs a report.

var
 r Report
 dyn DynArray[] String
endVar
  
dyn["Name"] = "SCUBA Heaven"
Customer.setGenFilter(dyn)
  
r.load(":Sample:customer")
r.Customer.setGenFilter(dyn)
r.run()

You can also drop a flter with:

r.Customer.dropGenFilter()
Posted By Mike Prestwood, Post #102115, KB Topic: OPAL: Language Details
ObjectPAL Find Record (locate, qLocate)

ObjectPAL provides a rich set of commands for finding a record with a TCursor or UIObject including:

  • locate() -  Seach for a value based on a criteria. Uses indexes as appropriate.
  • locatePattern() - Search for a pattern within a value.
  • moveToRecord() - Moves to a specific record number.
  • qLocate() - Search using currently set index.

Each of these basic find record commands has supporting commands such as locateNext() and recNo().

var
  tc TCursor
endVar
   
tc.open("Customer.db") 
if tc.locate("Name", "Proffessional Divers, Ltd.") then 
  tc.edit()
  tc.Name = "Professional Divers, Ltd."
  msgInfo("Success", "Corrected spelling error.")
endIf
tc.endEdit()
Posted By Mike Prestwood, Post #102113, KB Topic: OPAL: Language Details
ObjectPAL Overloading

Paradox & Overloading

  • Operator - No.
  • Method - No.

However, you can have the same named method or procedure so long as they are in different libraries. This is important if you use libraries in a class-like OOP way and wish to implement some form of polymorphism (i.e. libMember.Open and libVendor.Open). This is an OOP-like technique for implementing a subtyping-like polymorphism which is also known as inclusion polymorphism.

Also, some developers like to pass an array and then handle the array for a pseudo technique. Although not overloading, it's useful.

ObjectPAL Parameters (var, const)

By Reference or Value (and by constant)
The default for parameters is by value. For by reference, add var in front of the parameter. ObjectPAL also offers constant parameters where you add const in front of the parameter. A constant parameter is like a read-only parameter the compiler can optimize. You cannot assign a value to a constant parameter.

method cmCode(s String) ;...s is by value.
endMethod
 
  
method pushButton(var eventInfo Event)
  ;...eventInfo is by reference.
endMethod
  
method cmCode(Const s String)
  ;...s is a constant read-only parameter.
endMethod
  
proc cpNever() String
  return "Never duplicate a line of code!"
endProc

Posted By Mike Prestwood, Post #101630, KB Topic: OPAL: Language Details
ObjectPAL Record Movement (home, end, nextRecord)

ObjectPAL uses home(), end(), nextRecord(), priorRecord() to move a database cursor (works with either a TCursor or UIObject).

TCursor.nextRecord()

These commands send a message to the object. Specifically, they send an action constant using the action command. The above snippet is equivalent to:

TCursor.action(DataNextRecord)

It is handy to  with familiar with action constants because not all action constants have an ObjectPAL equivalent comment.

The following snippet uses the active keyword to move to the second to last record of the table attached to the UIObject that currently has focus:

active.end()
active.priorRecord()

You can also use the self keyword to refer to the UIObject your code is attached to.

Posted By Mike Prestwood, Post #102109, KB Topic: OPAL: Language Details
ObjectPAL Self Keyword (Self)

A built-in object variable that represents the UIObject to which the currently executing code is attached.

method pushButton(var eventInfo Event)
  msgInfo("", self.Name)
endMethod
Posted By Mike Prestwood, Post #101934, KB Topic: OPAL: Language Details
ObjectPAL Sort Records (switchIndex, sortTo, setGenFilter)

In Paradox, you add an index for each sort your wish to perform on a table then use switchIndex(). Alternatively, you can use sortTo() to sort a table into a new table.

ObjectPAL subStr

substr ( const startIndex LongInt [ , const numberOfChars LongInt ] ) String

Alternative syntax:

LeftString = subStr(NameVar, 1, 3)
var
�LeftString String;
  NameVar String;
endVar
NameVar = "Prestwood"
LeftString = NameVar.subStr(1, 3)
msgInfo("", LeftString)
Posted By Mike Prestwood, Post #101374, KB Topic: OPAL: Language Details
Paradox and OpenOffice

Export to OpenOffice

method openWorkBook(var Excel OleAuto, fileName string) logical
var
 StarDesktop,StarOffice  OLEAuto
 oooDoc,scr,lists,list,zak OleAuto
 massiv AnyType
 fs filesystem
 put,s string
 dlin,k,i smallInt
endVar
ShName.BLANK()
ShiNDEX.BLANK()
try
  scr.open("MSScriptControl.ScriptControl")
 scr.language = "javascript";
 scr.eval("aaa=new Array()")
 massiv = scr.eval("aaa")
 scr.AddCode("function SetItem(ind,val){massiv[ind]=val}")
 StarOffice.Open("com.sun.star.ServiceManager")
 StarDesktop=StarOffice.createInstance("com.sun.star.frame.Desktop")
 dlin=fileName.size()
 
 put=""
 k=1
 i=1
 while i<>dlin
  s=fileName.subStr(i,1)

  if ansiCode(s)=92 then 
   put=put+"/"+fileName.subStr(k,i-k)
   k=i+1
  endIf 

  i=i+1
 endWhile
 put=put+"/"+fileName.subStr(k,i-k+1)
 if put.subStr(put.size()-3,4)=".xls" then
 else
  put=put+".xls"
 endif
 Excel=StarDesktop.LoadComponentFromURL("file://"+put,"_blank", 0,massiv)
 return True
onFail errorClear() return False
endTry
endMethod
Posted By runlir, Post #101996, KB Topic: OPAL: Language Details
Tip: Use Constants & Make Your Code Easier to Maintain
Two advantages of using constants are that they humanize your code and help make managing your code easier. They humanize your code by making your code easier to read. A constant named tax is easier to remember and understand than 8.125. Constants help you maintain your code by centralizing values. If the tax rate in your area changes from 8.125 to 8.5, you change the constant in one location.
Posted By Mike Prestwood, Post #100610, KB Topic: OPAL: Language Details



Topic: Interactive Paradox: Queries (QBE)

@ and ..
The first half is an inexact search and the second half tells it to limit the search to four characters.

QBE Expression...

 

mIkE.., @@@@
Posted By Mike Prestwood, Post #100814, KB Topic: Interactive Paradox: Queries (QBE)



Topic: Interactive Paradox: Reports

ObjectPAL Report Tools Overview (Built-In)

Paradox offers a built-in reporting tool that will suffice for most desktop database applications.




Topic: Interactive Paradox: Using Data

Tip: Add Audit Fields
Add a field called ModifyTimeStamp to every table in your project and set its Default value to NOW. These types of audit fields can be very helpful in business situations and are critical in many. Other types of audit fields you can add to the end of tables include CreateTimeStamp and EmployeeID.
Posted By Mike Prestwood, Post #100598, KB Topic: Interactive Paradox: Using Data
Q&A: Import Excel 2003, XP, 2007 into Corel Paradox
Question: How do I import an Excel 2003, XP, or 2007 spreadsheet?

Answer:

Corel Paradox 9, 10, and 11+ can import Excel spreadsheets up through Excel 97 so you need to save the spreadsheet as an Excel 97 spreadsheet. Then you can import it in Paradox using either the interactive File | Import option or with ObjectPAL's importSpreadsheet procedure.

If you have trouble with then Excel 97 file format (and you may depending on the version of Excel you are using), try saving the file as an Excel 4 file format. The worst case scenario, is that you may have to save the file as a dBASE table file format (.DBF) which you can directly use in Paradox and even copy it to a Paradox table (.DB).

Posted By Mike Prestwood, Post #101227, KB Topic: Interactive Paradox: Using Data
Q&A: Paradox and PNG Images
Question:

Does Paradox for Windows support .PNG image files?

Answer:

Yes, Paradox 10 and 11 support .PNG graphics. For example, you can insert a .PNG using Edit | Paste From. However, Paradox 9 and earlier do not.

Note: All images stored in a Graphic field in Paradox tables are stored as uncompressed BMP images. This FAQ is about Paradox for Windows' ability to paste or import .PNG images into the .BMP formatted Graphic field type. For earlier versions of Paradox, you have to first convert the image.

Posted By Mike Prestwood, Post #102054, KB Topic: Interactive Paradox: Using Data
Definition

Paradox Database

Definition:

A database is an organized collection of information. For Paradox table users, the meaning of the term Paradox Database is stretched to mean a set of related Paradox tables (usually in the same directory).

Posted By Mike Prestwood, Post #100613, KB Topic: Interactive Paradox: Using Data
Definition

Project Alias

Definition: A project alias, like public aliases, point to a folder. Project aliases are stored in the PDOXWORK.CFG file, which is loaded whenever you change working directories.
Posted By Mike Prestwood, Post #100619, KB Topic: Interactive Paradox: Using Data
Tip: Use an Alias to Refer to Your Paradox Tables
Put your tables in a directory different from the one that contains the forms, reports, and libraries. Use an alias to refer to the tables. This makes your application instantly a network-compatible application by making the tables relocatable. When you install the application onsite, you simply have to ask where to put the data and where to put the application. The application can be local or on the network. Place the data files where they need to be, and change the alias path. If you eventually want to move your data onto a SQL server, then you will have less code to rewrite.
Posted By Mike Prestwood, Post #100594, KB Topic: Interactive Paradox: Using Data



Topic: ObjectPAL Coding

ObjectPAL Overview and History

Language Overview: Object based language. Although ObjectPAL uses object oriented techniques "under the hood", it is not object oriented. Although you cannot create classes, ObjectPAL has built-in objects you can use in your code. You code in a traditional approach attaching code to objects or within a script. Most Paradox applications are form based. You may have a short startup script but you design forms and reports and tie them together with a common form. You can store reusable code such as custom methods and procedures in a library.

Target Platforms: Corel Paradox is most suitable for creating business desktop applications that run within Corel Paradox for Windows.




Topic: OPAL: Commands

Tip: Correct Event To Trap a Key Press
As long as a field has focus, key presses do not bubble because the key press is used up by the field. Therefore, the two best choices to trap for key presses are the form's prefilter or on the field itself.
Posted By Mike Prestwood, Post #100625, KB Topic: OPAL: Commands
ObjectPAL setTitle()

This code sets the title of your Paradox application in the application's title bar.

var
	app Application
endVar
app.setTitle("My Custom Application")
Posted By Mike Prestwood, Post #100587, KB Topic: OPAL: Commands
Tip: Use a Dialog form with app.Hide()
If you wish to show ONLY your form and hide Paradox, use a dialog form and app.hide().
Posted By Mike Prestwood, Post #100606, KB Topic: OPAL: Commands
Tip: User ForceRefresh() to Update Calculated Fields
If you ever have a calculated field on a form not update when you think it should, then use forceRefresh() to make the calculated field display the correct values.
Posted By Mike Prestwood, Post #100607, KB Topic: OPAL: Commands



Topic: OPAL: Libraries

ObjectPAL Custom Routines (method, procedure)

ObjectPAL is a non-OOP language (an object-based language) that offers custom methods and custom procedures. When you create a custom method, you associate it with an existing object like a button, form, or library.

When calling a custom method or procedure that has a by reference parameter (uses var), then you cannot use a literal value. this is different than in many other languages which do allow you to pass literals by reference.

method sayHello(var pName String)
 msgInfo("", "Hello " + pName)
endMethod

method add(p1 Number, p2 Number) Number
 Return p1 + p2
endMethod
Posted By Mike Prestwood, Post #101631, KB Topic: OPAL: Libraries
ObjectPAL Pointers

ObjectPAL doesn't use pointers except for use with DLLs where you use a special CPTR uses keyword to refer to a DLL string pointer data type.

Uses Tapi32
  tapiRequestMakeCall(sNumber CPTR, sAppName CPTR, 
    sLogName CPTR, sComment CPTR) CLONG
endUses
Posted By Mike Prestwood, Post #101912, KB Topic: OPAL: Libraries



Topic: OPAL: OOP

ObjectPAL Inheritance (Not Supported)

ObjectPAL does not support developer defined class creation nor sub-classing (inheritance).

ObjectPAL Polymorphism (Not Supported)

Built-in: In ObjectPAL, polymorphism is the capability of the built-in objects to act differently depending on the context in which they are being used. For example, Table.Open and TCursor.Open. The Open method works differently depending on the object type used.

Custom: No. However,you can have the same named method or procedure so long as they are in different libraries.This is importantif you use librariesin a class-like OOP way and wish to implement some form of interfaces-like polymorphism(i.e. libMember.GetName and libVendor.GetName).




Topic: OPAL: Wicked Coding Tasks

Calling an Oracle Stored procedure from Paradox

In Paradox, use an sqlQuery block to call store procedures. The following code uses an sqlQuery block to call an Oracle stored procedure. Use the syntax of whatever SQL server you're going against. With Oracle, if I remember correctly, you use an "execProc" or "exec" command.

sqlQuery =
SQL
;execute proc here
ENDSQL


if not dbSQL.executeSQL(sqlQuery, tcAnswer) then
errorShow()
endIf
Posted By Mike Prestwood, Post #100072, KB Topic: OPAL: Wicked Coding Tasks
OLEAuto Paradox to Outlook

The following code snippet adds an appointment to your Outlook calendar. Tested with Paradox 9 and Outlook 2003 but should work with later versions of both programs.

Note, you will get a Error opening server 'Outlook.Application' error if your antivirus program is blocking Outlook access.

var
 oleOutlook oleAuto
 oleAppointment oleAuto
endVar
  
;The open will fail if your AntiVirus program is blocking access.
oleOutlook.open("Outlook.Application")
oleAppointment=oleOutlook.CreateItem(1)
  
oleAppointment.Subject = "Test From ObjectPAL"
oleAppointment.Body="You can add appointments from ObjectPAL."
oleAppointment.Start=dateTime() ;Adds an appointment now.
oleAppointment.Duration=60
oleAppointment.ReminderSet=True
oleAppointment.Location="My Office"
oleAppointment.BusyStatus = 2
  
oleAppointment.save()
Posted By Mike Prestwood, Post #102122, KB Topic: OPAL: Wicked Coding Tasks
Q&A: Paradox and TWAIN Support
Question:

Does Paradox for Windows support TWAIN?

Answer:

Yes, interactive support was added with Paradox 9 SP1 and ObjectPAL support was added with Paradox 10. Here's a good article for Paradox and TWAIN:

http://www.techtricks.com/paradox/twain/part1.php

Posted By Mike Prestwood, Post #102067, KB Topic: OPAL: Wicked Coding Tasks
Tip: Speed Up TCursors with setBatchOn()
You can speed up a TCursor in by using update(), setBatchOn(), or copyToArray(). If you use setBatchOn(), make sure to follow it with setBatchOff() every time you use it.
Posted By Mike Prestwood, Post #100624, KB Topic: OPAL: Wicked Coding Tasks



Topic: OPAL: Win32 Calls

Q&A: DLL Uses Block
Question:

I'm making a DLL Call and I need to pass a logical, I tried passing an ObjectPAL logical data type and that didn't work. How do I pass a logical to a function in a DLL?

Answer:

With DLLs you are limited to the DLL Uses types of CWORD, CLONG, CDOUBLE, CLONGDOUBLE, CPTR, and CHANDLE. All other parameter types must be mapped to one of these fundamental data types. Because logicals are really just null, 0, or 1, you can use a CWORD which maps to ObjectPAL's SmallInt data type (an integer).

Posted By Mike Prestwood, Post #101942, KB Topic: OPAL: Win32 Calls



Topic: Professional Paradox/ObjectPAL Help

Q&A: Paradox and Large Databases
Question: I like the concept and feature-set of Paradox, but wonder if it can handle very large transactions and storage?

Answer:

We like Paradox's feature set too but it's not the right tool for every situation. For very large transactions and storage, we prefer a true SQL server over ALL file-based databases including over Paradox. Although we judge and discuss the viability of toolsets for each project, we do have standards we steer our clients toward. For example, we steer our Paradox-oriented large transaction/large storage needs clients toward SQL Server 2005 with either VS.Net as a front-end or Delphi (for a true native code solution).

Posted By Mike Prestwood, Post #101304, KB Topic: Professional Paradox/ObjectPAL Help



Topic: Runtime, PDE, Package-It!

Tip: Add ObjectPAL to a delivered form
You cannot directly add code to a delivered form. For example, methodSet does not work on delivered files. However, you can use executeString() to execute ObjectPAL code even on a delivered form.
Posted By Mike Prestwood, Post #101320, KB Topic: Runtime, PDE, Package-It!
ObjectPAL Deployment Overview

To deploy a Paradox application, you need to deploy either the full version of Paradox or the Paradox Runtime both of which will include the BDE as well as any dependecies you've added such as psSendMail DLL, ezDialogs, etc.

Tip: Paradox Looks for Non-Delivered, Then Delivered

Whenever you open a form, report, library, or script using the open() method and do not specify a file extension, Paradox always looks first for the nondelivered .?SL file and then for the delivered .?DL file.

Posted By Mike Prestwood, Post #100622, KB Topic: Runtime, PDE, Package-It!
Q&A: Turn Paradox into an EXE
Question: My company has a Paradox application. Can I turn it into a true Windows application? A true Win-32 executable?

Answer:

No. To deploy your Paradox application, you can use either the full version of Paradox or the runtime version. The runtime version is almost as big as the full version but it's been free since version 9. If you deploy using the full version of Paradox, you need a license for each user. You can order a multi-user license from Corel at a deep discount.

If you really need a true Windows executable, you'll have to rewrite the application in another development tool like Delphi or Visual Studio.Net. If you need help with this you can contact a company like Prestwood Software who has experts in Paradox and in the target development tool.

Posted By Mike Prestwood, Post #101030, KB Topic: Runtime, PDE, Package-It!



Topic: P9 Book: Power Programming

open table



Topic: Paradox for DOS

Q&A: Paradox for DOS CPUTest on Vista
Question:

Does Paradox for DOS' CPUTest.EXE run on Vista?

Answer:

Ok, that's a bit of a silly question, but yes it does. It may not appear to run but if you tell Windows not to close on exit, it works just fine.

  1. Right click on CPUTEST.EXE, select Properties.
  2. From the Program tab, uncheck Close on exit.

By the way, my dual core 2 GHz CPU passed.

Posted By Mike Prestwood, Post #101007, KB Topic: Paradox for DOS
Q&A: Paradox for DOS on 64-bit Vista? Windows 7? 8? 10?
Question:

Can I run Paradox for DOS on 64-bit editions of Windows Vista, Windows 7, 8, 10?

Answer:

No. DOS has been removed. 16-bit programs are not directly supported on 64-bit versions of Windows Vista, Windows 7, 8, or 10. Although 64bit Windows editions come with the Command Prompt for executing DOS commands and creating scripts, it does not run DOS programs.

Recommendation: Download a DOS emulator such as DOSBox.

Posted By Mike Prestwood, Post #101120, KB Topic: Paradox for DOS
Q&A: Paradox for DOS on Vista
Question:

Does Paradox for DOS run on Vista?

Answer:

Yes, but you must use the compatibility mode.

Posted By Mike Prestwood, Post #101005, KB Topic: Paradox for DOS

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech