Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
LazReport / Re: Designer
« Last post by SandyG on Today at 03:20:24 am »
Will take a look at the 2x feature, will help a lot if it works.

Sandy
2
General / Re: A question on Modula2 vs Free Pascal
« Last post by speter on Today at 03:09:19 am »
They are really easy to stop though. Just don’t allow people who don’t know pascal to post.  Problem solved.  8)
I would not support this approach.

I would suggest the opposite -> give help to everyone who asks; especially those with poor (or no) knowledge of Pascal.

cheers
S.
3
General / Re: Initiaiizing records by constructor
« Last post by speter on Today at 03:04:31 am »
Interestingly, when I implement Thaddy's very cool code,
I get a "managed type not initialised" warning if "a:TA" is a local variable;
the compiler does not give the warning if "a:TA" is a global.

Code: Pascal  [Select][+][-]
  1. unit foo;
  2.  
  3. {$mode objfpc}{$modeswitch advancedrecords}{$H+}
  4.  ...
  5. type
  6.   TA = record
  7.     int: integer;
  8.     str: string;
  9.     class operator initialize(var a:TA);
  10.   end;
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.    ...
  16.     procedure FormCreate(Sender: TObject);
  17.   private
  18.  
  19.   public
  20.     a : ta;
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.lfm}
  29.  
  30. { TForm1 }
  31.  
  32. class operator TA.initialize(var a:TA);
  33. begin
  34.   a.int := 200;
  35.   a.str := 'test';
  36. end;
  37.  
  38. procedure TForm1.FormCreate(Sender: TObject);
  39. var
  40.   b : ta;
  41. begin
  42.   memo1.append('int='+a.int.tostring+'; str='+a.str);
  43.   memo1.append('int='+b.int.tostring+'; str='+b.str);
  44. end;

The code above give the message:
  Warning: Local variable "b" of a managed type does not seem to be initialized
(even though it _is_ initialised.)

cheers
S.
4
General / Re: Best way to exchange data between a form and a unit
« Last post by cdbc on Today at 03:00:24 am »
Hi
That's the spirit  ;)
Nice to hear, your efforts now, _will_ pay you back  8)
Remember, that if you have a field/member of the transaction, say e.g.: "TSettingsTransaction.Sender : TObject", then you are able to send the /offending/ checkbox along, throug the observer mechanism in i.e.: "procedure HandleObsNotify(aReason: TProviderReason;aNotifyClass: TObject;UserData: pointer);" and then check for it in the /common/ handler e.g.:
Code: Pascal  [Select][+][-]
  1. TSomeView.DoSetChecks(anObj: TObject;aSettingsRec: PSettingsRec);
  2. begin
  3.   ...
  4.   with aSettingsRec^ do begin
  5.     if anObj is TCheckBox then begin
  6.       if TCheckBox(anObj).Name = 'chbActiveLogging' then TCheckBox(anObj).Checked:= srActiveLog; // field of record
  7.       ...
  8.       etc...
  9.     end;
  10.   end;
  11. end;
That should alleviate duplicate code...  :D
Just a thought, anyway, best keep it simple.
Regards Benny
5
General / Re: A question on Modula2 vs Free Pascal
« Last post by Joanna on Today at 01:36:43 am »
@thaddy I’ve heard stories of you scolding people but I’ve never had a problem with you  :)

I’m sorry to say but you and mark Had your efforts to help wasted upon someone who didn’t deserve them.

Thaddy, you have done nothing wrong. The goal of this person who does not even know pascal was to attack the nice people in this forum who try to help. If he keeps being allowed to do this the forums will become toxic and less helpful as people get burned out and leave.

This is just another “Trojan horse“ Style attack upon the fpc community.
They like to disguise themselves as new people interested in pascal but they are really like a weapon filled with poison once they get in.

They are really easy to stop though. Just don’t allow people who don’t know pascal to post.  Problem solved.  8)
6
Android / lamw
« Last post by desconocido on Today at 12:58:09 am »
I need help installing lazarus android module wizard, I have many errors, it is almost impossible, I have checked almost everywhere, can someone help me, thank you very much
7
General / Re: A question on Modula2 vs Free Pascal
« Last post by Thaddy on Today at 12:38:08 am »
Joanna, Marcov is allowed to always put me right. My answer could indeed be interpreted as unfriendly.
It wasn't. OP did not put any effort in. That hurts me. He seems not a noob, lacks basic linux build-from-source knowledge and does not listen to Mark and me. He should have had a running M2 this weekend.

At least i have Modula-2 installed....(for now)
8
General / Re: Initiaiizing records by constructor
« Last post by Thaddy on Today at 12:23:13 am »
Here's a solution with management operator, btw:
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}{$modeswitch advancedrecords}{$H+}
  2. type
  3.   TA = record
  4.     int: integer;
  5.     str: string;
  6.     class operator initialize(var a:TA);
  7.   end;
  8.  
  9.  class operator TA.initialize(var a:TA);
  10.  begin
  11.    a.int := 200;
  12.    a.str := 'test';
  13.  end;
  14.  
  15. var
  16.   a:TA;
  17. begin
  18.   writeln(a.int,a.str);
  19. end.
9
General / Re: Initiaiizing records by constructor
« Last post by Thaddy on Today at 12:13:36 am »
How about using a procedure instead of a constructor?
Not a good idea. Separates code from implementation.
We have better options nowadays, management operators and record constructors, when properly used.
Also note that in his case the string type is not clear. What string type does string mean?
10
Graphics / Re: scanline example
« Last post by speter on Today at 12:12:12 am »
Thanks very much for your reply WP! Lots of food for (re)thinking. :)

Why did you call your code in the Form's OnPaint when the same method exists for TPaintBox as well?
Yes, I was just being lazy (the 2020 version used form.onpaint).

cheers
S.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018