Questions tagged [pascal]
Pascal is an imperative language from the Wirthian family created in 1969. It was widely used in engineering and teaching in the 1970s and 1980s. It lives on in compilers as Free Pascal and Delphi.
2,462
questions
-2
votes
1
answer
42
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 ...
0
votes
2
answers
21
views
How do I use a file with numbers on each line as an input (not a .txt file), do some calculations, then write the results into another file in pascal?
I am trying to make a program that will take a file called "root.inp" (file contains 3 integers) as its input, with each integer in a separate line, and then perform the operation shown in ...
0
votes
1
answer
29
views
Turbo Pascal 7.0 - Using operator OR with numbers
I know that OR is an operator for Boolean operands. But when I use it with numbers I get surprising and unexpected results instead of an error. For example:
program test;
uses crt;
begin
clrscr;
...
-1
votes
1
answer
112
views
Why does TThread not work in a DLL? But works in a VCL Form application [duplicate]
Why does this thread procedure not work in a DLL library using TIdTCPServer, but it works in a VCL Form application?
procedure TFormFpsSrv.Display(p_sender : String; p_message : string);
begin
...
0
votes
1
answer
29
views
disable android device keyboard appearing when selecting an edit box
I have a point of sales screen created for users to purchase products, And have created my own keyboard on the screen. However when I deploy to an android device the android keyboard pops up when I ...
0
votes
1
answer
40
views
Fatal: Cannot open file. Error: ppcx64.exe returned an error code. [SOLVED]
My code and VS Code's error message.
Why in VS Code I can't compile Pascal file but it working properly on FPC IDE or Sublime Text 4 with ObjectPascal package?
Can anyone have me, thank a lot!
My file ...
0
votes
2
answers
91
views
Get all dates within a date range
If I have a given date range (DateFrom and DateTo), how can I get all the dates within the date range?
0
votes
0
answers
33
views
Inno Setup script not install. Displays error: "Internal error: .Net Framework not found" [duplicate]
Can anyone shed light on this Inno Setup error that one of my users is getting?
He can install the same software on another computer with no issues. I asked him to supply me with his log file (the ...
0
votes
0
answers
30
views
How to set TGridLayout Height based off amount of items in grid
How does one set the height of A TGridLayout to be set based off the amount of items in the grid ? I have a grid with products in it which the user can purchase and need the grids height to be set ...
0
votes
0
answers
88
views
Delphi, linking database stored on onedrive
I would like to connect my ado connection to a database stored on onedrive so after the development of my application... It can be distributed to multiple users without them having a copy of the ...
0
votes
1
answer
29
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
49
views
how to select last row in TGrid on the click of a button
how does one select the last row in a TGrid when the user clicks on a button? I have a table which is filtered by date and I have a start date and end date button. When the user clicks them I need it ...
0
votes
1
answer
98
views
open ZWCAD application with pascal programming language
I have an application that opens the autocad app in the following way:
XlApp := GetActiveOleObject('AutoCAD.Application');
Now I want to do the same but with the ZWCAD app, how could I do it?
-2
votes
0
answers
20
views
what is External SIGSEGV? [duplicate]
I'm trying to code a connect 4, and i'm just begining, i'm just trying to place a x or o in a stringgrid when someone clicks on it and this error show up when i click on my stringgrid: "External ...
0
votes
1
answer
97
views
Delphi TSpeedButton losing glyph when disabled
I have a TSpeedButton that should have 2 main statuses, one for the pressed status (down) and one when it's up. What i want to achieve is to display an icon of the glyph bitmap also when the button is ...
-1
votes
1
answer
146
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(...
0
votes
0
answers
78
views
How to change ListView TTextObjectAppearance Font in Mobile, Delphi Sydney 10.4 FMX?
I want to change the default Font in Listview TTextObjectAppearance, when I run it on windows it works fine but when I run it mobile it does not show the Font I select.
.fmx
object Form1: TForm1
...
2
votes
1
answer
82
views
Display currency as different currency type ($10 -> R10)
how does one change the value of the type of currency? I am getting $ for my currency when i need R.
procedure TfrmFinal.addSubtractTotal;
var
total: currency;
begin
total := 0;
...
-1
votes
6
answers
96
views
How to initialize array in Pascal using type?
For the sake of fun, I'd like to refresh my Pascal knowledge, so gotta review the basics again.
Let's see this Java code:
class ArrayTest {
public static void main(String args[]){
int[] ...
0
votes
1
answer
73
views
Working with .NET classes in Delphi by using mscorlib
I would like to use .NET classes in Delphi. I included mscorlib unit (which is a TLB) and want to create an instance of e.g. Assembly class. So I have:
uses mscorlib;
var myAssembly: _Assembly;
...
0
votes
0
answers
35
views
Using function with switch-case structure inside that gets a record
Hi, I tried to compile this code and had a compilation error in 'calc' function which should return the output into 'resx' (x can be 1,2,3) according to each value.
this is the error I got:
...
2
votes
2
answers
147
views
How to parse multiples lines from StringList
I want to copy specific lines from a StringList,
I want to copy all lines that have 'Domain Status:' into memo.lines.text
I used the code below, but the problem is it copies only the first line, I ...
1
vote
1
answer
130
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?
0
votes
1
answer
118
views
How to print CODE128 barcode to POS Thermal printer properly using Delphi?
I am trying to print code128 barcode directly to POS printer using this code:
DirectToPrinter(chr(29)+chr(107)+chr(72)+Chr(123)+Chr(65)+'8600123456789', true);
According to the documentation here: ...
0
votes
1
answer
51
views
How to Prevent Inno Setup adding files multiple times when creating an installer and portable extractor
I like to create installer / portable extractors in one setup and sometimes i use .paf portables, i use a check inside the [Code] section so the installer knows where to place files depending if ...
0
votes
1
answer
39
views
How to fixed it? Pascal main.pas(21,6) Fatal : syntax error, ";" expected but "ELSE" found
Help me please 😊
program number_three;
uses crt;
var
i, j : integer;
begin
for i := 1 to 5 do
begin
if (i mod 2 = 0) then
begin
for j := 1 to 5 do
begin
...
0
votes
1
answer
131
views
Unsupported clipboard format when pasting PNG/JPG files
I'm coding a unit where I can paste an image from the clipboard and save it in a DB. The code actually works if I took screenshots or copy images from WhatsApp/Telegram Web.
But the problems appears ...
0
votes
1
answer
53
views
Comma Separated Type Declaration Fatal Error "=" expected but "," found Free Pascal
I am learning Pascal using Free Pascal and VS Code. A compilation error occurs from a simple type declaration. I have looked at tutorials and books and the syntax seems good. If I remove "days,&...
0
votes
0
answers
31
views
C-patex api says: Invalid signature
I am trying to create a crypto bot for the c-patex exchange on Pascalabc. I'm stuck on private requests using a key and a secret key. I get an error - {"error":{"code":2005,"...
0
votes
0
answers
80
views
Altium doesn't run script
I've written up some scripts for Altium (DelphiScript) and the other day everything worked fine, when I used the Step Into debugging tool the debugger would cycle through every line and everything.
...
0
votes
2
answers
155
views
How to get IP address in Pascal
i am getting these two Errors trying to view IP address and show in a messagebox
Error looks like this
[dcc32 Error] Unit1.pas(38): E2010 Incompatible types: 'PAnsiChar' and
'PWideChar' => Error1
...
0
votes
1
answer
95
views
Getting country using GetLocaleInfo Example
I am trying to get Country in Delphi using GetLocalInfo in Delphi.
I have this code
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, ...
1
vote
1
answer
76
views
How to detect when app is not reopen from background on iOS in Delphi Firemonkey mobile app?
I am developing a Delphi mobile app on both Android and iOS platforms where I want to carry out some action when the app is first launched, but not open from the background.
I have tried using if ...
0
votes
1
answer
199
views
I am getting this error in free pascal when compiling (Fatal: can't find unit crt used by ex2)
I have been working on pascal language as it is in my high school syllabus. I have been doing some coding to see how it works. so far (for more than a month) I didn't get any error's except for my own ...
0
votes
2
answers
126
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[...
-1
votes
1
answer
42
views
I need to work with round or trunc functions in FreePascal with very big numbers(such as INT64)
var a,c,i,y,k:cardinal;
z:real;
check:boolean;
repet:array[1..1000] of cardinal;
tripet:array[1..1000,1..2] of real;
begin
read(c);
i:=1;
for a:=1 to (c) do
begin
z:= sqrt(c*c-a*...
0
votes
0
answers
69
views
DBus scanning for BLE device failing
I'm learning about DBus and Bluez and trying to get them to scan for BLE devices on Linux Mint using Lazarus Pascal. If I don't set a filter then the scan runs but doesn't find my device, but setting ...
0
votes
0
answers
51
views
Is there shared address space between program in Java/C++ and Pascal library? (Fill string variable passed by pointer)
I have library written in Pascal which gets PAnsiChar as parameter, changes its value and returns error code. I need to use it in java code. I have C++ code which is middle man (enables calling ...
-1
votes
1
answer
30
views
figure out math formula for spaces in pascal diamond project
How is it going guys ?
I've written a program that "draws" diamond in the command line (it's a part of my homework). For spaces inside the diamond I was given a formula "1 + 2(k-2) or ...
-1
votes
1
answer
62
views
FPC: file not recognized: file format not recognized
I have something that need to link some C++ codes to main Pascal program. I followed this tutorial, now I have:
download.h
#include <iostream>
#include <curl/curl.h>
using namespace std;
/...
0
votes
0
answers
45
views
The MetropolisUIListBox on delphi is not showing the icon of the Metropolis
im using the metropolisUI from the list box but in these days i've update de delphi then is not showing more
The components of my project
The tests
the imports of icon
0
votes
1
answer
143
views
How to fix an External: ACCESS VIOLATION error in Pascal?
I'm getting an error in Pascal, and according to my research it's due to a declaration error (class or variable). It has to be something small, since it was working just fine. I would really ...
1
vote
1
answer
45
views
The '+' operation is not applicable to the types function(x: real): real and real. Check the operation of the program for a = 0.1; b = 1.0; h = 0.1;
Check the operation of the program for a = 0.1; b = 1.0; h = 0.1; select the value of parameter n depending on the task.
Why am I getting an error? What is the best way to solve this problem? How to ...
-1
votes
1
answer
150
views
Delete records using TFDQuery in Delphi
Help me to fix this problem to delete records with TFDQuery.
When this value of record is choosed by me with Edit.Text or DBEdit.Text, I try like this but it is not working:
FDQuery.SQL.Text := '...
1
vote
2
answers
100
views
Why does my camera ray have an offset when clicking near the edges of the viewport?
I'm working on a 3D project in OpenGL. Picking objects is my thing to worry about, but right now I can't get the main thing working. Which is casting a ray from my camera using the mouse. I've been ...
0
votes
1
answer
77
views
Delphi TBitMap transparency from ImageList to a button
I am trying to create a custom icon button with a transparent bitmap image, below the code.
The icon is stored in an ImageList connected to an ActionList.
bitmap := TBitmap.Create;
BmpObj := ...
1
vote
2
answers
105
views
Pascal - Assignment to Function Call
I am looking at the source code for CodeGear C++ Builder header files. In Source/vcl/forms.pas I find the following lines of code:
procedure TApplication.CreateForm(InstanceClass: TComponentClass; var ...
0
votes
0
answers
75
views
Cant set SetFileSecurity through SetEntriesInAclA. Got "System Error. Code: 1336. The access control list (ACL) structure is invalid."
I run through MSDN and make next code to set access rights to folder.
But i got an erorr.
Furthermore i can't understand why it crashes on SetFileSecurity instead of SetSecurityDescriptorDacl?
What am ...
0
votes
0
answers
55
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
0
answers
76
views
Maximum length of a row made up from given dominoes
Given a set of dominoes, find the maximum length of a row that can be made using some of those dominoes. It's allowed rotating dominoes.
Recall: A domino piece consists of 2 numbers from 0 to 6 (e.g. ...