IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

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

Prestwood eMagazine

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

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Libraries   Print This     
  From the August 2009 Issue of Prestwood eMag
 
Paradox OPAL: Libraries:
ObjectPAL Custom Routines (method, procedure)
 
Posted 17 years ago on 11/16/2008 and updated 1/14/2009
Paradox Code Snippet:
 A flashcard from our Paradox Flashcards Library
 A code snippet from our Paradox Code Snippets Page

KB101631

Languages Focus: Custom Routines

For non-OOP languages, a custom routine is a function, procedure, or subroutine and for pure OOP languages, a custom routine is a class method. Hybrid languages (both non-OOP and OOP) combine both.

ObjectPAL Custom Routines

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.

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

method add(p1 Number, p2 Number) Number
 Return p1 + p2
endMethod

The following code from a button pushButton event uses the two custom methods above:

method pushButton(var eventInfo Event)
 var
    MyName String
 endVar
  
 MyName = "Mike"
 sayHello(MyName)
 
 msgInfo("", "2+2=" + string(add(2,2)))
endMethod

More Info

KB Post:  Power: Chapter 18, Reusing Code

Comments

1 Comments.
Share a thought or comment...
Comment 1 of 1

Exactly what I was looking for, thanks!

---
Ibrahim
Posted 13 years ago
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P187A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile


Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.

Intermediate

1 Intermediate Level Question

Question #1: True or False?

Custom procedures execute faster than custom methods.

Answer:
  • True
  • False

  •  KB Article #101631 Counter
    9482
    Since 11/16/2008
    Sales Website: www.prestwood.com Or visit our legacy sales site: 
    legacy.prestwood.com


    ©1995-2025 Prestwood IT Solutions.   [Security & Privacy]