* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
LCL / Re: Following code crashes application
« Last post by WooBean on Today at 01:15:53 pm »
@ertank

Hi,
just modify your procedure TForm1.Button1Click(Sender: TObject) as below:

Code: Pascal  [Select]
  1.  
  2. procedure TForm1.Button1Click(Sender: TObject);
  3. var
  4.   Form: TForm2;
  5. begin
  6.   Log('1');
  7.   Form := TForm2.Create(Self);
  8.   Form.visible := False; //for modal usage a form must be non visible at first
  9.   try
  10.     Log('2');
  11.     Self.Hide();
  12.     Log('3');
  13.     Form.ShowModal();
  14.     Log('4');
  15.   finally
  16.     Form.Free();
  17.     Self.Show(); //just to have something visible
  18.   end;
  19. end;
  20.  

WooBean
2
General / Re: Insert check mark symbol
« Last post by exdatis on Today at 01:09:41 pm »
Lainz, wp, thank you very much.
Perfect!
3
General / Re: Blogs
« Last post by Handoko on Today at 12:54:57 pm »
Welcome back tverwij.

We are currently lack of volunteers to improve the documentation. I heard some users said they want to help to make the documentation better. The idea is good but not much efforts have been done because it is not an easy task. It requires good knowledge on both Pascal language and the software (Lazarus IDE and FPC).

As a volunteer-supported project, Lazarus is awesome. In some areas it may be not good as the commercial one. But it's really improved a lot compare to first time I tried it 10 years ago.

One thing I like about Lazarus/FPC is the community, people here are nice. If you have question about the software or Pascal programming, lots of experienced users will help you.
4
LCL / Following code crashes application
« Last post by ertank on Today at 12:13:30 pm »
Hello,

I am using
Code: [Select]
fpc 3.1.1/trunk svn revision 38804 2018-04-22
lazarus 1.9.0/trunk svn revision 57163 2018-01-27
Target is arm-wince executable.

Having just two forms in the project. Following code crashes application. First screen task bar starts to flicker. After several seconds message displayed as "application project1.exe encountered a serious error and must shut down."
Code: [Select]
uses
  Unit2;

{ TForm1 }

procedure Log(const Value: string);
var
  FileName: string;
  F: TextFile;
  Prefix: string;
begin
  FileName := ExtractFilePath(Application.ExeName) + FormatDateTime('yyyy-mm', Now()) + '.log';
  AssignFile(F, FileName);
  {$I-}
  if FileExists(FileName) then Append(F) else ReWrite(F);
  if IOResult <> 0 then Exit();
  Prefix := FormatDateTime('yyyy-mm-dd hh:nn:ss   ', Now());
  WriteLn(F, Prefix + Value);
  CloseFile(F);
  {$I+}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Top := 20;
  Left := 20;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Form: TForm2;
begin
  Log('1');
  Form := TForm2.Create(Self);
  try
    Log('2');
    Self.Hide();
    Log('3');
    Form.ShowModal();
    Log('4');
  finally
    Form.Free();
  end;
end;

In log file, I read 1, 2, 3 written. There is no 4.

Same error displayed if I try to display Form2 window using "Form.Show()" instead of "Form.ShowModal". Sample project to reproduce can be found attached.

Any help is appreciated.

Edit: Here is a video for understanding the problem. In the video, I did not hide Form1 in order to "feel" how Form2 behaves.
http://s3.dosya.tc/server15/ttfrxy/VID_20180423_134040.mp4.html
5
Other / Re: Go on with Lazarus for database app or not?
« Last post by edwinyzh on Today at 12:09:23 pm »
I'd suggest the mORMot framework (https://github.com/synopse/mORMot) if you are just starting out, you'll have a high performance ORM for simple writing/reading of the database records, while you can use any complex SQL to more complex things.

It's not just an ORM though, there are over 30 samples (https://github.com/synopse/mORMot/tree/master/SQLite3/Samples) to help you get started, the project has been being actively developed for many years and the author it has a very active forum.

I've been using it successfully in several projects and it's highly recommended.
6
General / Re: Blogs
« Last post by tverweij on Today at 12:04:18 pm »
Let me state it in another way, as I am clearly misunderstood.

There is indeed much information; the FPC online documentation (also installed as PDF and chm), the FPC/Lazarus Wiki and the example projects.

But the problem is they are not linked.
If I press F1 in Lazarus, I get the FPC documentation. This  is generated documentation without example code and without links to the wiki.
If I search in the wiki, I get every page 3 or 4 times - in different languages, making the list too long to make sense.

When I am looking for a package in the online package I get (by example): APE, when I open it, I get Package Info: Category: Science, no home page and no further info. What does it do /  what is it used for?
Same in the Install/Uninstall packages: no information on the packages whatsoever. Also no links to the wiki pages.

And the example projects; more than 70% does not have any description. So what is the intend of the example?

The problem is not that there is not enough information, but that it is not structured and not linked to each other.




7
Mac OS X / Re: macOS 32-bit app warning
« Last post by Hansaplast on Today at 11:03:51 am »

I think, the cocoa widgetset should be designed to look similar in sizes and proportions so that you can reuse your Windows or Linux code without modifications - and like it is for carbon today. Other implementations would make no sense.
Totally agree ... or at least: this is how I'd like to see it as well.
However the devs appear to be aiming to match XCode - for example font size = 8 in XCode is much smaller than in Carbon/Windows/Linux.
Right now, in Cocoa's current state, I have to do this to make the font size match:


Code: Pascal  [Select]
  1.   procedure fixCocoaLabels;
  2.     var FontCorrection:Double;
  3.         Counter:integer;
  4.     begin
  5.       FontCorrection := 11/8;
  6.       for Counter:=0 to self.ComponentCount-1 do
  7.         if self.Components[counter] is TLabel then
  8.           TLabel(self.Components[counter]).Font.Size:=trunc(FontCorrection*tmpLabel.Font.Size);
  9.     end;      


Obviously this is not the way to do this ... it makes it for a poor way to design a UI, since you can't see it at design time if the IDE ever runs reliable under Cocoa. But even worse of course when the size rules change at a later time.
Before spending hours on designing things the wrong way ... what does the Lazarus Dev team think of this?
I can't seem to get a clear statement ...
8
TAChart / Re: [Solved] tachart format to display marks
« Last post by wp on Today at 10:58:21 am »
[...] because in my case marks can be only 1, 2, 3, ...
Please remember my previous post... The chart does not take care of that. If the marks get too far apart then it adds intermediate marks. It does not matter if your data allow only integer marks or not.
9
Audio and Video / Re: Lazarus Mediaplayer with SDL2 and FFMPEG
« Last post by somby on Today at 10:48:09 am »
Hi lazarus users,
I have found some small bugs yet. The latest version
is 006. You can found it at download:
https://c.1und1.de/@519844823566385489/Jae-lddLSjquAVnczAPqHg

have fun
your somby
10
Graphics / Inconsistent behaviour of copyrect in Windows and Linux
« Last post by han on Today at 10:47:40 am »
I’m working on an application which should flip images with pixel accuracy. This is possible with copyrect. I can do the following for a horizontal flip:

Code: Pascal  [Select]
  1. src:=rect(w, 0, 0, h);
  2. dest:=bounds(0, 0, w, h); //horizontal flip
  3. ...
  4. ...
  5. image1.Picture.Bitmap.Canvas.CopyRect(dest, bmp.Canvas, src);


However this doesn’t work for Linux (1). To make it work if I have to do the following:
Code: Pascal  [Select]
  1. src:=rect(0, 0, w, h);
  2. dest:=rect(w, 0, 0, h);//horizontal flip

This works fine in Linux and Windows, however in Windows it is shifted one pixel (2)!!!
To prevent the shift in Windows I have to do the following:
Code: Pascal  [Select]
  1. src:=rect(0, 0, w, h);
  2. {$ifdef mswindows}
  3. dest:=rect(w-1, 0, 0-1, h);//horizontal flip.
  4. {$else} {unix}
  5. dest:=rect(w, 0, 0, h);//horizontal flip
  6. {$endif}

or better

Code: Pascal  [Select]
  1. {$ifdef mswindows}
  2. src:=rect(w, 0, 0, h); {doesn't work in Linux, why?}
  3. dest:=rect(0, 0, w, h);
  4. {$else} {unix}
  5. src:=rect(0, 0, w, h);
  6. dest:=rect(w, 0, 0, h);//horizontal flip, but gives in Windows one pixel drift.
  7. {$endif}


Any idea why the Linux version and Windows version behave different on these two points (1) and (2)?

See attached test program. Watch the white pixels at the corners. These should be one pixel away from the corners. Note the image is stretched.

For vertical flip the same problem. This is my solution:
Code: Pascal  [Select]
  1. {$ifdef mswindows}
  2. src:=rect(0, h, w, 0); // Vertical flip, works for windows but not Linux
  3. dest:=rect(0, 0, w, h);
  4. {$else} {unix}
  5. src:=rect(0, 0, w, h);
  6. dest:=rect(0,h, w, 0);//vertical flip, works for Linux but gives in Windows one pixel drift.
  7. {$endif}


The full procedure:

Code: Pascal  [Select]
  1. procedure TForm1.fliphorizontal1Click(Sender: TObject);
  2. var src, dest: TRect;
  3.     bmp: TBitmap;
  4.     w, h: integer;
  5. begin
  6.   w:=image1.Picture.Width; h:=image1.Picture.Height;
  7.  
  8.   {$ifdef mswindows}
  9.   src:=rect(w, 0, 0, h); {doesn't work in Linux, why?}
  10.   dest:=bounds(0, 0, w, h);
  11.   {$else} {unix}
  12.   src:=rect(0, 0, w, h);
  13.   dest:=rect(w, 0, 0, h);//horizontal flip, but gives one pixel shift in Windows
  14.   {$endif}
  15.  
  16.   bmp:=TBitmap.Create;
  17.   bmp.PixelFormat:=pf24bit;
  18.  
  19.   bmp.SetSize(w, h);
  20.   bmp.Canvas.Draw(0, 0, image1.Picture.Bitmap);
  21.   image1.Picture.Bitmap.Canvas.CopyRect(dest, bmp.Canvas, src);
  22.   bmp.Free;
  23. end;
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus