Upload
hey-hey
View
243
Download
7
Tags:
Embed Size (px)
DESCRIPTION
good work
Citation preview
Linux RAD/GUI Development
Kylix
Rapid Application Development (RAD), GUI Development for Linux from Borlandby Leland Brode ELB Software [email protected]
Linux GUI DevelopmentPresentation Outline
Background on GUI DevelopmentOverview of KylixDemo GUI ToolsDemo DelphiDemo Kylixby Leland Brode ELB Software [email protected]
Linux GUI DevelopmentKylix
RAD/GUI tool for LinuxPort of Delphi for Windows Runs on LinuxBuilds, compiles native Linux applicationsCross platform Windows/Linux
GUI Dev BackgroundWindows 3.0 1990
Generates MessagesBasic, COBOL, C
All TextVisual Basic 1991
First GUI Dev ToolEvent Handlers code that runs before or after an EventDraw window instead of code itMost widely used languageVisual Basic 6 Bible - Smith Whistler, & Marquis
GUI Dev BackgroundOther GUI Dev Tools
PowerBuilderVisual AgeDigitalk, ParcPlace SmalltalkForte ( now at Sun)Visual C++Borland C++Borland DelphiBorland C++Builder--------------------------Visual Caf - JavaJBuilder - Java
Linux DevelopementGNU Linux Toolkit
GCCCompiles C, C++, Objective C, FortranHandles Front-ends for Pascal, Modula-3, AdaDistributed with LinuxPerl, Shell scripting
Linux Developement Qt Class Library
C++Cross Platform Qt/WindowsQt/X11 (Linux, Solaris, HPUX, AIX, etc)Qt/MacGPL Free for non-commercial appsQt was used to build KDEfrom Trolltech in Norwaywww.trolltech.com
Linux DevelopmentQt Class LibrayQwidget base class
Event Handlers mousePressEvent (QMouseEvent &); mouseMove Event ( mousePressEvent ( enterEvent (Class QMouseEvent : public Qevent { public: int x(); int y(); int button(); int state();Linux Programming Unleashed Kurt Wall - SAMS
Linux DevelopmentOpen Source IDEs
KDevelop www.kdevelop.orgKDE Studio www.thekompany.com/projects/kdestudioCode Crusader www.newplanetsoftware.comVDK Builder vdkbuilder.sourceforge.netSource-Navigator sources.redhat.com/sourcenavC/C++ Users Journal, March 2001 www.cuj.com
Delphi BackgroundBorlands Delphi =
Pascal, plusBorlands implementation of OO in Pascal, plusGUI IDE, plusVisual Component Library (VCL) - encapsulates Windows controls
DelphiPascal
Pascal dev by Niklas Wirth (Swiss, 1970)Versions: U of C San Diego, BorlandBorlands Turbo Pascal 1.0 - ?Turbo Pascal 3.0 for DOS - 1985Object Extensions to Pascal 5.5 - ?Turbo Pascal for Windows - 1991Delphi - OO Pascal 1995polymorphism, inheritance, encapsulationhttp://www.engin.umd.umich.edu/CIS/course.des/cis400/index.htmlhttp://www.emsps.com/oldtools/borpasv.htm
DelphiGUI Integrated Development Environment
Based on Visual Basic model
DelphiIDE
project managerkeeps track of all source files for a projectcode editorcode completionGUI form designerintegrated debuggerwatch variableschange variablesbreakpointsstep through code
KylixPort of Delphi to Linux
OO PascalDelphi IDEnative Linux compilerClass Library - CLXObject wrappers for Qt widgetsBorland chose Qt over GTK+Delphis VCL re-engineered to CLX
KylixClass Libraries
CLX is to KylixVCL is to Delphi, C++BuilderMFC is to Visual C++Qt is to KDEGTK is to GNOMECLX runs on Linux and Windows
DelphiVCL Class Library
Object wrappers for Windows Controls
TObject |TControl __ | |TForm TButton
KylixCLX Class Library
Object wrappers for Qt Widgets
TObject |TControl __ | |TForm Tbutton
CLX also in Delphi 6, and C++Bldr for cross platform
KylixPascal Language
Source File = UnitUnits -> compile, link -> executablecode - .pas fileform - .dfm file ( each form has a .pas file )
KylixPascal Language
Data typesInteger 2147483648 to 2147483647Cardinal 0 to 4,294,967,785Byte 0 to 255Double floating pointCurrency Arrays MyArray : array[0..10] of Integer; // fixedMyArray : array of Integer; // dynamicSetLength(MyArray, length); // allocates memory for dynamic arrayMyArray[length-1] := 1,024 // assignment
KylixPascal Language
String dynamicConcat, Copy, Delete, Insert, Length, Pos, SetLengthPointersExceptionsTry-except (same as try-catch in java, c++)File IOfunction returns valueprocedure no return value
KylixPascal Language - function
function Factorial(Number : Cardinal): Int64;var N : Cardinal;begin Result := 1; for N := 2 to Number do Result := Result * N;end;
KylixPascal Language class definition
type TAccount = class private fNumber : Cardinal; fBalance : Currency; public procedure WithDraw(Amount : Currency); end;
TSavingsAccount = class (TAccount) private fReturnCheck : Boolean end;TCertificateof Deposit = class(TSavingsAccount) private fTerm : Cardinal; end;
KylixPascal Language use classes
var CD1, CD2 : TAccount;begin CD1 := TCertificateofDeposit.Create; CD2 := TCertificateofDeposit.Create; CD1.WithDraw(100.00);
CD1.Free; CD2.Free;end;
KylixPascal Language Records and Arrays
type PersonType = record LastName : String[10]; FirstName : String[10]; EmployeeNumber : Integer; end; { Persontype }
MyArrayType = array [1..5] of PersonType;
var PersonArray : MyArrayType;begin PersonArray[1].FirstName := Donald; PersonArray[1].LastName := Duck;
KylixPascal Language Components and Arrays
var ButtonArray : array of TButton; i, Num : integer;begin Num :=0; for i := 0 to Self.ComponentCount 1 do // Self same as this in C++ if Self.Components[i] is TButton then begin Inc(Num); SetLength(ButtonArray, Num); ButtonArray[Num-1] := TButton(Components[i]); end;end;
KylixPascal Language Comparison
Pascalvar i : Integer;begin i := 1;
C++ int i; i = 1;
Perlmy $i;$i = 1;
KylixPascal Language Comparison
Pascalvar i : Integer; name String[20];begin if i = 1 then begin name := Leland; i := i + 1; end;end;C++ int i; char name[20]; if(i == 1) { strcpy(name, Leland); i = i + 1; }Perlmy $i;my $name;if($i == 1) { $name = Leland; $i = $i + 1; }
KylixPascal Language Comparison
Pascal while i < 100 do Inc(i);
C++ while (i < 100) i++; Perl while ($i < 100) { $i++;}
KylixPascal Language Comparison
Pascal for i := 0 to 100 do begin if i = 50 then Break; end;
C++ for( i = 0; i
KylixQt
access to all Qt Widget public Events and PropertiesLibc
access to all libc functions
KylixGUI ApplicationsDatabase ApplicationsConsole ApplicationsWeb Server Applications
KylixLinux Multiprocessing apps
separate memory, communicate via file systemLinux Multithreading apps
same memory, share resourcesTThread base class
KylixGUI Applications - (CLX TForm class)
Form1.Canvas.Brush.Color := clRed;or := RGB(255, 0, 0);Form1.Canvas.Rectangle(10, 10, 100, 100);Form1.Canvas.Pen.color := clBlack;Form1.Canvas.Pen.Width := 2;Form1.Canvas.MoveTo(0, 20); // draw lineForm1.Canvas.LineTo(60, 20); // draw lineForm1.Canvas.Font.Name := Arial;Form1.Canvas.Font.Size := 24;Form1.Canvas.TextOut(30,1, Hello World); // write text
KylixDatabase Applications
db : TClientDataSetdb.FileName := /xxx/nnn/yyy;db.Open;db.Locate(EmpNum, 124433, []);mystring := db.FieldValues[LastName];
KylixDatabase Applications
db : TSQLDataSetdb.CommandText := select * from .;db.Open;
KylixDatabase Applications
data aware controlsautomatically fill in data value from databaseautomatically update data value to databasecontrols can be Active while building form
KylixWeb Applications
- raw CGI or
- TWebApplication | TCGIApplication
KylixKylix Versions
Kylix 1, 2, 3 (I am using 2)Kylix 1, 2 Delphi (Pascal)Kylix 3 add C++ Builder (C++)
Kylix Enterprise - Web, Middleware objects, Database objectsKylix Professional - Database objectsKylix Open Edition Build open source apps licensed under GNU General Public License
KylixTechnical Requirements Kylix 2
Pentium 400 Mhz ( I am using 366 Mhz)128MB RAM ( I am using 192MB)175MB disk spaceRed Hat 6.2 or higher (I am using 7.2, Kernel 2.4.7)SuSE 7.0 or higher
KylixKylix Download
http://www.borland.com/products/downloads/download_kylix.html#Kylix 3 currently availableKylix 2 ??
KylixFreeCLX Project
Open Source CLX Class Libraryavailable at SourceForge.netincludes BaseCLX, VisualCLX, and DataCLX classes (brings full functionality to Kylix Open Edition ?)lack of detailed information on FreeCLX
KylixBibliography
Visual Basic Bible, Smith, Whistler, & MarquisDelphi in a Nutshell, Ray Lischer, OReillyLinux Programming Unleashed, Kurt Wall, SAMSObject Pascal Language Guide, Borland Delphi 3 DocumentationTeach Yourself Delphi in 21 Days, Osier, Grobman, & Batson, SAMSKylix: The Professional Developers Guide and Reference, Jon Shemitz, ApressMastering Kylix 2, Cantu & Barbini, SYBEXBorland Kylix Developers Guide, Calvert, Calvert, Kaster, & Swart, SAMSIn the Trenches, by Dale Fuller, LINUX Magazine, January 2002Product Review of Kylix 2, LINUX Magazine, May 2002Kylix vs. gcc Development http://community.borland.com/article/0,1410,28555,00.htmlTechnical Overview of the Kylix Compiler http://community.borland.com/article/0,1410,28561,00.htmlApache Development with Kylix http://community.borland.com/article/0,1410,28556,00.html Kylix and Qt, excerpts form Kylix newsgroup http://community.borland.com/article/0,1410,21850,00.htmlKylix newsgroup borland.public.kylix,non-technical
Kylixproduct demo