lazarus

How to encode file of any type into base64 string and then decode it into file again using Lazarus/Delphi?

℡╲_俬逩灬. 提交于 2019-12-29 08:19:11
问题 Can you tell me how can I do that? Is there any Freepascal unit that can do this for me? I need that so my program can store binary data in it's XML-based fileformat. 回答1: Use the base64 unit and its two classes, TBase64EncodingStream and TBase64DecodingStream . Here is a simple example: program demo; uses Classes, base64; var DecodedStream: TStringStream; EncodedStream: TStringStream; Encoder: TBase64EncodingStream; Output: string; begin DecodedStream := TStringStream.Create('Hello World!');

OnClick event handler for control in custom component not working (Lazarus)

一个人想着一个人 提交于 2019-12-25 12:12:24
问题 Using: Lazarus 1.2.0; Windows 32-bit application I have written a custom component derived from TPanel and it conains 4 TEdit controls. I've written the OnClick event handler code for the TEdits. However its not working at runtime ie the events are not firing. I'm not sure what I missed. Please can you tell me what I'm doing wrong? Component code follows: unit uEditPanel; {$mode objfpc}{$H+} interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;

improving ms sql insert performance with lazarus

微笑、不失礼 提交于 2019-12-25 03:30:27
问题 i have a simple insert statement with 3 datafields. A Tag_ID which is not the primary key and not auto increment, a timestamp which saves an easy DateTime Now as a string and a float value which contains a simple devide calculation. the sql server is actually local but later it will be on another machine not in the local network. Now i get 25,8 sec for 10.000 entries.. how can i improve this? my code looks like this: procedure TForm1.testMssql(Datensaetze: integer); var i: integer; before

Use Controls Of Another Form

你说的曾经没有我的故事 提交于 2019-12-24 19:20:15
问题 I have a project on Lazarus that have two Forms, FormMain and OutputForm . I want to show a output on OutputMemo at the second Form with this code: procedure FormMain.ShowButton(Object: Sender); begin if SaveDialog1.Execute then AProcess := TProcess.Create(nil); AProcess.CommandLine := 'gcc.exe ' + SaveDialog1.FileName + ' -o ' TextField23.Text; AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes]; AProcess.Execute; OutputForm.OutputMemo.Lines.BeginUpdate; //OutputForm.OutputMemo

FreePascal: how do I change the colour of a TPaint object on Mouseover

寵の児 提交于 2019-12-24 10:49:35
问题 My Custom menu is coming along nicely and can detect when the mouse is within the boundaries of the link rectangles and respond to mouseup events. What I would now like for it to do is change the colours of the link rectangles when the user hovers the mouse within their boundaries. I've set colour properties this way before but manually and not dynamically. Basically, nothing happens. Debugging shows that the mouse position routine is working perfectly but the rectangles stay the same colour.

How do I get OmniPascal to integrate with LLDB on the macOS 10.12.6

女生的网名这么多〃 提交于 2019-12-24 08:26:17
问题 VSCode v1.14.2 macOS 10.12.6 Sierra lldb -version: lldb-370.0.42 Lazarus 1.8.0 RC3 FPC 3.0.2 Hi Wosi (or anyone that can help!), As you may know debugging Lazarus/Free Pascal on macOS Sierra is problematic because of issues with GDB. This forces us to debug our apps in LLDB using Xcode as the environment (see here: https://macpgmr.github.io/ObjP/ProjectXC.html). This works reasonably well but I would prefer to use OmniPascal/VSCode. I have investigated the VSCode extensions "LLDB Debugger" v0

How To Toggle The cell Colour And Text In A TStringGrid On And Off

橙三吉。 提交于 2019-12-23 18:26:01
问题 I am running Lazarus v0.9.30 (32 bit compiler). I have a TForm with a standard TStringGrid on it. The grid has the following properties set. RowCount = 5, ColumnCount = 5, FixedCols = 0, FixedRows = 0. I Googled some code that showed me how to change the cell colour and add some text to the cell when a user clicks on a TStringGrid cell. All works fine and I have extended it slightly to toggle the color/text on and off on the GridClick event. The questions I have are more to better understand

How can I compile a Lazarus Apache module to Apache 1.3, 2.0 and 2.2 selectively?

别来无恙 提交于 2019-12-23 01:47:07
问题 I've had a look at /etc/fpc.cfg and there is mention to some defines: FPCAPACHE_1_3 FPCAPACHE_2_0 Then in the fcl-web examples there is mention to: Apache1_3 The only one I've found is on the apr.pas on both these files: /usr/share/fpcsrc/2.4.0/packages/httpd20/src/apr/apr.pas /usr/share/fpcsrc/2.4.0/packages/httpd22/src/apr/apr.pas So how does the compiler decide what version of APR to compile? 回答1: If you enable the right one of those conditionals/directives afaik, the rest of the fpc.cfg

Why am I losing transparency when calling BitBlt or CopyRect?

空扰寡人 提交于 2019-12-22 06:08:43
问题 Problem I am trying to copy 32x32 tiles from a TBitmap into a TPaintbox which is my map editor, but I cannot seem to get the transparency working correctly. See the image below: Note: For the purpose of the demo and testing, I have placed a TImage underneath the TPaintbox which would help see if the transparency is working or not. As you can see, regular tiles draw correctly, but the tiles that should be transparent are drawn with a white background. I am now using proper classes to manage my

How to Format a DBGrid Column to Display Two Decimal Places? [duplicate]

蹲街弑〆低调 提交于 2019-12-22 05:02:00
问题 This question already has answers here : Setting a DBGrid column format in Delphi (3 answers) Closed 4 years ago . I would like to format specific cells to force two decimal places. The data is coming from an ElevateDB stored procedure and hooked into a TDataSource. EDIT: SQL Programming Note: I wasn't sure if this was just an ElevateDB issue or not. Before knowing about the Fields Editor , I attempted to format the data at the SQL level by using a CAST (NumericField as varchar(10)) statement