>> Rodney Roberts IS & Education Professional Homepage   >> Programming Tutorials And Downloads   >> Model Rockets & Boost/Gliders Programming

Science makes it known,
Engineering makes it work,
Art makes it beautiful.


Using Lazarus Tab Sheets (TPageControl & TTabSheet)
(Multi-Stage Model Rocket User Interface)

Rockets may consist of multiple stages. These stages may be serial
(can also be referred to as seequental or simply stages) and/or parallel.

This page demonstrates implementing Lazarus Tab Sheets using a
serial multi-stage model rocket data input application as an example.

Below is a partial application screenshot using Lazarus
TTabSheets;  diagram at right shows data modeling approach.

After the user enters the rocket design parameters, this application
calculates Coefficients of Normal Force and Centers of Pressure
for a single stage or a multi-stage model rocket1 - will it have a
stable flight?

Stability checking requires that each stage's components be
analyzed separately and then combine the results.

One possible user interface to input the data is with tabs. Each of
the tabs represent a stage.  Stage 1 is the uppermost stage;
stage n is the lowermost stage.  1st stage through nth stage
refers to flight mode.
  (It can be confusing)

Normally, a rocket uses 3 or fewer stages - the parasitic loses
(weight, drag, etc.) often exceed the gain of the additional stage(s).
3 stage rocket 1

Sample Application Using TPageControl 2

A TPageControl contains one or more TTabSheets (in this example, TabStage1 through TabStage6).

The TTabSheet TControl can contain any of the usual TControls for displaying/editing data - TLabel, TEdit, TStringGrid, TImage, etc.

These TControls can be copied from an existing TTabSheet and pasted to a new TTabSheet.

Warning.  Do not add any event procedures to the source TTabSheet's TControls prior to copying and pasting (see below).
Object Inspector showing TControls

Adding TPageControl & TTabSheet to a Form

To place a TPageControl on a TForm, select the Common Controls tab on the Lazarus IDE tool bar, click on the circled icon shown below,

and draw it on the form as shown below.3  This
produces a blank TPageControl container to add
TTabSheets to.

blank TPageControl container
   adding TTabSheet
To add a TTabSheet, right click in the TPageControl
TControl on the Form   -OR-   on the TPageControl
TControl in the Object Inspector window.  This brings
up the short-cut menu for adding/inserting/deleting/moving
pages, copy/paste, etc., as shown above and below.
Click on either Add Page or Insert Page.
When finished adding the first TTabSheet, add all the required TControls (TLabel, TEdit, TStringGrid, TImage, etc.) to the TTabSheet.
(do not add event procedures prior to copying)
These can then be copied to successive TTabSheets.

inserting TTabSheet

Copying TControls from one TTabSheet and Pasting to another TTabSheet

First, using Object Inspector, select the desired TControls (while holding down the Ctrl key, left click on the TControl)
from the source TTabSheet (do not include the TTabSheet).
Right click and select Copy.

Copying TControls

Next, left click on the tab of the empty TTabSheet TControl just added.
Right click in the TTabSheet TControl on the Form.  Select Paste
(Hint: you may want to change the pasted TControls names from the default Lazarus assigned unique name)

Pasting TControls

Finally, make any Name, Hint, etc., corrections to the pasted TControls, add event procedures, etc.

1. Barrowman, James. TIR-33 Calculating the Center of Pressure
Image from p. 20, Figure 12 and then modified
2. TMissle10 is the form class used in this unit, Missle11.pasMissle11/Missle10 is designed to be executed as either a stand-alone
main form or as a sub-form of a multiform application.  For example, when executed as a main form,  File, Exit  is used to exit the application.
When executed as a sub-form,  File, Close Form  is used to close the form -  File, Exit  is disabled; there are other processing differences as well.
Accomplished with public variable Missle10.frmType and interface section constants MainForm, SubForm.  In the *.lpr file (Project Main
Source), use the statements:
  Application.CreateForm(TMissle10, Missle10);
- OR -
  Application.CreateForm(TMissle10, Missle10);
Use the former to execute as a main form, the latter to execute as a sub-form; to activate as a sub-form use  
ModalResult:=Missle10.ShowModal( );   in higher level form.
File, Close Form   sets   ModalResult:=mrClose;
Missle11/Missle10 calls procedures in missle02.dll (which calls subprograms in mathproc.dll) and nrlazrs.dll (which calls subprograms in
sttstcs.dll and mathproc.dll; instead of Lazarus program directly calling a FORTRAN subprogram, recommend calling FORTRAN .dll
subprograms via an Object Pascal .dll; do not recommend calling D procedures from Lazarus directly or indirectly).
After this project was nearly completed, it occurred to me how to possibly further streamline each stage's Conical Transition TStringGrid events'
processing - part of being a professional, learning to criticize one's work.
3. Thanks to LAZ PLANET for some of the material.

Any and all © copyrights, ™ ® trademarks, or other intellectual property (IP) mentioned here are the property of their respective owners. No infringment is intended.

Feel free to use any of the above in your project (without violating any intellectual property rights); please give credit (same idea as Copyleft).

Page best viewed with Mozilla FireFox 3.6.13 (or higher; recommended), Chrome, and Safari 5.1.7; some versions of Internet Explorer may not display properly.  Avoid Smart Applications Speed Browser.

Web hosting provided by  
FREE WEB HOSTING Award Space Web Hosting Free Web Hosting ,   &  X10hosting Free Web Hosting.

>> Rodney Roberts IS & Education Professional Homepage   >> Programming Tutorials And Downloads   >> Model Rockets & Boost/Gliders Programming