Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Access violation trying to create a timer
« Last post by Wilko500 on Today at 07:37:29 pm »
Thank you @dseligo.  That's a duh-rr moment! And of course it's obvious when I look at it now.  Because the incorrect code, that I copied,  was working I was looking for a more complicated solution rather than the obvious. And it turns out that I can run the StartTimers procedure from form.Activate as I wanted to.
2
Third party / Re: InstallAware 2025 Sources Published
« Last post by 440bx on Today at 07:16:41 pm »
everything coded 100% in Lazarus, ...
Coded in Lazarus ?... did Lazarus become a programming language ?... might it be that's it's developed with Lazarus and coded in FP ?

In any event... nice product.

3
Hello! A newbie here.
This is a simplified example of a class taken from a book from 2013.
'TPerson' class has two private variables 'FAwards' of array type and 'FName' of 'ansistring' type (because of '{$H+}'). Both types are considered dynamic and managed on the heap.
Now, in the original code of the class the implementation of the destructor was without 'SetLength(FName,0);'.
To my understanding, both  'FAwards' and 'FName' are dynamic and managed on the heap and both should be released upon destruction. According to 'SetLength' documentation, "If Zero is specified, the array is cleared and removed from memory."
Should both types be set to zero to properly destruct the instance of the class or 'ansistring' types could be skipped?

Code: Pascal  [Select][+][-]
  1. program person_class;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. type
  6.   TPerson = class
  7.     FAwards: array of string;
  8.     FName: string;
  9.  
  10.     constructor create(aName: string);
  11.     destructor destroy; override;
  12.     procedure displayInfo;
  13.  
  14.     property name: string read FName;
  15.   end;
  16.  
  17.  
  18. constructor TPerson.create(aName: string);
  19.   begin
  20.     inherited Create;
  21.     FName := aName;
  22.   end;
  23.  
  24. destructor TPerson.destroy;
  25.   begin
  26.     SetLength(FAwards,0);
  27.     SetLength(FName,0); // Should be set to zero just as 'FAwards'?
  28.     inherited Destroy;
  29.   end;
  30.  
  31. procedure TPerson.displayInfo;
  32.   begin
  33.     WriteLn('Person name: ',name);
  34.   end;
  35.  
  36. var person: TPerson;
  37.  
  38. begin
  39.   person:= TPerson.create('John Smith');
  40.   person.displayInfo;
  41.   person.Free;
  42.  
  43.   {$IfDef WINDOWS}
  44.   ReadLn;
  45.   {$EndIf}
  46. end.
  47.  
4
Graphics / Re: Fast Canvas Library V1.0
« Last post by Gigatron on Today at 06:44:27 pm »
Hi

I did some tests and added some nice effects on this library, for example 15 fx running at full speed with 500000 dots, 3Dstarfield (pre-computed sin table), CPU load 15%.

I'm going to clean up the code and add a plasma effect, so that's OK.

Regards
5
General / What is your favorite "built in" procedure/function of FP?
« Last post by TBMan on Today at 06:43:46 pm »
I was amazed when I learned recently of the WriteStr procedure. As an old Turbo Pascal coder, this slipped by me. What else is out there, buried in the pages of documentation, that you love to use?
6
Third party / Re: InstallAware 2025 Sources Published
« Last post by msintle on Today at 06:38:38 pm »
You're very welcome, thank you for your kind words!

We hope you love using it as much as we loved building it.
7
Ah!

But I don't want to do that!

DefiningUnit doesn't want to have anything to do with anything from ConsumingUnit.
ConsumingUnit is (if you will pardon the lousy humor) consumed with a need to know everything that DefiningUnit wants to tell it. (But not how it does it).

ergo:

DefiningUnit exposes alfalen and DefiningEnum.
Consuming unit uses them.

Why do I need to refer to ConsumingUnit in DefiningUnit? If I take that to it's somewhat illogical extereme, I could never use another unit (say AnonymousUnit) without adding my code as a used unit inside AnonymousUnit.

As I said in my earlier post, these two units actually work (well, they compile, but that's where I'm having problems for now) properly. But the first post (CATCOMP) does not. A constant clearly defined in symutil is referenced when lexutil uses symutil. This means that alfalen should be available to lexutil.

But it isn't!

And I can't figure out why not - even though AI agrees with me that that's what ought to happen!

Perplexed,

Tony
8
LCL / Re: Filtering a TStringGrid. Suggestions?
« Last post by Hansvb on Today at 06:33:20 pm »
Coincidentally, this week I have also been looking for how to filter a TStringGrid. My conclusion was, replace TStringGrid with a TDBGrid. In my case, I retrieved the data with a TSQlquery anyway. TSQlquery has a ServerFilter property. That works well.

Quote
https://www.freepascal.org/docs-html/fcl/sqldb/tsqlquery.serverfilter.html

Quote
https://www.youtube.com/watch?v=VlU925xHOAc
9
Android / Re: Testers required for LAMW app on the Google Play Store
« Last post by RayoGlauco on Today at 06:28:40 pm »
I'm not familiar with Goodman's case. I can only say that I've been reading the posts on this site for years, and answering some of them. Most of the questions, from both amateurs and professionals, are answered politely. I don't know if this post is considered appropriate, although I believe it is. In any case, no one can guarantee that a single post will attract the attention of users and obtain the desired responses.
10
if you would like to use the Consuming Members in Defining, you shall try to include the Consuming unit per USES in the implementing Part of Defining Unit:

unit DefiningUnit;
...
interface
...
implementation

uses
  ConsumingUnit;

const...
type...
var...
procedure ...
function ...
...
end.

analog to the Consuming unit:

unit Consuming;
...
interface
...
implementation

uses
  DefiningUnit;

const...
type...
var...
procedure...
function...
...
end.

Take care, that you don't use both Unit's in implementation Part of each together. One Unit should be view as Master, and the other Unit as Slave.

So, the Master holds the used global Members.
And the Slave holds the "usage" of the Members.

Can be a little bit tricky, I know ... But: Programming is Work, not Fun - sometimes  ;D
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018