Difference between revisions of "Portal:HowTo Demos"
From Lazarus wiki
Jump to navigationJump to search (→Graphics: Added bitmap.scanline graphics example) |
(→Networking: Relocate item from General) |
||
(20 intermediate revisions by the same user not shown) | |||
Line 71: | Line 71: | ||
* [https://forum.lazarus.freepascal.org/index.php/topic,43489.msg304434.html#msg304434 Communicate between two programs]. This demo showing how to use simpleipc. | * [https://forum.lazarus.freepascal.org/index.php/topic,43489.msg304434.html#msg304434 Communicate between two programs]. This demo showing how to use simpleipc. | ||
− | * [https://forum.lazarus.freepascal.org/index.php/topic, | + | * [https://forum.lazarus.freepascal.org/index.php/topic,52780.msg389815.html#msg389815 Timer demo] - How to use a TTimer control. |
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,58207.msg433568.html#msg433568 Delete tags] - How to delete HTML tags from text. | ||
== Graphics == | == Graphics == | ||
Line 122: | Line 124: | ||
* How to use [https://forum.lazarus.freepascal.org/index.php/topic,49855.0.html bitmap.scanline]. | * How to use [https://forum.lazarus.freepascal.org/index.php/topic,49855.0.html bitmap.scanline]. | ||
+ | |||
+ | * How to do [https://forum.lazarus.freepascal.org/index.php/topic,42306.msg366256.html#msg366256 offscreen rendering in Metal framework] (macOS only). | ||
+ | |||
+ | * How to [https://forum.lazarus.freepascal.org/index.php/topic,52886.msg390735.html#msg390735 load a TImagelist at run time] Multiplatform. | ||
== Networking == | == Networking == | ||
Line 134: | Line 140: | ||
* [https://forum.lazarus.freepascal.org/index.php/topic,48423.msg348738.html#msg348738 Retrieve https web page]. Cross-platform. No openssl DLLs/libraries need to be deployed. No third party components required. | * [https://forum.lazarus.freepascal.org/index.php/topic,48423.msg348738.html#msg348738 Retrieve https web page]. Cross-platform. No openssl DLLs/libraries need to be deployed. No third party components required. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,51189.msg375491.html#msg375491 Simple webserver]. Multi-threaded, cross-platform. No third party components required. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,52773.msg389901.html#msg389901 File download] - How to resume a file download. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,55510.msg413068.html#msg413068 Obtain Redirected URL] - How to obtain the redirected URL using TFPHTTPClient. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,44795.msg315238.html#msg315238 Upload file] - How to send a file to a web server using TFPHTTPClient. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,56335.0.html CAPTCHA implementation] - How to implement a CAPTCHA. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,48423.msg348738.html#msg348738 Retrieve https web page]. Cross-platform. No openssl DLLs/libraries need to be deployed. No third party components required. | ||
+ | |||
+ | == Retrieving system information == | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,58852.msg438604.html#msg438604 System Information] - Cross-platform unit to retrieve system information (CPU, memory, swap, operating system version etc). | ||
== User Interface == | == User Interface == | ||
Line 148: | Line 170: | ||
* [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,45080.msg317949.html#msg317949 Checkbox in a StringGrid]. TStringGrid can show a checkbox instead of text. | ||
− | |||
− | |||
* [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.msg293431.html#msg293431 Darken a Form]. Requirement: BGRAControls. How to darken a form. | ||
− | * [https://forum.lazarus.freepascal.org/index.php/topic,42107.msg293295.html# | + | * [https://forum.lazarus.freepascal.org/index.php/topic,42107.msg293295.html#msg293295 Darkening 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,42058.msg292943.html#msg292943 Open a Form beside the current Form]. Programmatically open and close a form beside the current form. | ||
Line 172: | Line 192: | ||
* [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,37537.msg252612.html#msg252612 Vertical Menu]. A TVerticalMenu component. | ||
+ | |||
+ | * [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,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,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,44860.0.html Task bar icon progress bar] - Windows only. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,56367.msg418862.html#msg418862 Progress in Status Bar] - Cross-platform. | ||
* [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,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. | ||
Line 187: | Line 213: | ||
* [http://forum.lazarus.freepascal.org/index.php/topic,38487.msg261731.html#msg261731 Adding CHM Help]. A demo project to call a CHM help file from three buttons as context-sensitive help (press F1), or from a help menu. | * [http://forum.lazarus.freepascal.org/index.php/topic,38487.msg261731.html#msg261731 Adding CHM Help]. A demo project to call a CHM help file from three buttons as context-sensitive help (press F1), or from a help menu. | ||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,44828.msg315571.html#msg315571 GUI program that allocates a console] whenever it needs one and frees it when it no longer needs it (Windows only). | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,38487.msg261731.html#msg261731 CHM Help Demo] for an application. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,51116.msg374890.html#msg374890 Speedbutton demonstration] of using four arrow speedbuttons for moving an object. Shows how to handle speedbutton glyph states. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,52725.msg389274.html#msg389274 Runtime forms] How to create a form at runtime. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,49251.msg356477.html#msg356477 TAchart example] displaying the time on the X axis. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,16362.msg88566.html#msg88566 How to hide application window] on startup. | ||
+ | |||
+ | * [https://forum.lazarus.freepascal.org/index.php/topic,16436.msg255366.html#msg255366 How to use a Global HotKey] to show a form (Windows only). | ||
+ | |||
+ | * How to [https://forum.lazarus.freepascal.org/index.php/topic,52773.msg389901.html#msg389901 resume a download]. | ||
<br/> | <br/> | ||
</div> | </div> |
Latest revision as of 11:07, 27 March 2022
│
English (en) │
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. |
Related topics
Platform Portals: Android - Embedded - FreeBSD - iOS - Linux - Mac - WinCE - Windows Topic Portals: New Users - Database Development - Game Development - Hardware and Robotics - HowTo Demos - Science and Technology - Web Development
|
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.
- Simple polygon animation. Requirement: LAMW. A simple animation using jCanvas.
File handling
- Binary file demo. How to show, append and delete data from a binary file.
- Text file demo. How to read and append data to a text file.
- Text File Demo #2. How to read and append data to a text file.
- Save component values to a file. Save text data easily using TStringList.SaveToFile.
- Load and show image from Resource Stream. How to add an image to a project resource and load it.
- Load a picture and show it. How to use OpenPictureDialog and LoadFromFile.
- Detect kind of file using DragAndDrop. How to detect the type of file using drag and drop.
General
- Drawing, moving, making connection between shapes. Shows TShape can be used for simple diagram drawing.
- Generating a huge text file. Demonstrates a technique for reducing program responsiveness to improve performance.
- Drag and drop shape. Drag and drop without using the built-in drag and drop feature.
- Minimize to TaskBar or Tray. A workaround to minimize to tray, not the best solution but works.
- TMyCircle Component. How to write your own component, the OOP way.
- Moving an Object by pressing a key. How to detect left/right shift key pressing.
- Pausing and Continuing an animation. How to pause and continue the animation.
- Control an Object's direction using the keyboard. How to detect user keyboard input.
- Convert Unicode to TBytes. How to use WideBytesOf and WideString functions.
- Communicate between two programs. This demo showing how to use simpleipc.
- Timer demo - How to use a TTimer control.
- Delete tags - How to delete HTML tags from text.
Graphics
- Get pixel color of an image. It may sound easy but actually it is not so easy.
- A very simple single player Pong game.
- Game Map Editor. A very basic load and edit map for game.
- Fading images using BGRABitmap. Requirement: BGRABitmap. Build your own slideshow and learn doing proportional scaling using aspect ratio of the picture.
- Center, resize image on the screen. Resize an image at the center position of the image.
- Simple animation. A very basic animation using a TTimer.
- Moving circles. How to fix an unwanted flickering effect.
- Change background color of an image. A not so accurate colorshift on an image.
- OpenGL 2D Text Using Textures. Requirement: LazOpenGLContext. How to write text in OpenGL using textures loaded from an image file.
- TCanvas Text. How to draw superscript and subscript text using TCanvas.
- Sticky Balls. Not so accurate inverse kinematics demo.
- GradientFill Rectangle. How to use GradientFill.
- Rock, Paper, Scissors. A simple game. Note for Unix/like operating systems: change the path delimiter to make the code work.
- Bullet and asteroid collision detection. How to do collision detection between a bullet and a polygonal object.
- Draw Circles Using CSMFL. Requirement: SFML/CSFML headers binding and CSFML libraries. How to use CSFML in FPC.
- Get pixel color of an image. How to load an image, show its information and the pixel color under the mouse pointer.
- Move a shape with a mouse. Move rectangles using a mouse.
- Selection Demo. A movable and resizeable selection.
- Sprite picking and moving. Hit Testing - a must learn topic for every graphics programmer.
- Dancing Balls. Balls that connect to each other.
- Screenshot capture. How to screenshot capture and crop.
- Remove image shadow. How to remove an image shadow and crop the image.
- Display image in console program. How to display an image in a console program (Windows API method).
- How to use bitmap.scanline.
- How to do offscreen rendering in Metal framework (macOS only).
- How to load a TImagelist at run time Multiplatform.
Networking
- Game Client and Server. The basics for building a client and server program.
- 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.
- Synapse TCP/IP client and server. Requirement: Synapse.
- Retrieve https web page. Cross-platform. No openssl DLLs/libraries need to be deployed. No third party components required.
- Simple webserver. Multi-threaded, cross-platform. No third party components required.
- File download - How to resume a file download.
- Obtain Redirected URL - How to obtain the redirected URL using TFPHTTPClient.
- Upload file - How to send a file to a web server using TFPHTTPClient.
- CAPTCHA implementation - How to implement a CAPTCHA.
- Retrieve https web page. Cross-platform. No openssl DLLs/libraries need to be deployed. No third party components required.
Retrieving system information
- System Information - Cross-platform unit to retrieve system information (CPU, memory, swap, operating system version etc).
User Interface
- Make your UI look interesting by adding some simple transition effects.
- Searchable StringGrid. Requirement: DBFLaz. Load data from a dbf, show it on a TStringGrid, search and highlight the cells. See here and here.
- Popup with ListBox. A custom popup form with a list box.
- Frameless popup. An alternative to ShowMessage.
- Drag a Button to a Panel. How to do drag and drop.
- Checkbox in a StringGrid. TStringGrid can show a checkbox instead of text.
- Darken a Form. Requirement: BGRAControls. How to darken a form.
- Darkening a Form. Requirement: BGRAControls. How to darken the Main Form when a modal window is shown.
- Open a Form beside the current Form. Programmatically open and close a form beside the current form.
- 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.
- Colorful Panels. How to use TControl.Align.
- Button with animation. How to show a TBitButton with animation images.
- Small icon in a TEdit. How to put an icon in a TEdit.
- StringGrid Cell Validation. Automatically set focus on the cell if it contains incorrect input.
- ListBox Work as Tabs For StringGrid. How to add items to a ListBox and StringGrid at runtime.
- Vertical Menu. A TVerticalMenu component.
- Color Fade ProgressBar. Requirement: BGRAControls. How to use TBGRAFlashProgressBar.
- Color Fade ProgressBar. How to color fade a progress bar without using a third party component.
- Task bar icon progress bar - Windows only.
- Progress in Status Bar - Cross-platform.
- ShowMessage in Console Mode. Requirement: LCL needed to be in the project’s required packages. How to use ShowMessage in a console mode program.
- Save & Restore StringGrid. How to save/load a grid’s content.
- StringGrid With Autosum Column. How to create a column that can auto calculate the row sum.
- Activate button with keypress. How to activate a button with a keypress.
- Detect user's language. How to detect the user's language (multi-platform method).
- Adding CHM Help. A demo project to call a CHM help file from three buttons as context-sensitive help (press F1), or from a help menu.
- GUI program that allocates a console whenever it needs one and frees it when it no longer needs it (Windows only).
- CHM Help Demo for an application.
- Speedbutton demonstration of using four arrow speedbuttons for moving an object. Shows how to handle speedbutton glyph states.
- Runtime forms How to create a form at runtime.
- TAchart example displaying the time on the X axis.
- How to hide application window on startup.
- How to use a Global HotKey to show a form (Windows only).
- How to resume a download.