Examples




KwikPeg is delivered to you with a comprehensive collection of GUI examples. These examples are included with the standard distribution of PEG from Swell Software, Inc. The simplest way to learn how to use KwikPeg is to examine the source code of the PEG examples. You will find them in your PEG installation directory PEG\EXAMPLES.

KADAK has taken a subset of the PEG examples and tailored them explicitly for KwikPeg developers. The examples listed below have been prebuilt and are ready to execute on a Windows® workstation so that you can immediately see KwikPeg results in action. This subset of examples is located in your KwikPeg installation directory KPGnnn\EXAMPLES.

A comprehensive, sequenced demonstration of KwikPeg capabilities is provided in directory KPGnnn\EXAMPLES\KPG_DEMO. You should run the demonstration program to familiarize yourself with KwikPeg features that may not be presented in the examples listed below. Some of the code sequences used in the demonstration program may also be of use in your application. At the very least, these code fragments provide guidelines for the proper use of KwikPeg within an application GUI.

Note: If you downloaded the examples from KADAK's website, you will find the examples in subdirectory EXAMPLES of your download installation directory.

DirectoryExample
BASIC Simple text window
TIMER Window changing color periodically
DIALOG Message/signal handling
GAUGE Drawing off-screen bitmaps to memory
 
GRAPHICS Extended graphics with lines, polygons, circles, ellipses and arcs
IMGBROWS Runtime image conversion used by an image browser
KEYBOARD Use of 5 keys and mouse to navigate a QWERTY keyboard
NOTEBOOK Manage different content on each page of a notebook
POPMENU A simple popup menu
ROBOT Derived gadgets and custom buttons, prompts, status bars
SPREAD Sample spreadsheet with split columns and scrolling
TABLE Table with text, buttons and images in cells
TERMINAL Simple looped back dumb terminal in a scrolling text window
TRACE A dynamically updating signal trace with window dragging
TREEVIEW A PegTreeView window used to show the KwikPeg class hierarchy
VECFONT Show KwikPeg vector font with bold, italic and variable point size
 
CHARTS Line charts, multiline charts and strip charts
HMI Notebook pages showing active dials, statelights and scales
P2DPOLY Two dimensional polygon used as a bouncing sprite
TOOLBAR Interactive toolbar with panels and decorated buttons


The examples delivered with KwikPeg have been built using the KwikPeg prototyping facility provided for GUI testing. If you wish, you can execute these examples from the Windows Start and Run menu as shown below:


Top of page


 Basic Window

This example and the code fragment which generates it illustrate the simplicity of programming with KwikPeg.

#include "kp_lib.h"
void PegAppInitialize(PegPresentationManager *pPresent) { PegMessageWindow *pWin = new PegMessageWindow("Hello World", "My First Window!", FF_RAISED|MW_OK); pPresent->Center(pWin); pPresent->Add(pWin); }


Top of page


 Timer Example

This example illustrates the use of a KwikPeg timer which periodically changes the window's background color. The illustration has been animated to let you see the KwikPeg example as it appears once it begins to execute.


Top of page


 Dialog Example

Using a KwikPeg dialog window, forms are simple to create and use.


Top of page


 Gauge Example

The simplest of gauges can be created using lines drawn over the gauge image on a bitmapped button.


Top of page


 Graphics Example

This example generates four windows, each illustrating a particular graphic drawing capability. As the windows are resized, the images automatically adapt to the window size. Note that patterned (dashed and dotted) lines are lumped with this graphics feature.


Top of page


 Image Browser Example

This example illustrates that KwikPeg can generate images derived from files provided by your operating system's file system. Click on a button and a BMP, GIF or JPEG image will be drawn from a file into its own window. The files, named BMPn.BMP, GIFn.GIF and JPEGn.JPG, must reside in the same directory as the example file IMGBROWS.EXE.

The image files provided with the example are purposely small, to limit the size of the example directory. However, you can replace these images with your own to see how file size or image dimension affects the example.


Top of page


 Keyboard Example

The keyboard example illustrates the reuse of common objects (keys) derived from standard KwikPeg classes. Notice that the text on the keys changes when the shift state changes.


Top of page


 Notebook Example

The notebook's menu allows you to change the way the notebook operates. Tabs can be text or graphical, top or bottom. The pages can raised or recessed with thin or thick borders.


Top of page


 Popup Menu Example

This example illustrates that a menu does not always have to appear below a title bar in a window. It also shows that the menu items can extend beyond the borders of the object holding the menu.


Top of page


 Robot Example

This example shows the effective use of graphics for animation purposes. Although the events governing the robot operation are simulated and driven from KwikPeg timers, the example still illustrates how easily an effective graphical presentation can be added to a real-time control application.

You can view an animated copy of the robot example. 


Top of page


 Spreadsheet Example

The spreadsheet menu includes controls to adjust the features supported by the rows and columns. Selections can be enabled or disabled. Coumns can be raised, recessed or flat. Data can be left, right or center justified. The example continuously increments the data in the cell at row 3, column 4 to show how external applications can affect the data content of the spreadsheet.


Top of page


 Table Example

A KwikPeg table supports row span and column span data as the two graphic elements illustrate. Any KwikPeg objects like the push buttons and text boxes can be inserted into a table. The table row and column dimensions will automatically adapt to accommodate the data within the cells, unless otherwise specified by your application. Grid lines are optional.

Note that a graphic image can be tiled throughout the table as a background. Transparent images can then float over the background as shown.


Top of page


 Terminal Window Example

This example illustrates the use of a KwikPeg list to maintain and display the command lines and responses of a terminal dialog. As the number of lines increases, scroll bars appear, allowing the previous history to be viewed. As you would expect, KwikPeg adjusts the length of the scroll bar handle to reflect the percentage of the available data which is actually visible.


Top of page


 Trace and Drag Example

The trace shown in the example is dynamically updated with pseudo random data. The trace scrolls to the left in typical strip chart recorder fashion.

The trace window can be dragged to another position. If you click on the window, the cursor changes to the shape shown. When you release the cursor, the trace window will be repositioned at that point.


Top of page


 Treeview Example

This example of a KwikPeg PegTreeView window summarizes most (but not all) of the available KwikPeg classes.


Top of page


 Vector Font Example

This example lets you test KwikPeg vector fonts to find the font size and attributes (bold or italic) which best suit your purpose. As you can see, vector fonts are never as appealing as fonts captured using the KwikPeg Font Grabber.


Top of page



Drivers | Examples | Testing | Home        Copyright © 2000-2003
Support | Legal