https://wiki.freepascal.org/api.php?action=feedcontributions&user=Cjaster&feedformat=atomFree Pascal wiki - User contributions [en]2024-03-29T00:28:34ZUser contributionsMediaWiki 1.35.6https://wiki.freepascal.org/index.php?title=Using_INI_Files&diff=46416Using INI Files2010-12-05T20:10:49Z<p>Cjaster: </p>
<hr />
<div>{{INI Files}}<br />
==INI Files==<br />
<br />
===Basic Information===<br />
INI files can be used to save basic user settings easily. With the '''INIfiles''' unit and the '''TINIFile''' class you can easily work with existing INI files. This unit is found in the FCL.<br />
<br />
===INI Files===<br />
INI Files use brackets to include '''Sections'''. In these sections are keys and key values..<br />
Key's and values and separated through "equal" symbols (=) ... Section names are put inside square brackets ([Section])<br />
INI Files aren't has popularly used as XML files are, this is because INI files don't handle large strings very well. <br />
<br />
===Example===<br />
<br />
The first thing we shall do is a simple console Application.<br />
First thing you should do is create an INI file and call it '''DB.ini''' and put it in your C:\ drive. Containing a section called INIDB and the following keys and values:<br />
<br />
Author=Adam<br />
Pass=<br />
DBFile=C:\Money.dat<br />
<br />
Now lets move on the the code..<br />
<Delphi><br />
Program Project1;<br />
<br />
{$mode objfpc}{$H+}<br />
<br />
Uses<br />
Classes,SysUtils,INIFiles;<br />
<br />
Var<br />
INI:TINIFile;<br />
Author,Pass,DBFile:String;<br />
PassEnter:String;<br />
<br />
begin<br />
INI := TINIFile.Create('C:\DB.ini');<br />
Author := INI.ReadString('INIDB','Author','');<br />
Pass := INI.ReadString('INIDB','Pass','');<br />
DBFile := INI.ReadString('INIDB','DBFile','');<br />
if Pass <> '' then<br />
begin<br />
Writeln('Password Required');<br />
Repeat<br />
Readln(PassEnter);<br />
if not PassEnter = Pass then Writeln('Wrong Password');<br />
until(PassEnter = Pass);<br />
Writeln('Correct Password');<br />
end;<br />
Writeln('Author : '+Author);<br />
Writeln('File : '+DBFile);<br />
Writeln('Password : '+Pass);<br />
Readln;<br />
end. <br />
</Delphi><br />
===Objects to know===<br />
In the TINIFile class there are many different Propertys, procedures and functions to be used.<br />
<br />
'''CaseSensitive''' - This property allows you to say if the keys and sections are case sensitive or not.. by default they aren't..<br />
<br />
'''ReadString''' - Has 3 constant statements. the first one is the section to search in. The second one is the key to look for. The third one is a default string incase the key and\or section searched for is not found.<br />
<br />
'''WriteString''' has three constant statements too... The first is the section. The third is the key and the last is the Value. If the key and section exist already the Key will be over written with the new value..<br />
<br />
'''ReadSections''' - Will allow you to to take the sections from the INI file and put them in a TStrings class(Or TStringList with the AS code)<br />
<br />
'''DeleteKey''' - Remove an existing Key from a specific section<br />
<br />
'''EraseSection''' Remove a section and all its data<br />
<br />
There are more procedures and functions but this is basic..<br />
<br />
===Last words...===<br />
Here: [http://lazarus-ccr.sourceforge.net/docs/fcl/inifiles/index.html] you can learn all about INI Files to..<br />
Please, if you can put up more information about INI files in Pascal.<br />
'''Modify At Will'''<br />
<br />
[[Category:Tutorials]]</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Using_INI_Files&diff=44339Using INI Files2010-08-30T17:26:32Z<p>Cjaster: INI Files..</p>
<hr />
<div>==INI Files==<br />
<br />
===Over View===<br />
INI files can be used to save basic user settings easily. With the INIfiles unit and the TINIFile class you can easily work with existing INI files... I will show you the basics of the TINIFile class.<br />
<br />
===INI Files?===<br />
INI Files work with sections,keys and values. Example:<br />
[Section]<br />
Key=Value<br />
<br />
Just like that...<br />
It is posible to have multiple keys and sections..<br />
<br />
====Why?====<br />
INI files make it incredibly easy to read and work with data.<br />
Similar to XML files.. I think programmers should be well rounded with one or the other.. Or both. <br />
<br />
===Example===<br />
<br />
So first things first.. Lets do a basic console application.<br />
<Delphi><br />
Progam INIex;<br />
<br />
{$mode objfpc}<br />
<br />
Uses<br />
SysUtils,INIFiles;{INIFiles = The unit with the INI Classes}<br />
<br />
Var<br />
IniF:TINIFile;//The class<br />
</Delphi><br />
<br />
Something you have to know is that when using the TINIfile class you have to work with an existing INI file.. So open Note pad and create an INI file.. Lets use this as an example:<br />
<br />
[S1]<br />
<br />
Key1=Hello World<br />
<br />
[S2]<br />
<br />
Key2=Worldly Hello<br />
<br />
Ok.. Now back to our code<br />
<Delphi><br />
begin<br />
Writeln('Creating class');<br />
IF(FileExists('someini.ini'))then<br />
begin<br />
Inif := TINIFile.Create('someini.ini');<br />
Writeln(INiF.ReadString('s1','Key1','');<br />
End else Writeln('File not found...');<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
===Objects to know===<br />
In the TINIFile class there are many different Propertys,procedures and functions to be used.<br />
<br />
'''CaseSensitive''' - This property allows you to say if the keys and sections are case sensitive or not.. by default they aren't..<br />
<br />
'''ReadString''' - Has 3 constant statements. the first one is the section to search in. The second one is the key to look for. The third one is a default string incase the key and\or section searched for is not found.<br />
<br />
'''WriteString''' has three constant statements too... The first is the section. The third is the key and the last is the Value. If the key and section exist already the Key will be over written with the new value..<br />
<br />
'''ReadSections''' - Will allow you to to take the sections from the INI file and put them in a TStrings class(Or TStringList with the AS code)<br />
<br />
'''DeleteKey''' - Remove an existing Key from a specific section<br />
<br />
'''EraseSection''' Remove a section and all its data<br />
<br />
There are more procedures and functions but this is basic..<br />
<br />
===Last words...===<br />
Here: [http://lazarus-ccr.sourceforge.net/docs/fcl/inifiles/index.html] you can learn all about INI Files to..<br />
Please, if you can put up more information about INI files in Pascal.<br />
'''Modify At Will'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44338Lazarus Documentation2010-08-30T16:55:20Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[Using INI Files]] - How to work with INI files in pascal.<br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Multimedia Programming]] - How to play videos and sounds<br />
*[[More Lazarus/FPC Tutorials]] - These are only the main tutorials. This other page shows more Lazarus/FPC tutorials.<br />
*There are also other tutorials not hosted here in [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44337File Handling In Pascal2010-08-30T16:51:56Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Uses<br />
Sysutils;<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+inttostr(IOResult));<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
<br />
{$mode objfpc}<br />
<br />
Uses<br />
Sysutils;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:'+inttostr(IOResult));<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
<br />
{$mode objfpc}<br />
<br />
Uses<br />
Sysutils;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:', IOResult);<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
It is possible to do some file handling using chars instead of strings. This makes it look cool :D.<br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44282File Handling In Pascal2010-08-26T23:37:29Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+inttostr(IOResult));<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:'+inttostr(IOResult));<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:', IOResult);<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
It is possible to do some file handling using chars instead of strings. This makes it look cool :D.<br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44114Lazarus Documentation2010-08-19T23:24:19Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[File Handling In Pascal]] - Basic file handling for pascal beginners.<br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[Streaming components]] - How to write components to streams and read/create components from streams<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Playing videos]] - How to play videos<br />
*These are only the main tutorials. For more Lazarus/FPC tutorials see [[More Lazarus/FPC Tutorials]]<br />
*For tutorial about the Pascal language see [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44113Lazarus Documentation2010-08-19T23:21:42Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[INI File Handling]] - Learn how to use INI Files for configs,Databases,etc,etc.<br />
*[[File Handling In Pascal]] - Basic file handling for pascal beginners.<br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[Streaming components]] - How to write components to streams and read/create components from streams<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Playing videos]] - How to play videos<br />
*These are only the main tutorials. For more Lazarus/FPC tutorials see [[More Lazarus/FPC Tutorials]]<br />
*For tutorial about the Pascal language see [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44112File Handling In Pascal2010-08-19T23:13:59Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult));<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult));<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
It is possible to do some file handling using chars instead of strings. This makes it look cool :D.<br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44111File Handling In Pascal2010-08-19T23:11:15Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult));<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult));<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44110File Handling In Pascal2010-08-19T23:10:44Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:+IntToStr(IOResult);<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult));<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44109File Handling In Pascal2010-08-19T23:07:57Z<p>Cjaster: /* Example */</p>
<hr />
<div>==File handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings, error logs, and more. Here i am going to teach you how to work with basic text files.<br />
<br />
===About files===<br />
<br />
When using files in pascal, you can use a TextFile type, which allows you to write string into the file or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Integers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If we only did TFile = File, then it would be impossible to write anything into it! Also, you cannot write integers directly into TFile, because it is a file of strings. Better use the filetype TextFile for writing values of different types.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal. It is used for getting errors.<br />
Since it is a compiler directive, you have to do this:<br />
<Delphi><br />
{$I-}//Turn off checking. This way all errors go into the IOResult variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
<br />
By disabling (Turning off) IO it all goes into the IOResult variable. This is an cardinal type(Numbers). So, if you want to write it, you have to use the InttoStr function. Different numbers mean different errors. So you may want to check here for the different errors: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File procedures==<br />
<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
A full example of handling a text file of type TextFile:<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Do not forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt'); // you do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar); // creating the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Now open the file in any text editor and you will see Hello written to it!<br />
<br />
Heres appending to a file(Editing it)<br />
<br />
<Delphi><br />
Program EditFile;<br />
<br />
Var<br />
File1:TextFile;<br />
<br />
begin<br />
Writeln('Append file');<br />
AssignFile(File1,'File.txt');<br />
{$I-}<br />
Try<br />
Append(File1,'Some Text');<br />
Except<br />
Writeln('ERROR IORESULT:+IntToStr(IOResult);<br />
End;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
Reading a file:<br />
<br />
<Delphi><br />
Program ReadFile;<br />
<br />
Var<br />
File1:TextFile;<br />
Str:String;<br />
<br />
begin<br />
Writeln('File Reading:');<br />
AssignFile(File1,'File,txt');<br />
{$I-}<br />
Try<br />
Reset(File1);<br />
Repeat<br />
Readln(File1,Str);//Reads the whole line from the file<br />
Writeln(Str);//Writes the line read<br />
Until(EOF(File1));EOF(End Of File) The the program will keep reading new lines until there is none.<br />
Except<br />
Writeln('ERROR IORESULT:'+IntToStr(IOResult);<br />
end;<br />
{$I+}<br />
CloseFile(File1);<br />
Readln;<br />
end.<br />
</Delphi><br />
<br />
==Other file procedures==<br />
<br />
The SysUtils and some other units have procedures for making text files. [http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Creating TextFiles in OOP (Object Orientated Pascal) is simple and fast. Mainly because most objects have a SaveToFile procedure.<br />
<br />
The usage is similar to that of a TStringList:<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
I hope this is helpful :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44048File Handling In Pascal2010-08-17T18:30:33Z<p>Cjaster: /* About Files */</p>
<hr />
<div>==File Handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings,error logs, and more. Here im going to teach you how to work with basic Text Files. First things first.<br />
<br />
===About Files===<br />
<br />
When using files in pascal you can use a TextFile type which will allow you to write string into the file, Or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Numbers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Of String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
IF we only did TFile = File Then it would be impossible to write anything into it! You can't write integers into the TFile we made because its a file of strings.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal.. Its what is used for getting errors.<br />
Its a compiler directive so you have to do this<br />
<Delphi><br />
{$I-}//Turn Off the checking. This way all errors go into the IOResult Variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
By disabling(Turning Off) IO it all goes into the IOResult Variable. This is an cardinal type(Numbers). So if you want to write it you have to do the InttoStr Function. Different numbers mean different errors so you may want to check here for the different Error: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File Procedures==<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
So heres a full example of handling a text file with the TextFile Type<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Cant forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt');//You do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar);//Call for Making the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
Now open that file in some text editor and you will see Hello written in it!<br />
You can look all over the internet for examples of the Reset and Append Procedures.<br />
<br />
==Other File Procedures==<br />
The SysUtils and some other Units have procedures for making text files.[http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Making TextFiles in OOP(Object Orientated Pascal) is simple and fast. Mainly because most objects have the SaveToFile procedure.<br />
<br />
Much like a TStringList would:<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
Hope I Helped you :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=TStringList-TStrings_Tutorial&diff=44041TStringList-TStrings Tutorial2010-08-16T19:49:14Z<p>Cjaster: /* TStringList */</p>
<hr />
<div>==TStringList==<br />
<br />
The TStringList(Or TStrings) is much like a fancy dynamic array or Set of Strings(Not Possible). It will come in handy alot when programming and im going to teach you basic TStringList Usage!<br />
<br />
<Delphi><br />
Program StrList;<br />
<br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;//This is needed when using this class(or most classes)<br />
Str.Add('Some String!');<br />
Readln;<br />
end;<br />
</Delphi><br />
<br />
This is a simple program(Console) that will create and add one string to a string list!<br />
Now heres some things you should know:<br />
<br />
'''Create''' - Will create the string list for modifying.<br />
<br />
'''Count''' - Is a counter for the amount of strings in the List. It is a '''zero based counter'''<br />
<br />
'''Add''' - Will allow you to add one string to the string list. It is a Function that will return the '''Index''' of the String. This is Were the counter comes in handy.<br />
<br />
'''Delete''' - Will delete a string from the string list. Just know that you do not simply input the string, you have to input the index of the string.(Like I said. Its like a fancy Dynamic Array)<br />
<br />
'''IndexOf''' - Will allow you to return the index of the string in the list. If it is not found it returns -1.<br />
<br />
'''Clear''' - Will clear the list.<br />
<br />
===Example===<br />
<br />
How about a more juicy example, Eh?<br />
<br />
<Delphi><br />
<br />
Program StrList;<br />
<br />
Var<br />
Str:TStringList;<br />
S:String;<br />
Counter:Integer;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Writeln('String List Test');<br />
Repeat<br />
Writeln('Input a string to add');<br />
Readln(S); <br />
IF(S = 'EXIT')Then Halt;<br />
IF NOT(S = '')Then<br />
begin<br />
Counter := Str.Add(S);<br />
Writeln('String: '+S'+ was Added!');<br />
Writeln('Index is: '+InttoStr(Counter);//The counter will always become the index of the last thing added<br />
end Else Writeln('Nothing Inputed :D');<br />
Until(S = 'EXIT');<br />
end;<br />
</Delphi><br />
<br />
==File Handling==<br />
<br />
When using the TStringList you have 2 main file handling procedures.<br />
'''SaveToFile''' And '''LoadFromFile'''<br />
By Using SavetoFile it will save all strings in the list to a file.<br />
LoadFromFile will open the file and add the file data to the list string by string.<br />
<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
begin<br />
Str := TStringList.Create;<br />
Str.LoadFromFile('SomeFile.txt');<br />
Str.Add('Hello');<br />
Str.SaveToFile('SomeFile.txt');<br />
end;<br />
</Delphi><br />
<br />
You just opened a file,edited it and saved it right back to were it was!<br />
<br />
===Keep Learning===<br />
You can learn all the different procedures,functions and property's Here: [http://www.freepascal.org/docs-html/rtl/classes/tstringlist.html]<br />
<br />
IF you feel i might have left something out, '''Modify At Will!'''<br />
<br />
Hope I helped!</div>Cjasterhttps://wiki.freepascal.org/index.php?title=File_Handling_In_Pascal&diff=44040File Handling In Pascal2010-08-16T19:45:00Z<p>Cjaster: File Handling In Pascal</p>
<hr />
<div>==File Handling==<br />
<br />
Something most programmers need to know how to do is work with files. Files can be used to save user settings,error logs, and more. Here im going to teach you how to work with basic Text Files. First things first.<br />
<br />
===About Files===<br />
<br />
When using files in pascal you can use a TextFile type which will allow you to write string into the file, Or create your own file type.<br />
<br />
<Delphi><br />
...<br />
Type<br />
TIFile = File Of Integer;//Allows you to write Numbers into the file<br />
TCFile = File Of PChar;//Write PChars into the file :\<br />
TFile = File Os String;//Write Strings into the file<br />
...<br />
</Delphi><br />
<br />
If you simply do a file definition it will be impossible to write anything into it. You can write Integers into the TFile we made because its a file of Strings! See?<br />
Ok now for Error handling.<br />
<br />
==IO==<br />
<br />
IO is the file handling thingy for pascal.. Its what is used for getting errors.<br />
Its a compiler directive so you have to do this<br />
<Delphi><br />
{$I-}//Turn Off the checking. This way all errors go into the IOResult Variable<br />
{$I+}//Turn it back on<br />
</Delphi><br />
By disabling(Turning Off) IO it all goes into the IOResult Variable. This is an cardinal type(Numbers). So if you want to write it you have to do the InttoStr Function. Different numbers mean different errors so you may want to check here for the different Error: [http://www.efg2.com/Lab/Library/Delphi/IO/IOResult.htm]<br />
<br />
==File Procedures==<br />
There are three file procedures you really need to know about<br />
<br />
'''Rewrite''' - Is used for creating files<br />
<br />
'''Append''' - Opens an existing file for editing it<br />
<br />
'''Reset''' - Opens a file for reading it<br />
<br />
==Example==<br />
<br />
So heres a full example of handling a text file with the TextFile Type<br />
<br />
<Delphi><br />
Program FileTest;<br />
<br />
{$mode objfpc} //Cant forget this ever<br />
<br />
Var<br />
FileVar:TextFile;<br />
<br />
begin<br />
Writeln('File Test');<br />
AssignFile(FileVar,'Test.txt');//You do not have to put .txt but this is just for now<br />
{$I-}<br />
Try<br />
Rewrite(FileVar);//Call for Making the file<br />
Writeln(FileVar,'Hello');<br />
Except<br />
Writeln('ERROR! IORESULT: '+InttoStr(IOResult);<br />
End;<br />
CloseFile(FileVar);<br />
Readln;<br />
end.<br />
</Delphi><br />
Now open that file in some text editor and you will see Hello written in it!<br />
You can look all over the internet for examples of the Reset and Append Procedures.<br />
<br />
==Other File Procedures==<br />
The SysUtils and some other Units have procedures for making text files.[http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html]<br />
<br />
==OOP==<br />
<br />
Making TextFiles in OOP(Object Orientated Pascal) is simple and fast. Mainly because most objects have the SaveToFile procedure.<br />
<br />
Much like a TStringList would:<br />
<Delphi><br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Str.Add('Hello');<br />
Str.SaveToFile(<File Path Here>);<br />
end;<br />
</Delphi><br />
<br />
Hope I Helped you :D<br />
And if anything is wrong or I left something out. '''Edit At Will!'''</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44039Lazarus Documentation2010-08-16T19:19:08Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[File Handling In Pascal]] - Basic file handling for pascal beginners.<br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[Streaming components]] - How to write components to streams and read/create components from streams<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Playing videos]] - How to play videos<br />
*These are only the main tutorials. For more Lazarus/FPC tutorials see [[More Lazarus/FPC Tutorials]]<br />
*For tutorial about the Pascal language see [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjasterhttps://wiki.freepascal.org/index.php?title=TStringList-TStrings_Tutorial&diff=44028TStringList-TStrings Tutorial2010-08-15T22:32:59Z<p>Cjaster: Learn how to use the TStringList</p>
<hr />
<div>==TStringList==<br />
<br />
The TStringList(Or TStrings) is much like a fancy dynamic array or Set of Strings(Not Possible). It will come in handy alot when programming and im going to teach you basic TStringList Usage!<br />
<br />
<Delphi><br />
Program StrList;<br />
<br />
Var<br />
Str:TStringList;<br />
<br />
begin<br />
Str := TStringList.Create;//This is needed when using this class(or most classes)<br />
Str.Add('Some String!');<br />
Readln;<br />
end;<br />
</Delphi><br />
<br />
This is a simple program(Console) that will create and add one string to a string list!<br />
Now heres some things you should know:<br />
<br />
'''Create''' - Will create the string list for modifying.<br />
<br />
'''Count''' - Is a counter for the amount of strings in the List. It is a '''zero based counter'''<br />
<br />
'''Add''' - Will allow you to add one string to the string list. It is a Function that will return the '''Index''' of the String. This is Were the counter comes in handy.<br />
<br />
'''Delete''' - Will delete a string from the string list. Just know that you do not simply input the string, you have to input the index of the string.(Like I said. Its like a fancy Dynamic Array)<br />
<br />
'''IndexOf''' - Will allow you to return the index of the string in the list. If it is not found it returns -1.<br />
<br />
'''Clear''' - Will clear the list.<br />
<br />
===Example===<br />
<br />
How about a more juicy example, Eh?<br />
<br />
<Delphi><br />
<br />
Program StrList;<br />
<br />
Var<br />
Str:TStringList;<br />
S:String;<br />
Counter:Integer;<br />
<br />
begin<br />
Str := TStringList.Create;<br />
Writeln('String List Test');<br />
Repeat<br />
Writeln('Input a string to add');<br />
Readln(S); <br />
IF(S = 'EXIT')Then Halt;<br />
IF NOT(S = '')Then<br />
begin<br />
Counter := Str.Add(S);<br />
Writeln('String: '+S'+ was Added!');<br />
Writeln('Index is: '+InttoStr(Counter);//The counter will always become the index of the last thing added<br />
end Else Writeln('Nothing Inputed :D');<br />
Until(S = 'EXIT');<br />
end;<br />
</Delphi><br />
<br />
===Keep Learning===<br />
You can learn all the different procedures,functions and property's Here: [http://www.freepascal.org/docs-html/rtl/classes/tstringlist.html]<br />
<br />
IF you feel i might have left something out, '''Modify At Will!'''<br />
<br />
Hope I helped!</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44027Lazarus Documentation2010-08-15T22:05:07Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[TString List-TString Tutorial]] - Information for beginners In using the TStringList <br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[Streaming components]] - How to write components to streams and read/create components from streams<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Playing videos]] - How to play videos<br />
*For Pascal tutorials see [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjasterhttps://wiki.freepascal.org/index.php?title=Lazarus_Documentation&diff=44026Lazarus Documentation2010-08-15T22:04:44Z<p>Cjaster: /* Lazarus and Pascal Tutorials */</p>
<hr />
<div>{{Lazarus Documentation}}<br />
<br />
==Lazarus and Pascal Tutorials==<br />
*[[TString List-TString Tutoriol]] - Information for beginners In using the TStringList <br />
*[[Overview of Free Pascal and Lazarus]] - A brief discussion of kinds of things you can develop with these general-purpose tools.<br />
*[[Lazarus Tutorial]] - A tutorial for beginners and a detailed description of the Lazarus IDE.<br />
*[[Lazarus IDE Tools]] - An intermediate level tutorial about code completion and other IDE tools.<br />
*[[Lazarus Database Tutorial]] - An introduction to using Lazarus with databases and links to other database articles.<br />
*[[Developing with Graphics]] - Some basic examples on graphic programming.<br />
*[[Object Oriented Programming with FreePascal and Lazarus|Object Oriented Programming with Free Pascal and Lazarus]] - Programming with Objects and Classes in FPC<br />
*[[Console Mode Pascal]] - using the Lazarus IDE for writing Pascal programs for text-mode operation.<br />
*[[Executing External Programs]] - A short tutorial showing how to run external programs from inside your program.<br />
*[[TXMLPropStorage]] - Using TXMLPropStorage to save user preferences.<br />
*[[Hardware Access]] - How to access hardware devices, such as ISA cards, PCI cards, parallel and serial ports and USB devices.<br />
*[[Networking|Web Programming and Networking]] - Tutorials about TCP/IP protocol, WebServices and links to web development articles.<br />
*[[XML Tutorial]] - Writing and reading XML files<br />
*[[Multithreaded Application Tutorial]] - How to write multithreaded applications using Free Pascal and Lazarus<br />
*[[Streaming components]] - How to write components to streams and read/create components from streams<br />
*[[OpenGL Tutorial]] - How to use GLUT in Lazarus<br />
*[[Creating bindings for C libraries]] - How to convert C header files (.h) to pascal units<br />
*[[Lazarus/FPC Libraries]] - How to create dynamic libraries (.so, .dll, .dylib) and how to use them<br />
*[[Translations / i18n / localizations for programs]] - How to provide localized versions of your programs and packages<br />
*[[Daemons and Services]] - How to write windows services and/or linux daemons.<br />
*[[Office Automation]] - How to interact with office software and create spreadsheets, text documents, presentations, etc.<br />
*[[Lazarus Inline Assembler]] - a getting started guide.<br />
*[[VirtualTreeview Example for Lazarus]] - Using VirtualTreeview on Lazarus.<br />
*[[Webbrowser]] - Webbrowser controls<br />
*[[Playing videos]] - How to play videos<br />
*For Pascal tutorials see [[Lazarus Documentation#Lazarus related blogs and websites]]<br />
<br />
==The Lazarus User Guides==<br />
*[[Lazarus Faq]] - General information about Lazarus and specifics for Linux and Windows users.<br />
*[[Lazarus DB Faq]] - FAQ on database issues in Lazarus.<br />
*[[Databases in Lazarus]] - An overview of using databases in Lazarus<br />
*[[Feature_Ideas|Wishlist/Wanted Features]] - Features that you would like to see in Lazarus<br />
*[[How do I create a bug report]] - You think you found a bug in Lazarus, how can you report it?<br />
<br />
===Installation=== <br />
*[[Getting Lazarus]] - Brief instructions on how to download and install a released or SVN version of Lazarus<br />
*[[Installing Lazarus]] - A detailed installation guide<br />
*[[Multiple Lazarus]] - How to install several lazarus versions on one machine<br />
<br />
===IDE===<br />
*[[IDE tricks]] - Tips, tricks and hidden features<br />
*[[Lazarus IDE]] - The IDE windows<br />
*[[Lazarus IDE Shortcuts]] - The key mapping and shortcuts.<br />
*[[Lazarus Packages]] - A guide for creating a package under Lazarus<br />
*[[Install Packages]] - A small guide to install packages<br />
*[[Extending the IDE]] - How to add functionality to the Lazarus IDE<br />
*[[Installing Help in the IDE]] - How to install help for the RTL, FCL and LCL in the IDE, as well as installing the Kylix help files in it and also adding help for user packages.<br />
*[[Using Lazarus for other computer languages]] - How to use the IDE for C, Java, etc.<br />
*[[IDE Development]] - Various pages about current development of the IDE.<br />
*[[Lazarus for education]] - How to setup the IDE for courses and beginners.<br />
*[[Lazarus Hacks]] - Customizations and hacks that can adapt the IDE and LCL to specific needs.<br />
<br />
===LCL===<br />
*[[doc:lcl/|LCL documentation]] - On line help for LCL (work in progress).<br />
*[[LCL Components]] - Tutorials about the standard LCL components, complements the reference docs<br />
*[[The LCL in various platforms]] - A brief discussion about LCL features which behave differently in different platforms.<br />
*[[Autosize / Layout]] - How to design forms that work on all platforms.<br />
*[[Main Loop Hooks]] - How to handle multiple event sources<br />
*[[Asynchronous Calls]] - How to queue methods for later execution<br />
*[[File size and smartlinking]] - How to smartlink applications and create smaller executables.<br />
*[[Accessing the Interfaces directly]] - Example how to access the LCL widgetsets<br />
*[[Add Help to Your Application]] - How to create a Online Help for your application<br />
*[[Colors]] - Description of system colors like clDefault, clWindow and the fpImage FPColor<br />
*[[LCL Tips]] - Tips and tricks<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[Lazarus_Tutorial#The_Component_Palette|LCL Components]] - A description of the main LCL controls which come installed with Lazarus, such as TMainMenu, TButton, TComboBox, TTimer, etc.<br />
*[[Components_and_Code_examples#LCL_Usage_examples|LCL Code Examples]] - Example working code for Lazarus.<br />
<br />
===Developing===<br />
*[[The Power of Proper Planning and Practices]] - common-sense programming best practices for the Free Pascal and Lazarus developer<br />
*[[Multiplatform Programming Guide]] - How to develop cross-platform applications and how to port from one platform to another<br />
*[[Deploying Your Application]] - How to create an installer for your application<br />
*[[Cross compiling]] - Creating executables for one platform, on another<br />
*[[GDB Debugger Tips]] - Known Issues / Tips for debugging Pascal using GDB<br />
*[[Remote Debugging]] - How to debug your Lazarus application from another machine<br />
*[[Application Icon]] - Setting the application icon<br />
*[[Using Pascal Libraries with .NET and Mono]] - yes, you can use your Pascal code with .NET and Mono<br />
*[[Pascal and PHP]] - the Pascal connection to PHP<br />
*[[Developing Python Modules with Pascal]] - extending Python with Pascal<br />
*[[Developing Web Apps with Pascal]] - yes, you can write Rich Internet Applications (RIA) with Pascal<br />
*[[Smartphone Development]] - About using FPC and Lazarus to target various smartphones<br />
*[[Lazarus Components Directory]] - A description of extra packages which are shipped with Lazarus, such as support for printers, fpWeb, daemons, etc<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
<br />
=== Tools ===<br />
*[[Lazarus Documentation Editor]] - Using "lazde" to create documentation<br />
*[[FPDoc Editor]] - An integrated editor for documentation files<br />
*[[FPDoc Updater]] - A GUI tool for updating FPDoc files<br />
*[[lazbuild]] - Compiling projects and packages without the IDE<br />
*[[LazSVNPkg]] - Lazarus Subversion IDE Plugin<br />
<br />
===Coming from Delphi===<br />
*[[Lazarus Components]] - Comparison between Lazarus and Turbo Delphi components<br />
*[[Lazarus For Delphi Users]] - For Delphi users who are getting started with Lazarus<br />
*[[Code Conversion Guide]] - How to convert existing code and components from Delphi and Kylix<br />
<br />
==The Lazarus Developer Guides==<br />
*[[Lazarus Development Process]] - Roadmaps, ToDos, current development and what needs to be done for Lazarus 1.0<br />
*[[How To Help Developing Lazarus]] - A guide to help newbies start improving Lazarus<br />
*[[Version Numbering]] - Explanation of the different version numbers of Lazarus <br />
*[[Creating A Patch| Creating a Patch]] - A guide to making a patch with changes made to Lazarus<br />
*[[Creating a Backtrace with GDB]] - A guide to making a backtrace to help you debug a program<br />
*[[Nomenclature]] - Guide to choose a name for a new method or property<br />
*[[DesignGuidelines|Design Guide Lines]] - A guide about how to proceed when changing Lazarus Source Code.<br />
*[[GUI design]] - Notes on guidelines when designing the lazarus GUI<br />
*[[Roadmap]] - An idea of the current status of the various parts of Lazarus<br />
*[[Moderating the bug tracker]] - Guidelines for lazarus developers and moderators for using the [http://www.freepascal.org/mantis/ bug tracker].<br />
*[[Codetools]] - How the codetools are integrated into the IDE<br />
*[[Creating IDE Help]] - How to extend the IDE documentation<br />
*[[Unit not found - How to find units]] - How to setup the IDE and source files<br />
*[[Bounties]] - Need a particular new feature soon? Set a price here. <br />
<br />
===LCL - Lazarus component library===<br />
*[[LCL Messages]] - Guide related to LCL Messages<br />
*[[LCL Internals]] - Implementation details and how to create a new widgetset<br />
*[[LCL Key Handling]] - Help! A key press, what now?<br />
*[[LCL Internals - Resizing, Moving]] - How the LCL communicates with the LCL interface to resize, move controls<br />
*[[LCL Drag Drop]] - Managing dragging, dropping and docking<br />
*[[LCL Unicode Support]] - Road to Unicode enabled Lazarus<br />
*[[LCL Documentation Roadmap]] - Which units have to be documented<br />
*[[LCL Bindings]] - Bindings to use LCL on other languages<br />
<br />
===Interfaces===<br />
{{Interfaces}}<br />
<br />
===Translations===<br />
* [[Getting translation strings right]] A few notes for programmers on how to create and use translateable strings in your application. Quickly discusses general things about creating strings, offers a few hints on implementation issues and points out some things to consider when using English as base language in particular.<br />
* '''Localization Notes:'''<br />
:* [[German localization notes|German]] - Notes and guidelines for translating the Lazarus IDE to German, including a small dictionary to look up often used translations.<br />
:* [[Portuguese-Brazilian Localization Notes|Portuguese-Brazilian]] - Small dictionary containing common translations of terms used in the Lazarus IDE for the Portuguese-Brazilian translation.<br />
:* [[Russian localization notes|Russian]] - Notes and guidelines for translating the Lazarus IDE into Russian.<br />
<!-- *[[TO-DO]] Remaining Tasks --><br />
* [[Help:Add language bar | Add language bar]] explains how you can add a list of translations to the top of a wiki page.<br />
*[[Translations_/_i18n_/_localizations_for_programs#Translating_the_IDE|Translating the IDE]]<br />
<br />
==Additional Components Documentation==<br />
*[[Project Templates]] - the package projtemplates<br />
*[[Pascal Script]] and [[Pascal Script Examples]] - How to use the pascal script components in Lazarus<br />
*[[OpenGL]] - How to use OpenGL in Lazarus<br />
*[[KOL-CE]] - Free Pascal/Lazarus port of KOL&MCK library. How to create very compact applications for Win32/WinCE in Lazarus.<br />
<br />
==Free Pascal Compiler Documentation==<br />
In addition to [http://lazarus-ccr.sourceforge.net/fpcdoc/ this site], the latest version of the documentation can also be found on-line and in a variety of downloadable formats on the main [http://www.freepascal.org/docs.html Free Pascal Compiler site].<br />
<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/user/user.html User's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/prog/prog.html Programmer's guide]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/ref/ref.html Reference guide for the system unit, and supported Pascal constructs]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/index.html Run-Time Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fcl/index.html Free Component Library reference manual]<br />
*[http://lazarus-ccr.sourceforge.net/fpcdoc/fpdoc/fpdoc.html Free Pascal documentation tool manual]<br />
*[[Build messages]]<br />
<br />
==Lazarus related blogs and websites==<br />
'''Blogs'''<br />
*[http://lazarus-dev.blogspot.com/ Lazarus Development] - A blog of Lazarus developers regards development process.<br />
*[[Adventures of a Newbie]] - A blog of a newbie getting started with some tutorial information in a running log.<br />
*[http://lazarusroad.blogspot.com/ On the road with Lazarus/Free Pascal] - A blog dedicated to register my experiences while programming with Lazarus and Free Pascal (by Luiz Américo)<br />
*[http://port2laz.blogspot.com/ Porting to Lazarus] - This blog describes the porting of a medium-sized application (~100 kloc) from D7 with CLX to Lazarus (by Alexsander da Rosa)<br />
*[http://living-lazarus.blogspot.com/ Living Lazarus] - One man's exploration into the possibilities of an open source RAD (by [[User:Wibblytim|Wibblytim]]).<br />
*[http://beeography.wordpress.com/tag/object-pascal/ Bee.ography] just (another) Bee’s buzz!<br />
*[http://donaldshimoda.blogspot.com/ Parallel Pascal Worlds] Donald Shimoda.<br />
<br />
'''Websites'''<br />
*[[swainbrain pascal wiki]] - unique free pascal tutorials and info [http://mercury.it.swin.edu.au/swinbrain/index.php/Pascal#Pascal_Development_Tools swainbrain]<br />
*[http://aprendepascal.wikidot.com Programando en Pascal] - Spanish tutorial focused on FPC/Lazarus, hosted in Wikidot.<br />
*[[Contents|Pascal Tutorial]] ''Wiki version'' - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).<br />
*[[Pascal Tutorial]] - [http://www.taoyue.com/ Tao Yue's] [http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial] (reposted with permission).</div>Cjaster