Questions tagged [lazarus]
Lazarus is an open-source multiplatform RAD environment for the Free Pascal compiler, in the spirit of Delphi, with which it has a fairly high degree of compatibility.
1,276
questions
0
votes
0
answers
8
views
Insert several records ZeosLib lazarus
I am trying to make an insert to save several data to the same fields, the data types are the same, when compiling it does not give me any error, but when I press on the save button I get an error: &...
0
votes
0
answers
7
views
Lazarus fphttpserver use ssl
I want to enable https for fphttpserver. I turned the use ssl to true. Then I got this from my web browser:ERR_SSL_SERVER_CERT_BAD_FORMAT.
I want to know how to set it up.
I have a key file and a pem ...
2
votes
1
answer
115
views
Assigning a procedure to dynamically created object
I want to dynamically create TImage controls and then drag and drop them. But if I want to assign the procedure used for the dragging to an event of this Image, it gives me:
Error: Wrong number of ...
0
votes
2
answers
104
views
Lazarus Error: Anonymous Class definitions are not allowed
I have to develop a game in Lazarus for school, and I ran into an error that I can't find a solution for.
I have a dynamic array where I want to store classes in so that I can call procedures on those ...
-2
votes
1
answer
86
views
Delphi sorting with 2 while loops, need to get rid of a variable
Good morning, couldn't recover my old account so here's the new one. I'm following lessons for Lazarus/Delphi development and one assignement is about sorting an array of integers using 2 nested loops ...
1
vote
1
answer
61
views
Input and output pipe in Lazarus TProcess
I would like to make a terminal with a Lazarus GUI application. But I'm in trouble. And I hope someone can help me, please.
Question1: The Chinese and other special chars cannot display normally, I ...
-2
votes
1
answer
58
views
How to use arccos in Lazarus (pascal)
I have to write a program to find out the angles of a triangle. For some reason I always get the message 'INVALID OPERATION' which results in the program crashing. Can someone help me?
function ...
2
votes
1
answer
69
views
How do I use SDL_PeepEvents properly in multiple event loops?
I would like to do a simple thing — in the unit with the logic of handling the window, I want to update the window (the first event loop), and then in another unit with the logic of e.g. keyboard ...
0
votes
1
answer
43
views
Forward type not resolved - Lazarus FreePascal
I am trying to use an external library from Pascal that I have successfully used from C before. In order to use this library I have been provided a .h file, a .dll file and a .lib file.
I converted ...
0
votes
1
answer
132
views
How insert or connect two procedures?
Hi I have a menu in which I have a print part for the memo and now I don't know how to when I click that part to run this print code I found.
How to link or possibly insert this part of the
...
-4
votes
1
answer
167
views
Notepad clone , Save and Save As options
I'm making a Notepad clone. I've implemented 70% of the options, but there are options that I don't know how to do, and I can't figure out how. Like Save and Save As options.
When I open some text ...
0
votes
0
answers
64
views
Lazarus apps launched from RDP are not visible in TaskBar
This is mainly a Lazarus issue but it also applies to Remote Desktop on a Windows server.
We have a app called "Menu", it has buttons that launch other applications, some of them being ...
0
votes
0
answers
20
views
Windows spinning wheel freezes progress bar
In a Lazarus application I use a progress bar that shows data export from a database.
procedure TFOpere.bEsportaVocabolarioClick(Sender: TObject);
var
separa: String;
titolo: String;
begin
...
-1
votes
1
answer
175
views
If-else usage in Lazarus [duplicate]
I'm new to Lazarus and today I faced an issue with if-else usage. Everything is ok while there is only an if statement but when I'm trying to write an if-else statement this error shows up:
unit1.pas(...
1
vote
1
answer
91
views
Display image using Windows API
I am using a looping primitive code to output a test image:
procedure TForm1.Button1Click(Sender: TObject);
var
LP1, LP2: TLogPen;
hp1, hp2: THandle;
hdcv: Handle;
i: integer;
begin
LP1....
0
votes
1
answer
159
views
Retrieve values from database to StringGrid
In connection with my previous question
I've successfully save string values in StringGrid to my database in one column.
Now I want to retrieved the values from database and put it back from ...
0
votes
0
answers
33
views
JSON Web Signature (JOSE.JWS) under Lazarus / FreePascal
Is there a way to sign a JSON UTF8String with JOSE.JWS before sending via https to a (government) server using Lazarus / FPC ?
The specification is heavy and writing everything from scratch seems to ...
0
votes
0
answers
95
views
POST/get JSON using Ararat Synapse with special PEM key (Lazarus/FPC)
We are forced to send (and receive back) JSON data to the government from our restaurant program
using a special RSA Key (PEM stream) they provide
using TLS 1.3 (OpenSSL 3.0+) < This works! :-)
...
0
votes
1
answer
108
views
How to save StringGrid content in MySql database in one column?
This code gets the StringGrid contents per row with '|' as a separator.
procedure TForm1.datas();
var
iRow: integer;
RowData : string;
begin
{get stringgrid content}
for iRow := 1 to Form7....
1
vote
1
answer
140
views
Is there an auto keyword in Delphi?
I'm learning Delphi myself.. I have seen the auto variable type that can do some degree of magic in C++. Is there an auto a variable type, or something similar to this, in Delphi?
1
vote
1
answer
166
views
Create TPanel which looks like TMainMenu?
I want to create a component which looks similar to TMainMenu but is based on TPanel.
TMainMenu under Windows 7 has a gradient of colors.
How can I achieve similar effect for TPanel? Not any gradient ...
0
votes
1
answer
200
views
Class that worked in Delphi fails to run in Lazarus
The below class implementation works fine in Delphi, however it fails when running in Lazarus.
The purpose is to run a timer asynchronously.
// Declaration
type
TTimerEvents = class
private
...
0
votes
2
answers
129
views
convert a long string into a Tstringlist
hello guys I have the following string A type string.
A = 'flagA=0,flagB=0,flagC=1'
B:Tstringlist.
I want to convert it into Tstringlist in order to see if the flagC is set to 1 by inspecting B.Values[...
0
votes
1
answer
82
views
TValueListEditor - how to validate input?
I have a TValueListEditor and want to validate input. For example replace all spaces to underscores.
How to do that? I thought OnSetEditText might be good but I can't change Value there.
0
votes
0
answers
83
views
Client-Library sfound but could not be loaded. Check compile-target and library compatibility! - happens when want to connect to the database Lazarus
i just installed zeos on lazarus on linux mint device, and created database in phpmyadmin.
when I enable Zquery to true, an error like this occurs
enter image description here
does anyone know why ...
0
votes
1
answer
51
views
I have a problem with porting VBA code to Lazarus
Sub ListaDokumentow()
On Error GoTo ErrHandler
Dim oSubGT As InsERT.Subiekt
Dim oListaDok As InsERT.SuDokumentyLista
Dim oDok As InsERT.SuDokument
Dim sNapis As String
...
0
votes
1
answer
117
views
Lazarus 2.2.0 cannot create file on disk?
The code below shows: "Unable to create file "test.txt". Access is denied."
var F: TFileStream;
begin
F := TFileStream.Create('test.txt', fmCreate);
F.free;
end;
Am I doing ...
0
votes
1
answer
58
views
How can I register custom data type in PascalScript?
I can register custom function like this:
procedure TForm1.PSScript1ExecImport(Sender: TObject; se: TPSExec;
x: TPSRuntimeClassImporter);
begin
se.RegisterDelphiFunction(@MWrites, 'Writes', ...
0
votes
1
answer
143
views
How to create a form with a button in Pascal Script?
I started using PascalScript and I can't find a way to create a form with a button from PascalScript.
I can do this from Lazarus (version 2.2.0):
procedure TForm1.PSScript1Compile(Sender: TPSScript);
...
-1
votes
1
answer
96
views
turning off RoundTo uses the Banker's rounding
It seems that when using the function RoundTo (math unit) it uses the Banker's rounding, for example my column.point = 76.5 returns 76 instead of 77. I use Lazarus 1.8.2 FPC 3.0.4
result:= Double(...
-2
votes
2
answers
89
views
Lazarus compiler stops everytime a procedure or a constructor of a class is called
I've created a "Border" class in delphi. When i call the constructor of the class "Create" the compiler stops and shows me the constructor with a green arrow. After this i can ...
0
votes
1
answer
31
views
How to create and return PNG with fpWeb?
I want to create PNG image on the fly and return it using HTTP-server from fpWeb package.
procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest;
AResponse: TResponse; var ...
-3
votes
1
answer
92
views
Function to retrieve CPUID does not compile in LAZARUS
I'm trying to port some code from old Delphi7 to Lazarus but following code just won't compile. Lazarus always complains about unknown identifiers.
function GetCPUID(Leaf, Subleaf: Integer): TCPUID;
...
0
votes
1
answer
49
views
Synchronize not updating UI elements in a child form
I created a thread class in Form1 Unit1.pas. Then in that thread class I also declare a method to update a shape color in that same Unit1.pas's Form1 class. This works fine.
But when I try to do the ...
-1
votes
1
answer
78
views
(EAccessViolation) : Access violation while FreeAndNilChild from Owner (LINUX) LAZARUS PASCAL
Im having an acces violation only when hosting a linux server. Windows does not show any issues. This happens when i try to FreeandNilChild Object if OWner , see code. The errors are attached as ...
0
votes
0
answers
63
views
Decorator Pattern in Pascal/Lazarus
I am trying to implement the Decorator Pattern in a very simple example.
In this way, which should be the right one as far as "Decorator Interface" implements "Shape Interface" it ...
0
votes
1
answer
90
views
Indy 10 - add cookies manually
I can export my cookies using "EditThisCookie" for Google Chrome.
The export looks like this:
"domain": ".stackoverflow.com",
"expirationDate": 1698322697,
&...
0
votes
1
answer
152
views
Do an IF by DBGrid Column Title
I want to create a different Popup for each column. Since the columns order can be changed I need to identify that by the column title but I have not found a solution.
These are two method I have ...
0
votes
1
answer
64
views
Building program for other machines
I created a simple program using Lazarus Ide Qt5. I'm using Kubuntu 20 right now. When I build and run it on another Linux distribuiton I get error:
Quote
./shortcutcreator: error while loading ...
0
votes
1
answer
49
views
In Lazarus, how to defocus TCustomControl descendents (cross-platform)?
I am using Lazarus 2.3.0, FPC 3.3.1
A control will get focus when you put it on a form, by default. Lets say you have a TMemo (implemented via Widgetset) on a TForm. When the form is active, the memo ...
0
votes
1
answer
179
views
Convert string in hash sha256
I want to convert a string in a sha256 hash using DCPCrypt.
Form contains an edit to enter the string, a button to convert it and another edit to show the output sha256 hash.
I have wrote this code:
...
0
votes
1
answer
107
views
When connecting to Oracle DB I get External: SIGSEGV error
I'll say how I reproduce the problem on lazarus.
I have a form and a datamodule using zeos to enstablish a connection with a local oracle db.
The problem born when I put some code to interlocute with ...
0
votes
0
answers
92
views
Extend the hierarchy of a class present in an external library
Let's say you have an external library that you can't modify, like this one (it's a demo code):
unit Unit1;
interface
type
TPasElement=class
ElementInfo : string;
end;
TPasConst=class(...
0
votes
0
answers
53
views
How can I prevent that a LCL defined focused empty ListBox implementing some kind of search field
I'm working with
FreePascal 3.2.0,
Lazarus 2.0.12,
GTK2 GUI backend
under Ubuntu Linux 18.04.
I have a strange behavior of a TListBox component.
When I focus a empty ListBox by clicking (SetFocus) ...
0
votes
0
answers
59
views
where to find documentation about order of sections
Consider this code:
unit uglobals;
{$mode objfpc}{$H+}
interface
const
BORD_WIDTH = 8;
uses
Classes, SysUtils;
implementation
end.
Compilator show me error:
uglobals.pas(8,1) Fatal: ...
1
vote
1
answer
133
views
In Lazarus how do I find the "real" font values used on Form1?
Inside Lazarus the default font values for Form1 are:
Form1.Font.Name=default
Form1.Font.Size=0
How do I find what the actual "real" font name and font size is for these default values?
0
votes
0
answers
125
views
How to handle Synaser timeout error 9997 in Lazarus
Using synaser for serial communication in Lazarus on Linux. I am reading string(s) from serial port, terminated by a CR/LF in Linux console. Everything works, but if for some reason terminator is ...
1
vote
1
answer
250
views
Showing Standard Out in Lazarus IDE when running program?
I am just trying out Lazarus IDE out of curiosity, with the simplest Pascal program possible:
program project1;
begin
WriteLn('Hi there');
end.
When I run it with F9 in the IDE, I thought I would ...
1
vote
1
answer
148
views
Getting runtime error when include cthreads lib in Lazarus/free pascal
I'm trying to code a multithread application in Lazarus/free pascal, but I've noticed that when I include the "cthreads" lib (always the first line of my project.lpr file), on some Linux ...