Difference between revisions of "Portal:HowTo Demos"

From Free Pascal wiki
Jump to navigationJump to search
(New Portal for short demo programs from the Forums)
 
(New HowTo Portal)
Line 1: Line 1:
 
{{Portal_HowTo_Demos(pg)}}
 
{{Portal_HowTo_Demos(pg)}}
 
{{Index-Portal}}
 
{{Index-Portal}}
 +
__NOTOC__
  
 
{{Portal_Head2|00a0cb|<big>{{PAGENAME}}</big>|dfe2eb|000000}}
 
{{Portal_Head2|00a0cb|<big>{{PAGENAME}}</big>|dfe2eb|000000}}
Line 21: Line 22:
 
</div>
 
</div>
 
|}
 
|}
 +
 +
<div style="float:left; width:100%;”>
 +
 +
== Android ==
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,44811.msg315311.html#msg315311 OpenGL ES2 Circle]. Requirement: LAMW. Drawing a circle using jCanvasES2.DrawLine instead of DrawCircle.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,44708.msg314630.html#msg314630 OpenGL ES2 Rectangle]. Requirement: LAMW. Drawing a rectangle using jCanvasES2.DrawPolyFill instead of DrawRect.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,44241.msg310991.html#msg310991 Simple polygon animation]. Requirement: LAMW. A simple animation using jCanvas.
 +
 +
 +
== File handling ==
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43045.msg307111.html#msg307111 Binary file demo]. How to show, append and delete data from a binary file.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37766.msg254800.html#msg254800 Text file demo]. How to read and append data to a text file.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,39769.msg274036.html#msg274036 Text File Demo #2]. How to read and append data to a text file.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42293.msg295057.html#msg295057 Save component values to a file]. Save text data easily using TStringList.SaveToFile.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42144.msg293579.html#msg293579 Load and show image from Resource Stream]. How to add an image to a project resource and load it.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37442.msg251587.html#msg251587 Load a picture and show it]. How to use OpenPictureDialog and LoadFromFile.
 +
 +
 +
== General ==
 +
 +
* Drawing, moving, making connection between shapes. Shows TShape can be use for [https://forum.lazarus.freepascal.org/index.php/topic,41036.msg284131.html#msg284131 simple diagram drawing].
 +
 +
* Generating a huge text file. Demonstrates a technique for reducing program responsiveness to [https://forum.lazarus.freepascal.org/index.php/topic,43806.msg307101.html#msg307101 improve performance].
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,38844.msg265130.html#msg265130 Drag and drop shape]. Drag and drop without using the built-in drag and drop feature.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42124.msg293401.html#msg293401 Minimize to TaskBar or Tray]. A workaround to minimize to tray, not the best solution but works.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42106.msg293281.html#msg293281 TMyCircle Component]. How to write your own component, the OOP way.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,41089.msg284614.html#msg284614 Moving an Object by pressing a key]. How to detect left/right shift key pressing.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,39790.msg274096.html#msg274096 Pausing and Continuing an animation]. How to pause and continue the animation.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,36306.msg241818.html#msg241818 Control an Object's direction using the keyboard]. How to detect user keyboard input.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37887.msg256019.html#msg256019 Convert Unicode to TBytes]. How to use WideBytesOf and WideString functions.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43489.msg304434.html#msg304434 Communicate between two programs]. This demo showing how to use simpleipc.
 +
 +
 +
== Graphics ==
 +
 +
* Get pixel color of an image. It may sound easy but actually it is [https://forum.lazarus.freepascal.org/index.php/topic,37242.msg252828.html#msg252828 not so easy].
 +
 +
* A very simple single player [https://forum.lazarus.freepascal.org/index.php/topic,42439.msg297949.html#msg297949 Pong game].
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43999.msg309134.html#msg309134 Game Map Editor]. A very basic load and edit map for game.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43823.msg307918.html#msg307918 Fading images using BGRABitmap]. Requirement: BGRABitmap. Build your own slideshow and learn doing proportional scaling using aspect ratio of the picture.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43424.msg303879.html#msg303879 Center, resize image on the screen]. Resize an image at the center position of the image.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,41135.msg284936.html#msg284936 Simple animation]. A very basic animation using a TTimer.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,38136.msg263143.html#msg263143 Moving circles]. How to fix an unwanted flickering effect.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37251.msg249962.html#msg249962 Change background color of an image.] A not so accurate colorshift on an image.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,35850.msg238019.html#msg238019 OpenGL 2D Text Using Textures]. Requirement: LazOpenGLContext. How to write text in OpenGL using textures loaded from an image file.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,46775.msg333936.html#msg333936 TCanvas Text]. How to draw superscript and subscript text using TCanvas.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,38511.msg262706.html#msg262706 Sticky Balls]. Not so accurate inverse kinematics demo.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,41265.msg286208.html#msg286208 GradientFill Rectangle]. How to use GradientFill.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,41135.msg284928.html#msg284928 Rock, Paper, Scissors]. A simple game. Note for Unix/like operating systems: change the path delimiter to make the code work.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,45729.msg323878.html#msg323878 Bullet and asteroid collision detection]. How to do collision detection between a bullet and a polygonal object.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37425.msg259245.html#msg259245 Draw Circles Using CSMFL]. Requirement: SFML/CSFML headers binding and CSFML libraries. How to use CSFML in FPC.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37242.msg253349.html#msg253349 Get pixel color of an image]. How to load an image, show its information and the pixel color under the mouse pointer.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43376.msg303582.html#msg303582 Move a shape with a mouse]. Move rectangles using a mouse.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,43474.msg304454.html#msg304454 Selection Demo]. A movable and resizeable selection.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,36871.msg246309.html#msg246309 Sprite picking and moving]. Hit Testing - a must learn topic for every graphics programmer.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,38511.msg262692.html#msg262692 Dancing Balls]. Balls that connect to each other.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,33138.msg214178.html#msg214178 Screenshot capture]. How to screenshot capture and crop.
 +
 +
 +
== Networking ==
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,38866.msg266673.html#msg266673 Game Client and Server]. The basics for building a client and server program.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,47015.msg336047.html#msg336047 FTP Connect]. Requirement: Synapse (can be installed using OPM). How to connect to a FTP server.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,35980.msg239199.html#msg239199 HTML to Text]. Requirement: fasthtmlparser. Extract data from a web page.
 +
 +
 +
== User Interface ==
 +
 +
* Make your UI look interesting by adding some [https://forum.lazarus.freepascal.org/index.php/topic,37943.msg256549.html#msg256549 simple transition effects].
 +
 +
* Searchable StringGrid. Requirement: DBFLaz. Load data from a dbf, show it on a TStringGrid, search and highlight the cells. See [https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249361.html#msg249361 here] and [https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249208.html#msg249208 here].
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37369.msg250939.html#msg250939 Popup with ListBox]. A custom popup form with a list box.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,48291.msg348084.html#msg348084 Frameless popup]. An alternative to ShowMessage.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,45346.msg320626.html#msg320626 Drag a Button to a Panel]. How to do drag and drop.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,45080.msg317949.html#msg317949 Checkbox in a StringGrid]. TStringGrid can show a checkbox instead of text.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42610.msg297603.html#msg297603 Color Fade ProgressBar]. Requirement: BGRAControls. How to use TBGRAFlashProgressBar.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42107.msg293431.html#msg293431 Darken a Form]. Requirement: BGRAControls. How to darken a form.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42107.msg293295.html#msg293295Darkening a Form]. Requirement: BGRAControls. How to darken the Main Form when a modal window is shown.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42058.msg292943.html#msg292943 Open a Form beside the current Form]. Programmatically open and close a form beside the current form.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,39477.msg271075.html#msg271075 Scaling a Form]. How to scale a form by using TForm.ScaleBy. Unfortunately it does not work correctly on Linux.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37537.msg252573.html#msg252573 Vertical Menu]. How to make a vertical menu using TPanel and TScrollBox.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37397.msg251208.html#msg251208 Colorful Panels]. How to use TControl.Align.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,11656.msg251161.html#msg251161 Button with animation]. How to show a TBitButton with animation images.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37346.msg250750.html#msg250750 Small icon in a TEdit]. How to put an icon in a TEdit.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37286.msg250687.html#msg250687 StringGrid Cell Validation]. Automatically set focus on the cell if it contains incorrect input.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,47651.msg341708.html#msg341708 ListBox Work as Tabs For StringGrid]. How to add items to a ListBox and StringGrid at runtime.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37537.msg252612.html#msg252612 Vertical Menu]. A TVerticalMenu component.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,42610.msg297651.html#msg297651 Color Fade ProgressBar]. How to color fade a progress bar without using a third party component.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,37425.msg251457.html#msg251457 ShowMessage in Console Mode]. Requirement: LCL needed to be in the project’s required packages. How to use ShowMessage in a console mode program.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,48241.msg347340.html#msg347340 Save & Restore StringGrid]. How to save/load a grid’s content.
 +
 +
* [https://forum.lazarus.freepascal.org/index.php/topic,45816.msg324502.html#msg324502 StringGrid With Autosum Column]. How to create a column that can auto calculate the row sum.
 +
</div>

Revision as of 02:37, 8 March 2020

English (en)

< Lookup < Portals < Portal:HowTo Demos


Portal:HowTo Demos

This portal collects together in one place a significant number of short demonstration programs that have been posted on the Free Pascal and Lazarus Forums. Each of the demonstration programs generally provides a simple example of one particular development technique.

The Portal was the brainchild of Handoko who also provided the initial list of demonstration programs from the Forums.

Android

  • OpenGL ES2 Circle. Requirement: LAMW. Drawing a circle using jCanvasES2.DrawLine instead of DrawCircle.
  • OpenGL ES2 Rectangle. Requirement: LAMW. Drawing a rectangle using jCanvasES2.DrawPolyFill instead of DrawRect.


File handling


General

  • Generating a huge text file. Demonstrates a technique for reducing program responsiveness to improve performance.


Graphics

  • Get pixel color of an image. It may sound easy but actually it is not so easy.
  • Fading images using BGRABitmap. Requirement: BGRABitmap. Build your own slideshow and learn doing proportional scaling using aspect ratio of the picture.
  • TCanvas Text. How to draw superscript and subscript text using TCanvas.
  • Rock, Paper, Scissors. A simple game. Note for Unix/like operating systems: change the path delimiter to make the code work.


Networking

  • FTP Connect. Requirement: Synapse (can be installed using OPM). How to connect to a FTP server.
  • HTML to Text. Requirement: fasthtmlparser. Extract data from a web page.


User Interface

  • Searchable StringGrid. Requirement: DBFLaz. Load data from a dbf, show it on a TStringGrid, search and highlight the cells. See here and here.
  • a Form. Requirement: BGRAControls. How to darken the Main Form when a modal window is shown.
  • Scaling a Form. How to scale a form by using TForm.ScaleBy. Unfortunately it does not work correctly on Linux.
  • Vertical Menu. How to make a vertical menu using TPanel and TScrollBox.
  • ShowMessage in Console Mode. Requirement: LCL needed to be in the project’s required packages. How to use ShowMessage in a console mode program.