Code Samples

Small fragments of ABL code which illustrate some principle or technique


Using .net user control with 4GL (adm2) container

The sample shows how a .net user control can be used with an ADM2 container. There is no specific support for ADM2 otherwise (links, etc) but it should be quite possible to modify the window super-proc to support automated display of date values in a date picker, f.ex, along the lines it's done for the JukeBox framework.

Components:

JBoxWrapWindowInForm.p:
Super proc for container that keeps track of control(s) in window, (re-)creates the window menu as .net menu and manages resize of control(s)

JBoxWrapperForm.cls:


Marginal Tiete - progress game

Greetings,
I made this game to emulate Atari's Grand Prix.
You can use this code to view how to use dynamic objects and other functions like includes, and methods.

Running:
1. Extract all files,
2. Select car.p and right click, choose RUN under window's context menu or open it with progress procedure editor.

Skype me jaison.antoniazzi for questions.

Enjoy :D

Best regards,
Jaison Antoniazzi


Haversine implementation in ABL

This is the Haversine formula translated into an ABL procedure. The Haversine formula is used for determining the Great-Circle distance in km between two latitude/longitude references.

The formula is based off the Javascript interpretation here: http://www.codecodex.com/wiki/Calculate_Distance_Between_Two_Points_on_a...

Requires Progress STandard Libraries with math_asin function uncommented (see http://www.oehive.org/node/2057)


New Version of base64encode.p

Dries Feys was good enough to send out a new base64encode.p file over the peg. I am posting it here for further distribution (and use!)

(Note: Some have said they have had problems with this.)


Introduction to the parameter object

I'm reading Martin Fowler's refactoring and will work out some of his methods (which also apply to building new software) in this blog. Read this to get some background info:

http://sourcemaking.com/refactoring/introduce-parameter-object
http://www.refactoring.com/catalog/introduceParameterObject.html
http://martinfowler.com/ap2/range.html

Below a simple daterangeparameter object, and therebelow a procedure using the daterange object.


GUI OpenEdge Password Meter

A password meter written in ABL.
It is database independent and uses the first connected database for the session.
By default it has 2 levels of strength that can be easily checked for and/or required: Strong Passwords and Xtra Strong Passwords
It checks for the following:
Required for strong passwords:
Length of 12 to 24 characters
Use of all 4 types of characters
Not the same as the previous 5 passwords
No personal names (first or last) and no company names or company acronym (hard-coded).

Required for Xtra strong passwords:
At least 2 upper case letters used


How to add a colored square in the titlebar through api

Sometimes it's neccessary to add a Caption in the titlebar to give extra information to the user of your application. The attached file does this, and makes sure the window got redrawn when windows triggers arive.
As you can see, many instances of msgblst32 are added on this window. The goal is to make it more the controlling window which always catches the events on the underlaying session applications. As every window needs its own ocx, I provided 40 instances which are hopefully enough to maintain every window.


Video on calling web services from the 4GL/ABL

I have a video up on amduus.com on how to call out to web services with example coding.

The video can be seen at http://amduus.com/training/Using_bprowsdldoc.html


Example function to return various date formats. YYYYMMDD

In this example function you pass to it the format you want YYYYMMDD YYMMDD ISO etc. along with date and time delimiters you wish to use. This does use the NOW statement which is not in older versions.


Testing character values to see if they are integer, decimal or character values.

This set of examples show various methods to test for character, integer, and decimal values.
The various test methods came from a discussion on the PEG and suggestions by members and myself.

Typical time results per 100,000 iterations of the functions.

+--------------------------------------------------+
¦-123                                              ¦
¦                                                  ¦
¦fn-ISCHAR-loop:   31510 ms no  Loop method        ¦
¦fn-ISCHAR:         3681 ms no  DEC(x) error method¦
Syndicate content