This SDK contains several sample applications. They are listed below. Click the links below to see a longer description of each application.
database/dbsort | Creates a custom index. |
database/pimsamp | Simple database usage. |
games/tower | Tower of Hanoi game: tracks mouse events. |
graphics/images | Creates a FlexImage object from a bitmap (.png) file. |
graphics/logoapp | Creates a FlexImage object from a bitmap (.png) file. |
graphics/stockgph | Shows primitive drawing calls: lines, rectangles, text, and UI shapes. |
hello | The simplest application, displaying "Hello World". |
input/inkinput | Receiving ink input; uses the following classes: Ink, FlexInk, and InkListenerInterface. |
input/keyinput | Listens to keypresses. |
internet/finger | Creates a TCP/IP connection to retrieve finger information. |
internet/netman | Configures a set of Access Points. |
irda/irterm | A terminal program that uses an infrared connection. |
pims/contacts | An application that tracks contact information, such as name, phone number, and email address. This is the closest to a fully functioning application provided. |
pims/jcontact | A personal information management (PIM) program that displays data in Japanese. |
shell/envshell | Shell application: launches applications at user request. Also listens to hard icons, and power events. |
sound/sound | Plays sounds when buttons are pressed, or when text is entered in a text field. |
text/styles | Sets the font typeface, size, and style using the TextState class. |
text/textarea | Demonstrates use of many text related features: echo characters, custom filters, and text listeners. |
thread/priority | Demonstrates the priority scheduling scheme used in Geos-SC. |
thread/tstreams | Has two threads communicating over Stream objects. |
timer/ttimer | Uses a timer to animate an image. |
toolkit/buttons | Creates a button with a text label that listens for button presses, and a button with an image that listens to mouse presses and releases. |
toolkit/canvas | Uses a FlexCanvas to create a very simple custom gadget. |
toolkit/checkbox | Uses checkboxes and radio buttons. Shows selection of checkboxes, enabling/disabling choices, and text and bitmap labels. |
toolkit/dialogs | Demonstrates the creation of dialogs, including a modal dialog which takes all user input for the application, and a system modal dialog that takes all input for the device. |
toolkit/frames | Creates a few simple FlexFrames. |
toolkit/lists | Demonstrates the FlexList API: single and multiple selection modes, adding, replacing, and removing list elements. |
toolkit/menus | Creates two menus. |
toolkit/scrlpane | Uses a FlexScrollPane. |
toolkit/scrollbr | Shows two vertical scrollbars, scrolling a single and multi-line text area, and a horizontal scrollbar that moves a button within a panel. |
toolkit/tables | A FlexTable and a FlexScrollbar. Vertical scrolling. Demonstrates how to select table cells. |
toolkit/titles | Demonstrates use of TitleEvents. |
uma/mimesamp |
database/dbsort
This sample application shows how to use the index driver mechanism to sort database records. The pieces of code necessary to use custom index drivers are marked with the following special comment so you can find them quickly:
// CUSTOM-INDEX-DRIVER
The database is a collection of strings used to represent a date in the following format:
Year: YYYY (eg. 1998) Month: MM (eg. 03) Day: DD (eg. 17) Time: hh:mm (eg. 16:30)
The date strings are stored in a database file and displayed using a FlexTable component. The dates are displayed using one of several sorting options accessed through a FlexMenu.
database/pimsamp
This sample application provides a demonstration of the basics of using the Database class. It creates a simple database with two text fields and allows the user to input string data.
For more involved samples of database usage, see the contacts and jcontact sample applications.
games/tower
This application models the classic Tower of Hanoi game. The minimum number of steps to solve an n-piece game is O(n!), which is why the maximum number of pieces is 7.
Game rules:
The application interface consists of:
The TowerGame object keeps track of the current game in progress. It checks to see if a requested move is legal, moves pieces, and checks to see if the game is done after a move. Every time the user clicks and drags in the TowerGraphicCanvas object, the TowerApp object catches the event and creates a move which it sends to the current TowerGame object.
graphics/images
Shows how to create a FlexImage and align a graphical image within the FlexImage. This is done by creating a 3 by 3 grid of FlexImages that all display the same graphic. Each FlexImage is 1/3 the width and height of the bitmap. By setting the vertical and horizontal alignment we get each FlexImage to display its piece of the whole bitmap.
graphics/logoapp
This sample application demonstrates how to convert a .png file into a resource for drawing in an application.
graphics/stockgph
This sample application uses two FlexCanvas objects to show how to draw a simulated stock price chart. Two of the buttons are drawn using StaticUIShape definitions, thus demonstrating an alternative to bitmaps or textual buttons.
hello
This simple "Hello World!" application presents the skeleton of a GEOS-SC application. It displays a FlexLabel with the name "Hello World!" in the middle of the main window. A FlexLabel is a GEOS-SC defined UI object. HELLO_TEXT is a variable that refers to the string resource "Hello world!", defined in hello.str.
input/inkinput
This sample application demonstrates how to handle ink input from the pointing device. This sample has a window that accepts ink input and several buttons for performing operations on the ink.
input/keyinput
Sample app to show how key input can be managed by a state-machine type paradigm.
In this example, rather than listening to all the dialogs and other components, we will only listen for keys coming through the AppBase object. All key presses bound for our application pass through the AppBase object before being sent to the component that has the "focus". Listening at the AppBase has its drawbacks, because you receive every key press. If you only want to receive keypress information from a few components (for example, one or two dialogs, you would be better adding each of those dialogs to the listener list, rather than adding the AppBase.
There are three states in this state machine:
internet/finger
This sample application demonstrates how to interact with the TCP/IP stack on GEOS-SC to implement a finger client.
internet/netman
This sample application shows how you could write an internet control app. It allows the user to define internet access points and initiate connections to the internet. It also includes a finger daemon for serving finger requests.
When using the Windows emulator and connecting to a server through PPTP (tunnel), be sure to start the "Emulator" by pressing the Connect button on the Emulator panel.
irda/irterm
The IrTerm sample application is a simple terminal for communication over an infrared link. It has a connect/disconnect button and a text area for sending and receiving data.
Lengthy operations should *not* be performed in IrCOMM notification functions because:
To use the app on the NT emulator, attach an Extended Systems 9680 IR dongle to COM1 of your machine. Only if COM1 is in use, attach the dongle to COM2.
pims/contacts
This sample application demonstrates how to manage a database to store a list of contacts. In particular, this contacts database will contain the name, address, phone #, fax #, and email address of our "contacts". This sample also shows how to create and destroy frames and dialogs dynamically, to conserve system resources.
This sample is broken into several source files, as follows:
pims/jcontact
This application lets the user look at the contents of a contact information database. There are two windows: the main frame contains a table which displays one contact per line. Also, there is a dialog which gives a detailed view of one contact.
Before running this program, you will need to make sure that its test data is in your filestore. See the readme.txt file for instructions.
A few things to look for in this application:
Most of the brains of this application keep track of the UI of the main window. This is done by various methods of JContact, the application's AppBase.
shell/envshell
This sample application demonstrates how to act as an application launcher, power listener, and hard icon bar listener. This sample is also used to launch other applications in the demo and must always be kept active in the top-level Jamfile.
There isn't much user interface to this app, just a main dialog that shows a list of the selectable applications in the system. This dialog allows the user to switch running apps and start and stop apps.
sound/sound
This sample application demonstrates how to play various sounds through the system. It uses a sound component class called Sound to play the actual sounds. This class defines some standard sounds that can be played, and those are the sounds this sample demonstrates.
Make sure the "service" library is in the top-level Jamfile and is marked "Active". Normally the library is already active.
text/styles
This sample application demonstrates the use of the TextState class to set the font, point size, and text styles of a text object.
Note that this sample is limited by the fonts that are available on the system. If the fonts provided do not support the various typefaces and text styles then the sample will appear to not have much effect. On the contrary, it is the font that is limited, not the sample app.
text/textarea
Demonstrates how to use the various features of the FlexTextField and FlexTextArea. These features include: echo characters, filters, action events and setting column size.
Covers: FlexTextField, ActionListeners, ActionEvent, FilterEvent and FilterListener. FlexTextArea, TextEvent, TextListener.
thread/priority
Shows the effect two loaded threads of different priorites can have on each other. The base priority of each thread can be changed dynamically. The paradigm used is two FlexImage objects "racing" around a racetrack (a FlexPanel). You will note that one thread will starve the other when their priorities differ by 4 or 5 points.
Keep in mind that other threads within the system also effect these two threads. Be careful of incrementing the priority higher than 170 as that will begin to starve the application's main thread.
Also shown is how to send Messages to the AppBase's message queue. The message sent has message number set to MSG_PRIORITIES_UPDATE_RACER_POSITION. This is handled in the AppBase by HandleUndispatchedMessage(), which simply updates the position of the specified FlexImage.
The main functions of interest are:
Note: you can increase or decrease the delay in the racer's speed by changing the for-loop in RacerThread::RacerFunction() in thread.cpp
thread/tstreams
This sample application demonstrates how to go about creating a thread on which to run a process. In particular, this sample creates a second thread to perform some processing, and then have the results of that processing sent back to the first thread through a byte stream.
timer/ttimer
This sample application shows how to use the TTimer class to implement an animated object. In particular this sample subclasses TTimer to have the timer control the displaying of the animation. It shows how to give the user control over the timer via dialogs and buttons.
toolkit/buttons
The buttons application displays a text button with the label "Try Me!" and a button with an image as its label. When the text button is pressed, a dialog containing a label slides onto screen. As long as the image button is pressed and held down, a label "Now you see me..." becomes visible. When the image button is released, the label becomes invisible.
toolkit/canvas
Implementation of the Canvas sample application. We are creating a custom gadget and displaying it in this sample.
The custom gadget will show how a FlexCanvas subclass can override the ProcessMouseEvent, ProcessMouseMotionEvent, and ProcessKeyEvent to handle Pen and Keyboard events.
The gadget will look like a status bar. Clicking on a portion of the status bar will set the filled in area to the pressed point. Dragging the mouse will change filled in area. Pressing the left or right key will change the filled in area by 1/10 the total size of the gadget.
toolkit/checkbox
Demonstrates how to use checkboxes with and without checkbox groups. Covers: FlexCheckbox, FlexCheckboxGroup, ItemListeners, and ItemEvents.
toolkit/dialogs
Sample app to show how to use FlexDialog components. The FlexDialog user interface object is like a small FlexFrame. Dialogs are typically used to display a brief message, or ask the user a Yes/No question. This sample has buttons for bringing up several dialogs. Some of the dialogs are modal, which means they block input to the rest of the application. One of the dialogs is system modal which means it blocks input to all other UI objects, even other applications. This is accomplished by running that dialog on the environment shell's thread.
toolkit/frames
This sample application shows you how to use multiple frames in one application. The main frame does not have a close button. It has four buttons, which you use to open other frames. The second frame has a button, which you use to open a fifth frame. The frame and the button that launches the frame use the same text string. The user is responsible for maintaining the memory for these strings.
toolkit/lists
This sample application demonstrates the use of the FlexList class. It builds two lists, one to select an action to perform, and another that contains items to be acted upon. There is a checkbox to allow the user to select multiple items in the second list.
toolkit/menus
Sample application that demonstrates the use of menus. Creates two menus, each with 6 choices. When an item is selected it updates the label of the menu to the selected menu item.
Also contains instructions on how to use FlexMenu.
toolkit/scrlpane
This simple GEOS-SC application contains three user interface (UI) elements:
The FlexSrollPane scrolls the read only textarea vertically and horizontally.
toolkit/scrollbr
This sample application demonstrates the various ways you can use a FlexScrollbar object in your program. The main screen consists of several possible scrollbars.
toolkit/tables
This sample application demostrates the usage of the FlexTable class. It changes a table's selection type of the table. It listens for table events.
toolkit/titles
This application shows you how to use title listeners. There are two things to watch out for in this application:
First, the main frame gets a title when we create it, but we override it with a title listener and give it a new title.
Second, the button has a title listener to change the font, and the horizontal and vertical justification of the moniker. Also, when you press the button, it will display a different moniker.
uma/mimesamp
This sample application demonstrates the usage of the MimeSerializer and MimeDeserializer classes, which are part of the UMA library. Both of these classes do most of the work in this sample app.