Re: [Lazarus] Release Candidate 1 of Lazarus 1.6

2015-12-09 Thread Luca Olivetti

El 09/12/15 a les 13:21, Mattias Gaertner ha escrit:

On Wed, 9 Dec 2015 12:33:08 +0100
Luca Olivetti <l...@wetron.es> wrote:


[...]
this isn't a lazarus bug but most probably a problem with fpc:
ExpandUnCFileNameUTF8 (which in turns calls SystUtils.ExpandUNCFileName)
returns '\' when called with

'D:\testfpc\15044_videowall\servidor\..\datos\'

(with fpc 2.6.4 it returned '\\local\Datos\15044_videowall\datos\')

I's *not* the '..' that's confusing it, it's the mapped drive.


Please test SystUtils.ExpandUNCFileName. If this function does it
wrong, create a FPC bug report.
If only ExpandUnCFileNameUTF8 does it wrong, please create a Lazarus
bug report.



Well, since ExpandUNCFileNameUTF8 only calls Sysutils.ExpandUNCFilename 
the bug is in fpc. I will file a bug report for it.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Release Candidate 1 of Lazarus 1.6

2015-12-09 Thread Luca Olivetti

El 08/12/15 a les 16:19, Mattias Gaertner ha escrit:



== Why should everybody (including you) test the release candidate? ==

In the past weeks the Lazarus team has stabilized the 1.6 fixes branch. The 
resulting 1.6RC1 is now stable enough to be used by any one for test purposes.





this isn't a lazarus bug but most probably a problem with fpc: 
ExpandUnCFileNameUTF8 (which in turns calls SystUtils.ExpandUNCFileName) 
returns '\' when called with


'D:\testfpc\15044_videowall\servidor\..\datos\'

(with fpc 2.6.4 it returned '\\local\Datos\15044_videowall\datos\')

I's *not* the '..' that's confusing it, it's the mapped drive.

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Release Candidate 1 of Lazarus 1.6

2015-12-09 Thread Luca Olivetti

El 09/12/15 a les 13:53, Bart ha escrit:

On 12/9/15, Luca Olivetti <l...@wetron.es> wrote:


this isn't a lazarus bug but most probably a problem with fpc:
ExpandUnCFileNameUTF8 (which in turns calls SystUtils.ExpandUNCFileName)
returns '\' when called with


That's odd, because this is the implementation:

function ExpandUNCFileNameUTF8(const FileName: string): string;
begin
   Result:=SysUtils.ExpandUNCFileName(Filename);
end;


Yes, most probably the bug is in fpc, but note that lazarus 1.4.x had 
its own implementation instead of relying on sysutils.
I just checked that sysutils.expanduncfilename gives the "correct" 
result with fpc2.6.4 and the wrong one with fpc 3.0.0.
OTOH lazarus 1.4.x would resolve the '..', i.e. 'c:\windows\..\' was 
translated to 'c:\' (that's what I used it for), while fpc doesn't.


Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Release Candidate 1 of Lazarus 1.6

2015-12-09 Thread Luca Olivetti

El 09/12/15 a les 17:07, Bart ha escrit:

On 12/9/15, Luca Olivetti <l...@wetron.es> wrote:


Yes, most probably the bug is in fpc, but note that lazarus 1.4.x had
its own implementation instead of relying on sysutils.


No, it did not.
It also called SysUtils.ExpandUncFilename().

Your bugreport says that it also translated C:\Windows\..\ into C:\.
This is done by ExpandFilenameUtf8 (which indead has it's own
implementation in LazFileUtils unit and calls ResolveDots which
actually does that job).

So, your memory serves you wrong I guess.


Right, I mixed the two functions.

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-11 Thread Luca Olivetti

El 11/11/15 a les 10:28, Graeme Geldenhuys ha escrit:


On 2015-11-11 09:16, Luca Olivetti wrote:

Try the attached project.


LCL inconsistency strikes again.

WindowState:=wsMaximized;

The above line of code has no affect under FreeBSD with LCL-GTK2. I see
a small borderless window with a button on it.


Thank you for testing.
Yes, but that's not relevant. I put it there just to do the same the 
real app is doing. It also behaves differently with linux-gtk (it 
maximizes) and linux-qt (it doesn't).

:-(
Also, on linux-gtk2 I tried up to size 300 and more, while linux-qt 
starts becoming slow at 49.





Anyway, I tested your project under FreeBSD LCL-GTK2 and Windows 2000.
Scrolling was smooth (with one exception) and CPU load was idle (< 1%).
Under Win2000 the application was full-screen, under FreeBSD it wasn't.


OK, windows 2000 probably behaves like windows xp.


Having the modal quit dialog open did not affect the scrolling speed. I
also couldn't see any visible change in speed while moving the mouse.


Yes, that's normal, I'm using a timer. The visible change in speed was 
when I was using a thread with synchronize.




The exception I mentioned was when I run the test project under Win2000
with the --debug option. There was visible flicker the whole time while
the application was running.


Strangely (or not) enough, it depends on the theme. With XP I see the 
flickering if I use the classic theme, no flickering with the 
teletubbies one.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-11 Thread Luca Olivetti

El 11/11/15 a les 01:21, Luca Olivetti ha escrit:

El 10/11/15 a les 23:37, Graeme Geldenhuys ha escrit:

On 2015-11-10 21:09, Luca Olivetti wrote:

But in the end I have to render it on the LCL canvas


Via a single BitBlt which should be more than fast enough for what you
described. Unless LCL is seriously broken.


I don't know if it's broken, but, AFAIK, there are two ways to animate
something

1) with a timer (constrained by the windows resolution)
2) with a thread+synchronize (only the main thread can access the gui,
and the constraint here is the rate the application loop calls
CheckSynchronize)

But what really puzzles me is the different behavior between xp and 7
(maybe it's aero, I could try disabling it). The fact that it's a font
of size 100 with a bitmap below it doesn't help, but it should be possible.


Well, I just found out that in a virtual machine (be it xp or 7) the 
timer resolution is 10ms, while in real hardware is 16ms (no matter if I 
use a timer or a thread+synchronize).
That at least explains the timing differences (but not the 
unresponsiveness of the full screen application under windows 7)


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-11 Thread Luca Olivetti

El 11/11/15 a les 10:26, Luca Olivetti ha escrit:

El 11/11/15 a les 10:16, Luca Olivetti ha escrit:

El 11/11/15 a les 09:28, Luca Olivetti ha escrit:


That at least explains the timing differences (but not the
unresponsiveness of the full screen application under windows 7)



TextRect!

Try the attached project.
Under windows XP the TextRect takes an unmeasurable amount of time
(using GetTickCount).
Under windows 7 it takes 160ms here when in full screen (1920 pixels
wide) or 60-70ms when using the --debug option (320 pixels wide).


That was on virtual hardware, BTW. On real hardware instead of 160 it
takes 40-60. It's still a lot of time compared to a virtualized windows xp.


More testing: I added a spinedit to change the size of the text.
Under windows xp I can go until 124, then it starts becoming as slow as 
windows 7.

Under windows 7 the maximum value is 83, at 84 is slow.
Any idea on what could be the cause?

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-11 Thread Luca Olivetti

El 11/11/15 a les 10:16, Luca Olivetti ha escrit:

El 11/11/15 a les 09:28, Luca Olivetti ha escrit:


That at least explains the timing differences (but not the
unresponsiveness of the full screen application under windows 7)



TextRect!

Try the attached project.
Under windows XP the TextRect takes an unmeasurable amount of time
(using GetTickCount).
Under windows 7 it takes 160ms here when in full screen (1920 pixels
wide) or 60-70ms when using the --debug option (320 pixels wide).


That was on virtual hardware, BTW. On real hardware instead of 160 it 
takes 40-60. It's still a lot of time compared to a virtualized windows xp.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 16:55, Graeme Geldenhuys ha escrit:

On 2015-11-10 12:28, Luca Olivetti wrote:

I guess codebot needs a newer fpc, it doesn't compile with 2.6.4.


You can also take a look at AggPas, which can easily accomplish what you
ask for - with out 0-1% CPU load (tested previously on my system).
Lazarus includes a copy of AggPas as standard.

Here are some examples to show you smoothness - and even warped text on
a bezier curve.

   http://crossgl.com/aggpas/aggpas-demo.htm

Take a look at the Trans_curve1.exe and Trans_curev2.exe example
executables (if you have Windows).


Impressive, but I looked at the source and it uses its own kind of 
application.
Anyway, I don't think that cpu is the limiting factor, the application 
loop is.
Let me explain: I modified the application so that, instead of a big 
background bitmap that needs to be redrawn every time the text moves, I 
have two, the big one and a smaller one just where the scrolling label 
is (I used BGRABitmap to split the previous one in two).


I then used a thread with a simple loop


  while not terminated do
  begin
sleep(FOwner.FScrollRefresh);
Synchronize(@SyncTimer);
  end;


where synctimer just updates the offset and invalidates the label so 
that it redraws itself.


On a virtualized windows xp I can use FScrollRefresh of 1 and it scrolls 
very fast and the application is responsive.
On a real hardware windows 7 (in theory much more powerful) or a 
virtualized one, not only the refresh cycle is much longer (I suppose 
the limiting factor is the rate of the CheckSynchronize calls from the 
main thread), but it cannot cope with the other messages (i.e., I update 
a clock with a timer, but it doesn't update, it doesn't react once I 
clicked on the button to confirm exit, etc.).
Before I thought it was cpu bound (since it had to repaint the whole 
screen), but now that it only repaints 10% it works exactly the same.
The strange thing is, it seems to work fine (albeit not at the rate it 
works under xp) if I start it as wsNormal (the application should be 
wsFullScreen and BorderStyle bsNone).



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 17:48, Aradeonas ha escrit:

Probably you are somewhere wrong, provide your code so we can check.

Regards,
Ara




Here is the component I adapted from the forum posting. Originally it 
used a timer instead of a thread and I have to clean it up once I decide 
for one option or the other.
Tomorrow I'll see if I can create a simple application that reproduces 
the problem using it.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
unit scrollinglabel;

{$mode objfpc}{$H+}

interface

uses
  Classes, StdCtrls, ExtCtrls, Controls, LResources, sysutils;

type

  { TScrollingLabel }
  TScrollingLabel=class;

  { TScrollThread }

  TScrollThread=class(TThread)
private
  FOwner:TScrollingLabel;
  procedure SyncTimer;
   public
 constructor Create(AOwner:TScrollingLabel);
 procedure Execute;override;
  end;

  TScrollingLabel=class(TCustomLabel)
  private
FOffset: integer;
FScrollRefresh: integer;
FScrolling: boolean;
FStep: integer;
FTimer: TScrollThread;
FNeededWidth:integer;
procedure OnTimer(Sender: TObject);
procedure SetScrolling(AValue: boolean);
procedure SetScrollRefresh(aValue: integer);
procedure EnableTimer(enable:boolean);
  protected
procedure Paint; override;
procedure AdjustSize; override;
procedure DoMeasureTextPosition(var TextTop: integer; var TextLeft: integer);
  override;
  public
constructor Create(anOwner: TComponent);override;
destructor Destroy; override;
  published
property ScrollRate: integer read FScrollRefresh write SetScrollRefresh default 500;
property ScrollStep: integer read FStep write FStep default 1;
property Scrolling: boolean read FScrolling write SetScrolling default True;
property Align;
property Alignment;
property Anchors;
//property AutoSize;
property BidiMode;
property BorderSpacing;
property Caption;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FocusControl;
property Font;
property Layout;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowAccelChar;
property ShowHint;
property Transparent;
property Visible;
//property WordWrap;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDrag;
//property OptimalFill;
  end;

procedure register;

implementation

uses Graphics;

procedure register;
begin
  RegisterComponents('Additional', [TScrollingLabel]);
end;

{ TScrollThread }

procedure TScrollThread.SyncTimer;
begin
  FOwner.OnTimer(nil);
end;

constructor TScrollThread.Create(AOwner: TScrollingLabel);
begin
  FOwner:=AOwner;
  inherited create(false);
end;

procedure TScrollThread.Execute;
begin
  while not terminated do
  begin
sleep(FOwner.FScrollRefresh);
Synchronize(@SyncTimer);
  end;
end;

procedure TScrollingLabel.OnTimer(Sender: TObject);
begin
  Dec(FOffset, FStep);
  if FOffset+FNeededwidth<0 then
FOffset:=-FStep;
  Invalidate;
end;

procedure TScrollingLabel.SetScrolling(AValue: boolean);
begin
  if FScrolling=AValue then Exit;
  FScrolling:=AValue;
  EnableTimer(FScrolling and (FNeededWidth>Width));
  if not FScrolling then
FOffset:=0;
  Invalidate;
end;

procedure TScrollingLabel.SetScrollRefresh(aValue: integer);
begin
  if FScrollRefresh=aValue then
Exit;
  FScrollRefresh:=aValue;
  //FTimer.Interval:=FScrollRefresh;
  Invalidate;
end;

procedure TScrollingLabel.EnableTimer(enable: boolean);
begin
  if enable then
  begin
if FTimer=Nil then
  FTimer:=TScrollThread.Create(self)
  end else
  begin
if FTimer<>Nil then
  FreeAndNil(FTimer);
  end;

end;

procedure TScrollingLabel.Paint;
var
  txtStyle : TTextStyle;
  R : TRect;
  TextLeft, TextTop: integer;
  LabelText: string;
  OldFontColor: TColor;
  scroll: Boolean;
begin
  R := Rect(0,0,Width,Height);
  with Canvas do
  begin
Brush.Color := Self.Color;
if (Color<>clNone) and not Transparent then
begin
  Brush.Style:=bsSolid;
  FillRect(R);
end;
Brush.Style:=bsClear;
Font := Self.Font;
FillChar(txtStyle,SizeOf(txtStyle),0);
scroll:=FScrolling and (FNeededWidth>Self.Width);
with txtStyle do
begin
  if scroll then
Alignment:=BidiFlipAlignment(taLeftJustify, UseRightToLeftAlignment)
  else
Alignment := BidiFlipAlignment(Self.Alignment, UseRightToLeftAli

Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 18:47, Graeme Geldenhuys ha escrit:

On 2015-11-10 16:43, Luca Olivetti wrote:

Impressive, but I looked at the source and it uses its own kind of
application.


Don't let the demos confuse you. The demos were implemented to be
cross-platform in their own way, with its own widgets used by the demos.
The idea comes from the original C++ AGG framework, and only meant for
the demos.

You can use the AggPas API directly (most powerful) in Lazarus or fpGUI
or Console applications. There is also a TAgg2D Canvas class which gives
you a more Delphi-like Canvas API - a much smoother/easier introduction
to AggPas. The TAgg2D canvas is available for LCL and fpGUI.


But in the end I have to render it on the LCL canvas (a simple 
TextRect), and I cannot do it faster than the LCL allows me. If I use a 
timer[**] I'm constrained by the timer resolution (around 15ms in 
windows with a minimum value of 10ms), if I use a thread+synchronize I'm 
constrained by how often the application loop calls CheckSynchronize 
(aside: if I move the mouse over the label, it goes faster, probably 
because the application is managing more windows messages and calls 
CheckSynchronize more often).
I also tried without Synchronize, but that's a no-no (apparently works 
until you hit a timing issue and the application crashes or gets stuck).



[*] there are also multimedia timers, but I don't know if/how I can use 
them, and they are windows specific anyway.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 23:37, Graeme Geldenhuys ha escrit:

On 2015-11-10 21:09, Luca Olivetti wrote:

But in the end I have to render it on the LCL canvas


Via a single BitBlt which should be more than fast enough for what you
described. Unless LCL is seriously broken.


I don't know if it's broken, but, AFAIK, there are two ways to animate 
something


1) with a timer (constrained by the windows resolution)
2) with a thread+synchronize (only the main thread can access the gui, 
and the constraint here is the rate the application loop calls 
CheckSynchronize)


But what really puzzles me is the different behavior between xp and 7 
(maybe it's aero, I could try disabling it). The fact that it's a font 
of size 100 with a bitmap below it doesn't help, but it should be possible.




But as the AggPas demos shows, text animation (more advanced that what
you described - movement of text on a constantly moving bezier curve) is
easy and possible with excellent results. So AggPas will not be the
bottleneck.



See above, the problem lies somewhere else, a simple TextRect is enough 
for what I'm doing. I just used BGRABitmaps to split the background 
image so only the part under the scrolling label has to be redrawn (I 
probably could have done the same with TLazIntfImage), but it didn't help.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 12:36, Aradeonas ha escrit:

If I were you I used BGRABitmap or Codebot,they have good text option
and you can made a simple one easily,it will be fast,light and
beautiful.


I guess codebot needs a newer fpc, it doesn't compile with 2.6.4.
I'm following the tutorials for BGRABitmap to see if it's easy enough to 
add it to my project.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

Hello,

in my current project, I need a marquee.
I adapted the component from here:

http://forum.lazarus.freepascal.org/index.php?topic=24646.0

which is a descendant of a TCustomLabel using a timer to move the text 
position.

I have several problems with it:

- it is very cpu intensive (I have to put it over a picture, so the 
invalidate will also force the repainting of the bitmap I guess)


- the minimum timer interval is 10ms, and even that it's not guaranteed 
(the resolution on windows is around 15ms and I got a very different 
speed of the label using 10ms under virtualized windows xp and a real 
windows 7 machine)


- with such a low value (10ms) sometimes the application gets bogged 
down, specifically it cannot process the modal dialog I use to shut down 
the application.


- I solved the flickering by setting DoubleBuffered to the containing 
widget (a TPageControl), but, again, I think that takes its toll on cpu 
usage.



I tried to use a thread (with synchronize) instead of a ttimer to obtain 
a lower interval, but that only compounds the problems.


For the time being, I'm using 50ms and change the number of pixels to 
change the speed, however if I scroll more than 2 pixels every 50ms the 
scrolling isn't smooth enough, but the required speed should be 6 or 7 
pixels, and that's very unpleasant to the eye.


Any suggestion?


--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Test This Please

2015-11-06 Thread Luca Olivetti

El 06/11/15 a les 09:55, Anthony Walter ha escrit:

To Debian based Lazarus users, if you have the inclination can you test
this out, or provide some feedback:


On kde (kubuntu 15.10) with compositing disabled the window never 
disappears (when I click on the checkbox it just stays there without the 
graph moving) and it has black corners, as well a a black background in 
the slider.
Everything is fine with compositing enabled, but I usually leave it 
disabled.

The hotkey works, $XDG_CURRENT_DESKTOP is KDE.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Luca Olivetti

El 06/11/15 a les 18:10, Martin Schreiber ha escrit:


You are joking, no? It has been discussed on fpc-pascal/fpc-devel several
times. An IIRC Italian community member then usually shows a syntax
description of a safe "with" statement from a maybe more than 20 year old
pascal dialect.


I don't know if that's me, but, yes, I used a variant of pascal (by 
texas instruments) that allowed to declare aliases with "with", e.g


 with a=somerecord, b=someotherrecord do
 begin
   a.x:=b.x;
 end;


I even found the (scanned) reference manual to confirm the syntax but 
now I cannot find it.

It is definitely more than 20 years old (and more than 30 ;-):

http://www.computinghistory.org.uk/det/11554/TI-990-System/


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TTabcontrol color strangeness

2015-11-05 Thread Luca Olivetti

El 09/10/15 a les 09:23, Luca Olivetti ha escrit:

Hello,

If I use a TTabControl in windows xp with the classic theme, the color
is the same as the solid color of the desktop and there's no property to
change it.
Shouldn't at least be the color of a normal window?
This doesn't happen with the teletubbies theme (where it takes a light
gray instead of the desktop color, but still isn't the normal color of a
window.)
Note that if I set a background image, the color of the TTabControl is
still the solid color, i.e., it is not transparent.


Also happens in windows 7 with the classic theme

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark

2015-11-02 Thread Luca Olivetti

El 03/11/15 a les 00:58, Leonardo M. Ramé ha escrit:


What I don't get is what's the purpouse of TBookmark, I thought it was
made for solving the problem I had.


Yes, but only if you leave the dataset open.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Increasingly frustrated with DbGrids

2015-11-02 Thread Luca Olivetti

Hello,

I constantly stumble with the behaviour of the TDBGrid.
I understand that it's a complex component, but every time I find an 
issue an Luiz fixes it, two more pop up (or an older one resurfaces).
The latest episode of the saga is the futility of using a custom editor 
(with OnSelectEditor), since the grids then sets the value of the field 
using this snippet of code


  if (FEditor<>nil) and FEditor.Visible then begin
Msg.LclMsg.msg:=GM_GETVALUE;
Msg.grid:=Self;
Msg.Col:=FCol;
Msg.Row:=FRow;
Msg.Value:=GetCells(FCol, FRow);
FEditor.Dispatch(Msg);
SetEditText(Msg.Col, Msg.Row, Msg.Value);
  end;

and this only works with the editors defined in Grids.pas, the only ones 
managing the GM_GETVALUE message.
For other kinds of editors the result depends on how you move in the 
grid: it could either maintain the value the editor set or reset it to 
an empty string.


I think I will file a bug once I can create a simple project, but in the 
meantime if somebody has an idea on how to solve it, it would be 
appreciated.


Oh, and a custom editor has no way of adapting if the dbgrid is 
scrolled, a column is resized, etc. Again, this only work for the 
editors defined in Grids.pas.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Increasingly frustrated with DbGrids

2015-11-02 Thread Luca Olivetti

El 02/11/15 a les 11:12, Luca Olivetti ha escrit:

Hello,

I constantly stumble with the behaviour of the TDBGrid.
I understand that it's a complex component, but every time I find an
issue an Luiz fixes it, two more pop up (or an older one resurfaces).
The latest episode of the saga is the futility of using a custom editor
(with OnSelectEditor), since the grids then sets the value of the field
using this snippet of code

   if (FEditor<>nil) and FEditor.Visible then begin
 Msg.LclMsg.msg:=GM_GETVALUE;
 Msg.grid:=Self;
 Msg.Col:=FCol;
 Msg.Row:=FRow;
 Msg.Value:=GetCells(FCol, FRow);
 FEditor.Dispatch(Msg);
 SetEditText(Msg.Col, Msg.Row, Msg.Value);
   end;

and this only works with the editors defined in Grids.pas, the only ones
managing the GM_GETVALUE message.
For other kinds of editors the result depends on how you move in the
grid: it could either maintain the value the editor set or reset it to
an empty string.

I think I will file a bug once I can create a simple project, but in the
meantime if somebody has an idea on how to solve it, it would be
appreciated.



Bug created:

http://bugs.freepascal.org/view.php?id=28944

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Increasingly frustrated with DbGrids

2015-11-02 Thread Luca Olivetti

El 02/11/15 a les 11:24, Tony Whyman ha escrit:

Luca,

Intercept classes are a very useful technique for overcoming this
problem. I recently wanted to have a specialised TComboBox as a
TStringGrid Editor and defined an intercept class for this as:


Yes, I used similar hacks in the past (just last week I asked here how 
to remove the border in a TPageControl), and I'll probably follow your 
advice here, still, I think that if the TDbGrid allows for a custom 
editor, it should work without this kind of hack.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Increasingly frustrated with DbGrids

2015-11-02 Thread Luca Olivetti

El 02/11/15 a les 12:36, Mattias Gaertner ha escrit:

On Mon, 2 Nov 2015 10:52:25 +
Tony Whyman <tony.why...@mccallumwhyman.com> wrote:


Ah, but then you can't edit it in the IDE.


The IDE does not know about your new class.
You need to unregister the old and register the new.


it doesn't matter: the ide uses the old class, but the unit (and the 
grid) will see the new one.
It's a hack, really, which will probably bite me in the rear somewhere 
in the future, but I have to ship the programme now :-(


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] External SIGSEGV (random) when assigning TBookmark

2015-11-01 Thread Luca Olivetti

El 01/11/15 a les 13:25, Leonardo M. Ramé ha escrit:


To me, the code looks correct, but I'm getting a SIGSEGV while assigning
the bookmark. I must add the error only happens the 2nd or 3rd time this
method is called:


I suppose that's because the bookmark is only valid while the query is 
opened, buy you close it between getting the bookmark and setting it.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Too much space between TPageControl and its tabs

2015-10-29 Thread Luca Olivetti

Hello,

I have to show different things at different times in the same position.
Instead of putting everything in the same spot of the form and setting 
Visible only the item I want to show (which makes designing difficult), 
I'm using a TPageControl with ShowTabs=False.
The problem is that, at least on windows, there are 4 pixels of border 
between the tab and the pagecontrol (on Linux it's just 2, but the 
border is still there).
I couldn't find a property to avoid it, and looking how it is drawn, it 
seems it is deferred to windows, so there is no way to avoid this border.

Am I wrong?
Is there an alternative component that I could use?
For the time being, I use a panel and create the different controls at 
runtime, but this is possible only in simple cases, not for complex 
designs (well, of course it's possible but it's something I'd prefer to 
do visually).


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Too much space between TPageControl and its tabs

2015-10-29 Thread Luca Olivetti

El 29/10/15 a les 09:17, Ondrej Pokorny ha escrit:


Have you tried to ask uncle Google? He knows a lot:
https://www.google.at/search?q=delphi+no+border+pagecontrol


Duh, why didn't I think of that?


In Delphi it is possible, I haven't tried in Lazarus. But since it is
WinAPI, it should be possible as well.


It works, but it introduces a dependency on the windows unit. I need it 
on windows, so it isn't a big concern, but I don't like it 100%.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Patch for TTrayIcon on Ubuntu's Unity

2015-10-18 Thread Luca Olivetti

El 12/10/15 a les 17:53, Anthony Walter ha escrit:

In fact I checked your code and it only tries to load libappindicator if
XDG_CURRENT_DESKTOP is Unity. With that variable set I can see the tray
icon (note that its normal value is KDE).

That's good then. I added 'KDE' to the allowed desktops when
libappindicator is present with the Gtk2 toolkit. I also recompiled the
64bit example program with this change and overwrote it in the
repository. So now if the fix it should also work on KDE, given
XDG_CURRENT_DESKTOP returns 'KDE'.

Thank for the link as well. It would seem, reading the information in
the link you posted, that Gtk3 uses libappindicator3-1. If anyone
actively is working on adding to Gtk3 lcl interface you may want to
consider looking at and copying some of the code I committed to github.



FYI, just saw this:

http://blog.davidedmundson.co.uk/blog/xembed_back

(from https://lists.debian.org/debian-kde/2015/10/msg00047.html)

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Patch for TTrayIcon on Ubuntu's Unity

2015-10-12 Thread Luca Olivetti

El 12/10/15 a les 09:34, Anthony Walter ha escrit:


A linux x86_64 compiled executable example is included.



FWIW, that executable doesn't show any tray icon in kubuntu 15.04 with 
plasma 5.3.2.
As I reported before, trayicons in this environment don't work either 
with unpatched lazarus with the gtk2 widgetset but do work with the qt one.
Disclaimer: I don't usually need tryicons, but the various threads on 
them piqued my curiosity.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Patch for TTrayIcon on Ubuntu's Unity

2015-10-12 Thread Luca Olivetti

El 12/10/15 a les 14:37, Anthony Walter ha escrit:

The exe is 64 bit and built with the Gtk2 widget set. So the thing to
test would be if the Qt/KDE desktop normally shows with Lazarus
applications built the Gtk2 tray icon.


No, as I said, it doesn't.
But, as per

http://blog.martin-graesslin.com/blog/2014/06/where-are-my-systray-icons/

if the gtk2 application uses libappindicator for unity compatibility, it 
should also work with plasma.
In fact I checked your code and it only tries to load libappindicator if 
XDG_CURRENT_DESKTOP is Unity. With that variable set I can see the tray 
icon (note that its normal value is KDE).



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TTabcontrol color strangeness

2015-10-09 Thread Luca Olivetti

Hello,

If I use a TTabControl in windows xp with the classic theme, the color 
is the same as the solid color of the desktop and there's no property to 
change it.

Shouldn't at least be the color of a normal window?
This doesn't happen with the teletubbies theme (where it takes a light 
gray instead of the desktop color, but still isn't the normal color of a 
window.)
Note that if I set a background image, the color of the TTabControl is 
still the solid color, i.e., it is not transparent.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Tray icon not working on Ubunut

2015-10-07 Thread Luca Olivetti

El 06/10/15 a les 23:08, Michael Van Canneyt ha escrit:



On Tue, 6 Oct 2015, Anthony Walter wrote:


What's the status of TTrayIcon and Ubuntu/Unity?

Today I tried to create an application with a TTrayIcon on Ubuntu with
the
latest LCL sources and the TTrayIcon doesn't show. I think it's been
broken
for years.


It works just fine on Kubuntu.



But only with the qt widgetset

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Tray icon not working on Ubunut

2015-10-07 Thread Luca Olivetti

El 07/10/15 a les 10:30, Michael Van Canneyt ha escrit:


It works just fine on Kubuntu.



But only with the qt widgetset


No. I use the GTK 2 widgetset on Kubuntu. I've never used Qt yet.


Really, it doesn't work here with the gtk2 widgetset, only with qt.
kubuntu 15.04, x86_64, with plasma 5.3.2

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Tray icon not working on Ubunut

2015-10-07 Thread Luca Olivetti

El 07/10/15 a les 17:08, Luca Olivetti ha escrit:

El 07/10/15 a les 10:30, Michael Van Canneyt ha escrit:


It works just fine on Kubuntu.



But only with the qt widgetset


No. I use the GTK 2 widgetset on Kubuntu. I've never used Qt yet.


Really, it doesn't work here with the gtk2 widgetset, only with qt.
kubuntu 15.04, x86_64, with plasma 5.3.2


Though the same program, with the gtk2 widgetset, shows the tray icon in 
mageia 5 (with plasma 4.3.something).


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Strange interaction between combox and IniPropStorage

2015-10-06 Thread Luca Olivetti

El 13/08/15 a les 09:24, Luca Olivetti ha escrit:

El 12/08/15 a les 16:37, Luca Olivetti ha escrit:



Definitely a regression: I just had to modify an old program (where this
feature worked) and it doesn't work anymore :-(
At least the workaround seems to do the job.


It's not a regression, it's probably always been there, but I manually
called SaveProperties previously, but since the IniPropstorage does it
automatically, I removed my call.
*However* it calls it when the form is being freed, and in that case the
combobox returns the previous itemindex, not the changed one.
I added a comment and a couple of possible patches in the bugreport.

http://bugs.freepascal.org/view.php?id=28514


I see that the patch hasn't been merged in 1.4.4.
Please keep it in mind for 1.4.6

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus program files very big, why?

2015-10-03 Thread Luca Olivetti

El 04/10/15 a les 00:06, Bo Berglund ha escrit:


Amazingly this little program is 24.5 Mbytes as shown:
-rwxr-xr-x 1 root root 24493881 Oct  3 21:35 project1


http://bfy.tw/26s2

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Strange interaction between combox and IniPropStorage

2015-08-13 Thread Luca Olivetti

El 12/08/15 a les 16:37, Luca Olivetti ha escrit:



Definitely a regression: I just had to modify an old program (where this
feature worked) and it doesn't work anymore :-(
At least the workaround seems to do the job.


It's not a regression, it's probably always been there, but I manually 
called SaveProperties previously, but since the IniPropstorage does it 
automatically, I removed my call.
*However* it calls it when the form is being freed, and in that case the 
combobox returns the previous itemindex, not the changed one.

I added a comment and a couple of possible patches in the bugreport.

http://bugs.freepascal.org/view.php?id=28514

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Strange interaction between combox and IniPropStorage

2015-08-12 Thread Luca Olivetti

El 11/08/15 a les 12:22, Luca Olivetti ha escrit:

El 11/08/15 a les 12:12, Luca Olivetti ha escrit:

I just found a very strange bug:
when I try to save the ItemIndex of a combobox through a
TIniPropStorage, its value reverts to the value it had when the form was
created.
Every other value (I use TEdit.Text and TSpinEdit.Value) is correctly
saved, it's just the TCombobox.Itemindex that does that *unless* I
reference it before the TIniPropstorage tries to save it.
I attached a sample project in this bug:

http://bugs.freepascal.org/view.php?id=28514

I suppose it's a regression, since I have used this combination
(combobox and inipropstorage) in many projects and never saw this before.

Note that if you just create a new project and put the combobox and the
inipropstorage on the main form, it works fine, maybe it has something
to do with the ShowModal I'm using to show the form.



Nope, I tried also with a plain Show and it happens just the same (even
tried to set the modalResult of both buttons to mrNone).



Definitely a regression: I just had to modify an old program (where this 
feature worked) and it doesn't work anymore :-(

At least the workaround seems to do the job.

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Strange interaction between combox and IniPropStorage

2015-08-11 Thread Luca Olivetti

El 11/08/15 a les 12:12, Luca Olivetti ha escrit:

I just found a very strange bug:
when I try to save the ItemIndex of a combobox through a
TIniPropStorage, its value reverts to the value it had when the form was
created.
Every other value (I use TEdit.Text and TSpinEdit.Value) is correctly
saved, it's just the TCombobox.Itemindex that does that *unless* I
reference it before the TIniPropstorage tries to save it.
I attached a sample project in this bug:

http://bugs.freepascal.org/view.php?id=28514

I suppose it's a regression, since I have used this combination
(combobox and inipropstorage) in many projects and never saw this before.

Note that if you just create a new project and put the combobox and the
inipropstorage on the main form, it works fine, maybe it has something
to do with the ShowModal I'm using to show the form.



Nope, I tried also with a plain Show and it happens just the same (even 
tried to set the modalResult of both buttons to mrNone).


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Strange interaction between combox and IniPropStorage

2015-08-11 Thread Luca Olivetti

I just found a very strange bug:
when I try to save the ItemIndex of a combobox through a 
TIniPropStorage, its value reverts to the value it had when the form was 
created.
Every other value (I use TEdit.Text and TSpinEdit.Value) is correctly 
saved, it's just the TCombobox.Itemindex that does that *unless* I 
reference it before the TIniPropstorage tries to save it.

I attached a sample project in this bug:

http://bugs.freepascal.org/view.php?id=28514

I suppose it's a regression, since I have used this combination 
(combobox and inipropstorage) in many projects and never saw this before.


Note that if you just create a new project and put the combobox and the 
inipropstorage on the main form, it works fine, maybe it has something 
to do with the ShowModal I'm using to show the form.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] systemd

2015-06-27 Thread Luca Olivetti

El 27/06/15 a les 13:47, A. Fortuny ha escrit:

Hi Folks.

Currently I have some services running in a linux box (OpenSuse 11.2)
and they will be moved to an OpenSuse 13.2. I want to move the services
from SysV to systemd.


Did you see this?

http://wiki.freepascal.org/Daemons_and_Services#Linux_.28Fedora.29

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

2015-06-23 Thread Luca Olivetti

El 23/06/15 a les 17:51, Bo Berglund ha escrit:


The problem is most likely in the conversion because even the smallest
test application throws an exception on the very first call into the
driver, the initialization of the Api data interface array.


Or in the calling convention

http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3

you can try and define the external as stdcall or if that fail try cdecl 
(though I'm not sure the default is different than delphi).


Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

2015-06-23 Thread Luca Olivetti

El 23/06/15 a les 20:38, Bo Berglund ha escrit:

On Tue, 23 Jun 2015 18:30:46 +0200, Luca Olivetti l...@wetron.es
wrote:


El 23/06/15 a les 17:51, Bo Berglund ha escrit:


The problem is most likely in the conversion because even the smallest
test application throws an exception on the very first call into the
driver, the initialization of the Api data interface array.


Or in the calling convention

http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3

you can try and define the external as stdcall or if that fail try cdecl
(though I'm not sure the default is different than delphi).


STDCALL has been there forever (since about 2002)...


You could try cdecl then (though I doubt it will make a difference).

Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

2015-06-19 Thread Luca Olivetti

El 19/06/15 a les 09:25, Bo Berglund ha escrit:


constructor TSentinel.Create;
begin
   FTimer := TTimer.Create(Application);
   FTimer.Enabled := false;
   FTimer.Interval := 0;
   FTimer.OnTimer := OnCheckTimer(Self); //= Error here
   ...




Why is this difference Delphi/FPC appearing and what can I do?



Either you use {$MODE DELPHI} or you prepend the method with @, i.e.

FTimer.OnTimer := @OnCheckTimer

See:

http://wiki.freepascal.org/Code_Conversion_Guide

Bye

--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error

2015-06-19 Thread Luca Olivetti

El 19/06/15 a les 09:50, Bo Berglund ha escrit:


Now I am getting to the real hurdle as follows:

DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading
SPROMEPS.OBJ

This caused by the following line in a suppurt file from SafeNet:

...
IMPLEMENTATION
USES
Windows;

{$L SPROMEPS.OBJ}  { LINK WITH THE SUPERPRO OBJECT FILE }

{ External functions }


Most probably the OBJ file is in a format that ld doesn't understand, 
see the remark here:



http://www.freepascal.org/docs-html/prog/progsu43.html#x50-490001.2.43

Maybe it's possible to convert it to a suitable format, but I cannot 
help you here.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How to cleanly terminate http server application/fastcgi application?

2015-04-13 Thread Luca Olivetti
I couldn't find a built-in way to cleanly terminate them, so I had to
install a signal handler to issue an Application.Terminate.
Is there a provided way that I missed?

BTW, also, they don't daemonize under Linux/run as service under
windows. Maybe they aren't supposed to?

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] External SIGSEGV when trying to use data module components

2015-04-11 Thread Luca Olivetti
El 11/04/15 a les 17:48, brian ha escrit:

 My problem is a simple one to describe - the program compiles
 correctly, but the moment I try to do anything with the objects in the
 data module, I get an immediate 'external SIGSEGV'. When I say do
 anything with them, this is as simple as adding a line of SQL to a
 query. 

Check in project options, forms that the datamodule is in the auto
create forms.

Also, if you're trying to use the datamodule in the OnCreate event
handler of the main form, that's going to cause a sigsev since the
datamodule hasn't been created yet. Use OnShow instead.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Release Candidate 1 of 1.4

2015-02-17 Thread Luca Olivetti
El 17/02/15 a les 12:25, Mattias Gaertner ha escrit:

 C:\lazextra\rx\tooledit.pas(109,15) Error: (3058) There is no method in
 an ances
 tor class to be overridden: TCustomRxDateEdit.Change;
 
 Have you seen this:
 http://wiki.lazarus.freepascal.org/Lazarus_1.4.0_release_notes#TEditButton_was_rewritten
 ?

No, but I just got the svn version of rxnew, and the author read it ;-)

 TLazPackageGraph.CompileRequiredPackages ERROR=Exit code 1
 ERROR: BuildLazarusIDE: Compile AutoInstall Packages failed.

 I had to interrupt it with CTRL+C
 
 It didn't stop automatically? Can you reproduce it?

I did it twice, I waited for a couple of minutes with no disk activity
then hit CTRL+C. I suppose that if I reinstall the broken version of rx
I can trigger it again...let me trymmh, it seems I cannot find a way
to install the broken package, make useride just uses the good version now.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Release Candidate 1 of 1.4

2015-02-17 Thread Luca Olivetti
El 17/02/15 a les 12:00, Luca Olivetti ha escrit:
 El 16/02/15 a les 23:38, Mattias Gaertner ha escrit:
 
 == How to test ==

 Download and install the 1.4RC1.
 - On Windows you can install as a 2ndary install, that will not affect your 
 current install:
   
 http://wiki.lazarus.freepascal.org/Multiple_Lazarus#Installation_of_multiple_Lazarus
 - On other platforms, if you install to a new location you need to use 
 --primary-config-path
 
 
 I used the svn copy and made a different test (note that I modified the
 useride target in the makefile to add the pcp):
 
 C:\laz_1_4make useride
 ./lazbuild.exe --pcp=config --lazarusdir=. --build-ide=
 SetPrimaryConfigPath NewValue=config - C:\laz_1_4\config
 primary config path: C:\laz_1_4\config\
 NOTE: Building Lazarus IDE with profile Build IDE with Packages
 TBuildManager.SetBuildTargetIDE OS=win32 CPU=i386 WS=win32
 ERROR: Broken dependency: camviewpkg 0.0camviewpkg 0.0
 make: *** [useride] Error 3
 
 
 I'll build a standard ide to see what happens, but the above procedure
 worked until now.

Sorry, that was a PEBKAC (just yesterday I removed one of the packages
to use the upstream one instead of what I cooked myself).
Now the make bigide is stuck (i.e. it doesn't proceed)

C:\lazextra\rx\tooledit.pas(109,15) Error: (3058) There is no method in
an ances
tor class to be overridden: TCustomRxDateEdit.Change;
C:\lazextra\rx\tooledit.pas(112,15) Error: (3058) There is no method in
an ances
tor class to be overridden: TCustomRxDateEdit.DoButtonClick(TObject);
C:\lazextra\rx\tooledit.pas(219,1) Fatal: (10026) There were 2 errors
compiling
module, stopping
Fatal: (1018) Compilation aborted
Error: C:\FPC\2.6.4\bin\i386-Win32\ppc386.exe returned an error exitcode
(normal
 if you did not specify a source file to be compiled)
Compiling package rxnew 2.4.2.120: stopped with exit code 1
(3104) Compiling C:\laz_1_4\components\jcf2\Settings\SetWordList.pas
(3104) Compiling C:\laz_1_4\components\jcf2\Settings\SetAlign.pas
(3104) Compiling C:\laz_1_4\components\jcf2\Settings\SetReplace.pas
(3104) Compiling C:\laz_1_4\components\jcf2\Settings\SetUses.pas
(3104) Compiling C:\laz_1_4\components\jcf2\Settings\SetPreProcessor.pas
TLazPackageGraph.CompileRequiredPackages ERROR=Exit code 1
ERROR: BuildLazarusIDE: Compile AutoInstall Packages failed.

I had to interrupt it with CTRL+C


 Oh, and I have a one line patch to dbgrids.pas, but Jesus didn't
 acknowledge it yet:
 
 http://bugs.freepascal.org/view.php?id=27232

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Developing on Linux with files on Windows NTFS {Solved]

2015-02-07 Thread Luca Olivetti
El 07/02/15 a les 02:18, Donald Ziesig ha escrit:


 one user on the computer).  I also took the suggestion to use separate
 directories for the windows and linux project files.  This separated the
 object and executable files between the two systems as well.


This shouldn't be necessary, just set

lib/$(TargetCPU)-$(TargetOS)

in the Unit output directory (-FU), under Project-Project
options-Compiler options-Paths

(which should be the default).


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] New Get Lazarus Initiative

2015-02-04 Thread Luca Olivetti
El 04/02/15 a les 13:19, Anthony Walter ha escrit:

 
 Then I need to fix the fpcmkcfg line to compensate for other preexisting
 versions of FPC which is reading fpc.cfg differently. In the interim

Yes, that's it: my fpc resides in /usr/bin so it's used before the newly
compiled one

 I've posted a new setup.sh which should temporarily put the new compiler
 first in the path giving it precedence. To try again use the following
 commands:
 
 rm -rf /home/luca/Development/FreePascal
 curl -L http://www.getlazarus.org/download/?platform=linux -o setup.sh
 sh setup.sh
 
 After setup is complete try:
 
 OLD_PATH=$PATH
 export PATH=/home/luca/Development/FreePascal/fpc/bin/:$PATH
 export PPC_CONFIG_PATH=/home/luca/Development/FreePascal/fpc/bin
 fpc -iV
 PATH=$OLD_PATH
 
 And let me know if it reads:
 
 3.0.1

I'll try.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] New Get Lazarus Initiative

2015-02-04 Thread Luca Olivetti
El 04/02/15 a les 06:00, Anthony Walter ha escrit:
 I am please to announce the launch of a new initiative to promote Free
 Pascal and Lazarus. The hub of this initiative is http://www.getlazarus.org
 
 The get Lazarus initiative aims to an reintroduce Lazarus to the
 software development world. To aide in this endeavor we've created our
 own special Lazarus bundles for Windows, Mac, and Linux with test
 versions of Free Pascal 3.0 Lazarus 1.4. We believe these bundles are
 the easiest Lazarus environments to install ever, and they won't
 interfere with your existing Free Pascal and Lazarus environments. We've
 also built-in support for full cross compile between platforms by default.

Even if I usually compile from svn, I gave it a try:

Extracting  lazarus/components
Extracting  lazarus

Everything is Ok

Folders: 736
Files: 8556
Size:   137119151
Compressed: 18295820
patching file components/ideintf/objectinspector.lfm
patching file components/ideintf/projectintf.pas
patching file ide/include/unix/lazbaseconf.inc
patching file ide/include/win/lazbaseconf.inc
patching file ide/main.pp
Hunk #1 succeeded at 2032 (offset 1 line).
patching file ide/mainintf.pas
patching file ide/projectdefs.pas
patching file ide/projectinspector.lfm
make -C packager/registration
make[1]: Entering directory
'/home/luca/Development/FreePascal/lazarus/packager/registration'
/usr/bin/rm -f ../units/x86_64-linux/fcllaz.ppu
/usr/bin/mkdir -p ../units/x86_64-linux
/usr/bin/ppcx64 -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -FE.
-FU../units/x86_64-linux -Cg -dx86_64 fcllaz.pas
Hint: (11030) Start of reading config file
/home/luca/Development/FreePascal/fpc/bin/fpc.cfg
Error: (11006) Illegal parameter: -FM/unicode/
Hint: (11007) -? writes help pages
Makefile:2299: recipe for target 'fcllaz.ppu' failed
make[1]: *** [fcllaz.ppu] Error 1
make[1]: Leaving directory
'/home/luca/Development/FreePascal/lazarus/packager/registration'
Makefile:3050: recipe for target 'registration' failed
make: *** [registration] Error 2
setup.sh: línea 207: ./lazbuild: El fitxer o directori no existeix
./lazbuild --lazarusdir=. --build-ide=
make: ./lazbuild: No se encontró el programa
Makefile:3076: recipe for target 'useride' failed
make: *** [useride] Error 127
strip: 'lazarus': No hay tal fichero
strip: 'lazbuild': No hay tal fichero
strip: 'startlazarus': No hay tal fichero

Free Pascal and Lazarus install complete

setup.sh: línea 239: ./lazarus: El fitxer o directori no existeix


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Deleting a control in its OnClick event can cause a SIGSEV?

2014-12-31 Thread Luca Olivetti
Hello,

I was having a random SIGSEV (random meaning it didn't happen every
time) in an OnClick event, the sigsev being always on the MouseUp
instruction in TControl.DoMouseUp (include/control.inc). It happened
both in windows and linux.
It turns out that in the OnClick event I was calling a method that freed
the control that generated the OnClick, so I supposed that was the cause
of the sigsev.
Now I use Application.QueueAsyncCall to fire the method after the event
has been executed and the SIGSEV seems to be gone, however, since it was
random, it may still reappear, unless the above hypothesis is true.
Is it possible that destroying the control was the cause of the SIGSEV?

TIA

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Typecast set to byte in mode OBJFPC

2014-12-31 Thread Luca Olivetti
El 31/12/14 a les 17:33, Jürgen Hestermann ha escrit:

 Is this realy compiler mode dependent?
 I can't find any documentation about this.
 Sorry, I meant that FlagSETType seems to be 4 bytes now.

http://www.freepascal.org/docs-html/prog/progsu59.html#x66-650001.2.59


Bye

-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deleting a control in its OnClick event can cause a SIGSEV?

2014-12-31 Thread Luca Olivetti
El 31/12/14 a les 19:26, Bart ha escrit:
 On 12/31/14, Luca Olivetti l...@wetron.es wrote:
 
 It turns out that in the OnClick event I was calling a method that freed
 the control that generated the OnClick, so I supposed that was the cause
 of the sigsev.
 
 Probably you are right.
 Been there, done that.

OK, thank you

 
 Now I use Application.QueueAsyncCall to fire the method after the event
 
 You can use Application.ReleaseComponent()
 (Was offered as a solution to me when I had the same problem)

Well, I'm doing a lot of other things in the method, so QueueAsyncCall
is more fitting.

 
 Is it possible that destroying the control was the cause of the SIGSEV?
 
 Yes

Phew, I'm relieved. You know, the system is going to go live next week.
I simulated around six months worth of operating cycles in a virtual
machine, but this problem appeared in the real hardware with a
configuration form (which isn't going to be used much but still has to
work) that never gave problems during previous testing.


Bye, and happy new year!
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-27 Thread Luca Olivetti
El 27/09/14 00:05, Giuliano Colla ha escrit:
 
 Il 26/09/2014 22:47, Luca Olivetti ha scritto:
 El 26/09/14 22:45, Luca Olivetti ha escrit:
 Strange, on mageia 4, kde, lazarus 1.2.4 it doesn't work. What I'm
 trying to do is to tile windows one next to the other. Using
 GetWindowRect under windows I can do it properly, while on linux gtk the
 windows overlap (i.e. with this layout


   A  B  C
   D  E

 A overlaps D and B overlaps E, the amount of overlap seems to be equal
 to the height of the title bar).
 Oh, and there's also a slight overlap between A-B, B-C and D-E

 
 Something which could affect your results is the timing. The window
 manager takes a time to add the decorations. Different window managers
 take different time. It's meant for human observers, which don't
 perceive a delay of some tens of milliseconds. Therefore it's given a
 low priority (and the mechanism is quite different from Windows to
 Linux). If you ask the size too early, you get a size which has not yet
 been adjusted.
 
 You may verify if the function works properly by adding somewhere in
 your form a button and a label, and with the onClick of the button write
 in the label caption both the result of GetWindowSize and of
 GetWindowRect. You can't possibly push the button faster than the time
 it takes the window manager to decorate your window!

I'm puzzled: with a test program I see no difference in the size in both
cases (right after showing the form and after pressing the button) *and*
the size is the right one (in FormShow is always 1,1 btw).
I must be doing something else wrong (though the tiling is the correct
on under windows, mmmh..).
Oh, well, this program has to work in windows only, so I'll just
consider it a documentation error and go on with my life ;-)

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-27 Thread Luca Olivetti
El 27/09/14 11:48, Hans-Peter Diettrich ha escrit:
 Luca Olivetti schrieb:
 
 Strange, on mageia 4, kde, lazarus 1.2.4 it doesn't work. What I'm
 trying to do is to tile windows one next to the other. Using
 GetWindowRect under windows I can do it properly, while on linux gtk the
 windows overlap (i.e. with this layout


  A  B  C
  D  E

 A overlaps D and B overlaps E, the amount of overlap seems to be equal
 to the height of the title bar).
 
 IIRC the Linux (X11) window managers communicate only the size of the
 client area to the widgetsets, so that attempts to derive the total
 window extent from this information are subject to assumptions about the
 extent of the window decoration (caption, theme...). They also don't
 allow (offer no means for) ownerdraw of the NC area of a window.

Yes, but see my other mail to Giuliano: GetWindowRect seems to be
finding the correct total size (including decoration).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-27 Thread Luca Olivetti
El 27/09/14 12:09, Luca Olivetti ha escrit:
 
 I'm puzzled: with a test program I see no difference in the size in both
 cases (right after showing the form and after pressing the button) *and*
 the size is the right one (in FormShow is always 1,1 btw).
 I must be doing something else wrong (though the tiling is the correct
 on under windows, mmmh..).

Found it, nothing wrong on my part: the test program used an auto
created form, the real application creates the form at run time *and*
right after creating the form, after the show GetWindowRect only returns
the client size. I have to introduce a delay for it to return the whole
window's size (and even then, from time to time, it only returns the
client size), so you were correct and this is insane.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-27 Thread Luca Olivetti
El 27/09/14 12:23, Luca Olivetti ha escrit:
 El 27/09/14 12:09, Luca Olivetti ha escrit:

 I'm puzzled: with a test program I see no difference in the size in both
 cases (right after showing the form and after pressing the button) *and*
 the size is the right one (in FormShow is always 1,1 btw).
 I must be doing something else wrong (though the tiling is the correct
 on under windows, mmmh..).
 
 Found it, nothing wrong on my part: the test program used an auto
 created form, the real application creates the form at run time *and*
 right after creating the form, after the show GetWindowRect only returns
 the client size. I have to introduce a delay for it to return the whole
 window's size (and even then, from time to time, it only returns the
 client size), so you were correct and this is insane.

And, for the record, with qt it's the same (only it seems the delay have
to be bigger).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-27 Thread Luca Olivetti
El 27/09/14 14:32, zeljko ha escrit:
 On 09/27/2014 12:26 PM, Luca Olivetti wrote:
 El 27/09/14 12:23, Luca Olivetti ha escrit:
 El 27/09/14 12:09, Luca Olivetti ha escrit:

 I'm puzzled: with a test program I see no difference in the size in
 both
 cases (right after showing the form and after pressing the button)
 *and*
 the size is the right one (in FormShow is always 1,1 btw).
 I must be doing something else wrong (though the tiling is the correct
 on under windows, mmmh..).

 Found it, nothing wrong on my part: the test program used an auto
 created form, the real application creates the form at run time *and*
 right after creating the form, after the show GetWindowRect only returns
 the client size. I have to introduce a delay for it to return the whole
 window's size (and even then, from time to time, it only returns the
 client size), so you were correct and this is insane.

 And, for the record, with qt it's the same (only it seems the delay have
 to be bigger).
 
 Under X11 nobody knows exact window size (except client size setted up
 by LCL or widgetset) until window is decorated by wm (read mapped -
 shown on screen). See
 http://qt-project.org/doc/qt-4.8/application-windows.html#x11-peculiarities

Yes, I understand, the insanity I referred to was about the underlying
environment, not Lazarus.
Anyway, I tried with this snipped of code to measure the decoration

procedure TForm1.Button1Click(Sender: TObject);
var f:TForm;
i:integer;
wr: TRect;
h: Integer;
w: Integer;
begin
  f:=TForm.Create(nil);
  f.top:=1;
  f.left:=1;
  f.width:=100;
  f.height:=100;
  f.show;
  i:=0;
  while true do
  begin
Application.ProcessMessages;
GetWindowRect(f.Handle,wr);
h:=wr.bottom-wr.top;
w:=wr.Right-wr.left;
if (wf.width) and (hf.height) then
  break;
i:=i+1;
if i1000 then
  break;
  end;
  Label1.Caption:=format('%d  w:%d h:%d',[i,w-f.width,h-f.height]);
  f.free;
end;


The f.top and f.left assignment was a (futile) attempt to avoid flashing
the form on screen.
With gtk2 2 I consistently get the result at the first iteration (i=0),
while with qt it takes at least 2 cycles, on occasions i counted up to 20.
Just FYI.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] GetWindowSize misleading documentation or bug?

2014-09-26 Thread Luca Olivetti
I was looking for a (hopefullyu) cross platform way to know the
whole size of a window, including its decoration and I found this:

http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/getwindowsize.html

the documentation on that page reflect what I see on the tooltip in
lazarus (1.2.4), *but* the implementation (at least win32) actually
removes the size of the borders and the caption.
Is the documentation wrong or is it a bug?
Btw: GetWindowRect returns the whole size in windows but not with gtk2.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-26 Thread Luca Olivetti
El 26/09/14 20:47, Giuliano Colla ha escrit:

 I was too hasty in my reply. After some tests here are the results:

Yes, I was puzzled when you said it didn't work in an xp vm, since
that's exactly the configuration I tested

 
 GetWindowSize returns the window client area in all platforms.
 
 GetWindowRect here returns the full window area (decoration and borders
 included) in all the configurations tested:
 
 Windows XP running in a VM under Linux, with Lazarus 1.2.4
 Linux CentOs 6, Gtk2 and Qt, desktop KDE and XFce, Lazarus 1.2.2 and
 Lazarus 1.3 (trunk)

Strange, on mageia 4, kde, lazarus 1.2.4 it doesn't work. What I'm
trying to do is to tile windows one next to the other. Using
GetWindowRect under windows I can do it properly, while on linux gtk the
windows overlap (i.e. with this layout


 A  B  C
 D  E

A overlaps D and B overlaps E, the amount of overlap seems to be equal
to the height of the title bar).


 
 Apparently the documentation isn't accurate, and there's a mix-up of the
 two functions

So in theory GetWindowRect is the right function while GetWindowSize
is redundant (since there's already width and height)?


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetWindowSize misleading documentation or bug?

2014-09-26 Thread Luca Olivetti
El 26/09/14 22:45, Luca Olivetti ha escrit:
 El 26/09/14 20:47, Giuliano Colla ha escrit:
 
 I was too hasty in my reply. After some tests here are the results:
 
 Yes, I was puzzled when you said it didn't work in an xp vm, since
 that's exactly the configuration I tested
 

 GetWindowSize returns the window client area in all platforms.

 GetWindowRect here returns the full window area (decoration and borders
 included) in all the configurations tested:

 Windows XP running in a VM under Linux, with Lazarus 1.2.4
 Linux CentOs 6, Gtk2 and Qt, desktop KDE and XFce, Lazarus 1.2.2 and
 Lazarus 1.3 (trunk)
 
 Strange, on mageia 4, kde, lazarus 1.2.4 it doesn't work. What I'm
 trying to do is to tile windows one next to the other. Using
 GetWindowRect under windows I can do it properly, while on linux gtk the
 windows overlap (i.e. with this layout
 
 
  A  B  C
  D  E
 
 A overlaps D and B overlaps E, the amount of overlap seems to be equal
 to the height of the title bar).

Oh, and there's also a slight overlap between A-B, B-C and D-E


 
 

 Apparently the documentation isn't accurate, and there's a mix-up of the
 two functions
 
 So in theory GetWindowRect is the right function while GetWindowSize
 is redundant (since there's already width and height)?
 
 
 Bye
 


-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Why lazchmhelp.pas sets InheritHandle conditionally on fpc version?

2014-09-02 Thread Luca Olivetti
I saw in the 1.2.4 source this:

{$if FPC_FULLVERSION20604}
Proc.InheritHandles := false;
{$endif}


Why is it conditional?
Maybe I'm biased by my bad experience with it being true by default, but
I think it should be always set to false (apart from the fact that it
didn't work in fpc, and it has been fixed exactly in 2.6.4, making the
above completely useless).

BTW, in my local copy I also modify lazhelphtml.pas


--- lcl/lazhelphtml.pas (revisión: 45586)
+++ lcl/lazhelphtml.pas (copia de trabajo)
@@ -367,6 +367,7 @@
   try
 BrowserProcess:=TProcessUTF8.Create(nil);
 try
+  BrowserProcess.InheritHandles:=false;
   BrowserProcess.CommandLine:=CommandLine;
   BrowserProcess.Execute;
 finally

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Why lazchmhelp.pas sets InheritHandle conditionally on fpc version?

2014-09-02 Thread Luca Olivetti
El 02/09/14 11:19, Mattias Gaertner ha escrit:
 On Tue, 02 Sep 2014 09:54:50 +0200
 Luca Olivetti l...@wetron.es wrote:
 
 I saw in the 1.2.4 source this:

 {$if FPC_FULLVERSION20604}
 Proc.InheritHandles := false;
 {$endif}


 Why is it conditional?
 
 It is not conditional in 1.3.

[...]

 1.3 has the above code.

I should have checked trunk.

Thank you
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Grey windows in Lazarus IDE with GTK2 in Mint 17 + KDE

2014-08-18 Thread Luca Olivetti
El 18/08/14 23:14, Juha Manninen ha escrit:
 I suspect this is yet another GTK2 version related bug. Has anybody seen it?
 
 When opening a modal window like the About box, other windows turn
 grey because they are
 disabled. That is OK.
 After closing the modal window they still remain grey although they work OK.
 Only minimizing and then restoring the IDE helps bring the normal color back.

Yes, same here with mageia 4 (x86_64), kde desktop, lazarus 1.2.4.
gtk is 2.24.22.
It didn't happen with mageia 3 (gtk 2.24.17).


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Memory leak hunt request

2014-05-04 Thread Luca Olivetti
El 04/05/14 14:42, Reinier Olislagers ha escrit:

 I suppose what I am a bit baffled by is that you can see the property
 access via fList.Text but the call stack does not show you the actual
 call (fList:=TStringList.Create) that creates the memleak...

Maybe because of this?
http://bugs.freepascal.org/view.php?id=12528

Bye

-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread Luca Olivetti
El 19/04/14 17:37, David Taylor ha escrit:

 Can anyone help with this apparently simple problem?

lazutf8sysutils has a NowUTC function already defined

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Now function - returning UTC?

2014-04-19 Thread Luca Olivetti
El 19/04/14 20:55, Luca Olivetti ha escrit:
 El 19/04/14 17:37, David Taylor ha escrit:
 
 Can anyone help with this apparently simple problem?
 
 lazutf8sysutils has a NowUTC function already defined

BTW, the name of the unit isn't really meaningful (NowUTC and
GetTickCount64, the only 2 functions defined in that unit, don't seem to
have any relation with utf8).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Always On Top (Linux) ZVDatetimeCtrls doesn't show up(Bug?)

2014-04-14 Thread Luca Olivetti
El 14/04/14 08:37, Juha Manninen ha escrit:
 ZVDatetimeCtrls is now included in Lazarus trunk sources and the
 component names are identical with Delphi component names.
 The report and possible example code should be done for that version.

FWIW it also happens with a TDateEdit (lazarus 1.2.0/gtk).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Always On Top (Linux) ZVDatetimeCtrls doesn't show up(Bug?)

2014-04-14 Thread Luca Olivetti
El 14/04/14 09:32, Luca Olivetti ha escrit:
 El 14/04/14 08:37, Juha Manninen ha escrit:
 ZVDatetimeCtrls is now included in Lazarus trunk sources and the
 component names are identical with Delphi component names.
 The report and possible example code should be done for that version.
 
 FWIW it also happens with a TDateEdit (lazarus 1.2.0/gtk).

Same with qt

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] about raised exception class 'External: SIGSEGV'

2014-04-14 Thread Luca Olivetti
El 14/04/14 12:49, FreeMan ha escrit:
 
 Hello,
 I get this errors some time, I can not handle this error so I don't know
 why raised.
  
 Project myproject raised exception class 'External: SIGSEGV'. - Ok and
 continue to run application

It's an access to unallocated memory or trying to use a class instance
that doesn't exist (i.e. it is nil).
Since I don't know your program, maybe one of the FieldByName call is
returning nil (i.e., a field with that name doesn't exist, so either the
IsNull or the AsInteger would generate a SIGSEV:

 if not QUE_1.FieldByName('UNQ_ID').IsNull and
 (QUE_1.FieldByName('UNQ_ID').AsInteger=0)then
 Unq_id := QUE_1.FieldByName('UNQ_ID').AsInteger
 else Unq_id := -1;
 QUE_1.Close;
 QUE_1.Open;
 if Unq_id-1then QUE_1.Locate('UNQ_ID', Unq_id, []);
 
 if not QUE_2.FieldByName('UNQ_ID').IsNull and
 (QUE_2.FieldByName('UNQ_ID').AsInteger=0)then
 Unq_id := QUE_2.FieldByName('UNQ_ID').AsInteger
 else Unq_id := -1;

 try-except not handle this error. 

No currently it doesn't :-(
Note that in most cases when hitting such an error the only sensible
option would be to terminate the program, but I'd like to intercept the
exception and log it to a file before terminating the program, so I can
do a post-mortem and see where the SIGSEV occurred.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] about raised exception class 'External: SIGSEGV'

2014-04-14 Thread Luca Olivetti
El 14/04/14 16:26, FreeMan ha escrit:

 I understood you, I was sent my code, its out off my code, Maybe Grid
 has a problem,
 Q.Close;
 Q.Open; and query so fast close  open, can not grid be fast like that ?

I don't think the problem is the grid, but I could be wrong.
Note that, while fpc doesn't see this exception, gdb does, so you can
try to run your code from lazarus (with gdb) and see where the SIGSEV is
generated.

 No currently it doesn't 
 Note that in most cases when hitting such an error the only sensible
 option would be to terminate the program, but I'd like to intercept the
 exception and log it to a file before terminating the program, so I can
 do a post-mortem and see where the SIGSEV occurred.
 
 Can you explain little bir more please? sorry for my poor english

Well, a SIGSEV usually means that you cannot rely on the contents of
memory, so recovery is probably impossible.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 09:08, Michael Van Canneyt ha escrit:
 
 
 On Tue, 1 Apr 2014, Mattias Gaertner wrote:
 
 On Tue, 01 Apr 2014 12:20:53 +0200
 Luca Olivetti l...@wetron.es wrote:

 [...]
 function GetTickCount64: QWord;
 var
   tp: timespec;
 begin
   clock_gettime(CLOCK_MONOTONIC, @tp);
   Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_nsec div 100);
 end;
 [...]

 Thanks. GetTickCount64 now uses it on Linux.
 
 The implementation in Sysutils now does so too, and uses a fallback
 using gettimeofday.

I checked the revision and it looks wrong: fpgettimeofday uses a
TTimeVal (resolution microseconds), while clock_gettime uses TTimeSpec
(resolution nanoseconds). A suitable (I think) fallback could be
CLOCK_REALTIME, e.g.


var
  ts:TTimeSpec;
begin
{$IFDEF HAVECLOCKGETTIME}
  if clock_gettime(CLOCK_MONOTONIC, @ts)0 then
{$ENDIF}
  clock_gettime(CLOCK_REALTIME,@ts);
  Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
end;

The problem is that the clock_gettime function is only defined for linux
(isn't it supposed to be available in any posix system?) so maybe:

var
  tv:TTimeVal;
{$IFDEF HAVECLOCKGETTIME}
  ts:TTimeSpec;
{$ENDIF}
begin
{$IFDEF HAVECLOCKGETTIME}
  if clock_gettime(CLOCK_MONOTONIC, @ts)=0 then
  begin
Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
exit;
  end;
{$ENDIF}
  clock_gettime(CLOCK_REALTIME,@tv);
  Result := (Int64(tv.tv_sec) * 1000) + (tv.tv_usec div 1000);
end;


Btw, in theory CLOCK_MONOTONIC_RAW should be even better, though it's
only available from linux 2.6.28

var
  tv:TTimeVal;
{$IFDEF HAVECLOCKGETTIME}
  r:cint;
  ts:TTimeSpec;
{$ENDIF}
begin
{$IFDEF HAVECLOCKGETTIME}
  r:=clock_gettime(CLOCK_MONOTONIC_RAW, @ts);
  if r0 then
r:=clock_gettime(CLOCK_MONOTONIC, @ts)=0;
  if r=0 then
  begin
Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
exit;
  end;
{$ENDIF}
  clock_gettime(CLOCK_REALTIME,@tv);
  Result := (Int64(tv.tv_sec) * 1000) + (tv.tv_usec div 1000);
end;


and then there's CLOCK_MONOTONIC_COARSE..


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 09:47, Luca Olivetti ha escrit:
 El 02/04/14 09:08, Michael Van Canneyt ha escrit:


 On Tue, 1 Apr 2014, Mattias Gaertner wrote:

 On Tue, 01 Apr 2014 12:20:53 +0200
 Luca Olivetti l...@wetron.es wrote:

 [...]
 function GetTickCount64: QWord;
 var
   tp: timespec;
 begin
   clock_gettime(CLOCK_MONOTONIC, @tp);
   Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_nsec div 100);
 end;
 [...]

 Thanks. GetTickCount64 now uses it on Linux.

 The implementation in Sysutils now does so too, and uses a fallback
 using gettimeofday.
 
 I checked the revision and it looks wrong: fpgettimeofday uses a
 TTimeVal (resolution microseconds), while clock_gettime uses TTimeSpec
 (resolution nanoseconds). A suitable (I think) fallback could be
 CLOCK_REALTIME, e.g.

Oops, the fallback after the {$ENDIF} in the second and third version
was supposed to call fpgettimeofday, but you get the idea

 
 
 var
   ts:TTimeSpec;
 begin
 {$IFDEF HAVECLOCKGETTIME}
   if clock_gettime(CLOCK_MONOTONIC, @ts)0 then
 {$ENDIF}
   clock_gettime(CLOCK_REALTIME,@ts);
   Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
 end;
 
 The problem is that the clock_gettime function is only defined for linux
 (isn't it supposed to be available in any posix system?) so maybe:
 
 var
   tv:TTimeVal;
 {$IFDEF HAVECLOCKGETTIME}
   ts:TTimeSpec;
 {$ENDIF}
 begin
 {$IFDEF HAVECLOCKGETTIME}
   if clock_gettime(CLOCK_MONOTONIC, @ts)=0 then
   begin
 Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
 exit;
   end;
 {$ENDIF}
   clock_gettime(CLOCK_REALTIME,@tv);

fpgettimeofday(@tv, nil);


   Result := (Int64(tv.tv_sec) * 1000) + (tv.tv_usec div 1000);
 end;
 
 
 Btw, in theory CLOCK_MONOTONIC_RAW should be even better, though it's
 only available from linux 2.6.28
 
 var
   tv:TTimeVal;
 {$IFDEF HAVECLOCKGETTIME}
   r:cint;
   ts:TTimeSpec;
 {$ENDIF}
 begin
 {$IFDEF HAVECLOCKGETTIME}
   r:=clock_gettime(CLOCK_MONOTONIC_RAW, @ts);
   if r0 then
 r:=clock_gettime(CLOCK_MONOTONIC, @ts)=0;
   if r=0 then
   begin
 Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 100);
 exit;
   end;
 {$ENDIF}
   clock_gettime(CLOCK_REALTIME,@tv);

fpgettimeofday(@tv, nil);


   Result := (Int64(tv.tv_sec) * 1000) + (tv.tv_usec div 1000);
 end;
 
 
 and then there's CLOCK_MONOTONIC_COARSE..
 
 
 Bye
 


-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 10:01, Mattias Gaertner ha escrit:
 On Wed, 02 Apr 2014 09:47:45 +0200
 Luca Olivetti l...@wetron.es wrote:
 
 [...]
 Btw, in theory CLOCK_MONOTONIC_RAW should be even better, though it's
 only available from linux 2.6.28
 
 CLOCK_MONOTONIC_RAW lacks the fixes by NTP.

Isn't that's desirable for the semantic of GetTickCount?

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 13:10, Mattias Gaertner ha escrit:

 CLOCK_MONOTONIC_RAW would better emulate the WinAPI
 function GetTickCount. 

Well, yes, isn't that the function we're trying to emulate?

(note that I personally don't need the precision, for me
CLOCK_MONOTONIC_COARSE would probably be more than enough).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 14:28, Mattias Gaertner ha escrit:

 Sigh. Again: CLOCK_MONOTONIC is monotonic. It does not go
 backwards and especially it does not apply timezone, daylight or user
 time changes. It only fixes shortcomings of the machine counters.

It's not supposed to go backward, but in some versions of the kernel it
appears that it did:

http://stackoverflow.com/questions/3657289/linux-clock-gettimeclock-monotonic-strange-non-monotonic-behavior

See also
http://stackoverflow.com/questions/14270300/what-is-the-difference-between-clock-monotonic-clock-monotonic-raw

I also read (I think on stackoverflow but I cannot find the page right
now), that one doesn't take into account the time during a suspension
while the other does (I don't remember which is which) and that's an
important difference depending on the application.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-02 Thread Luca Olivetti
El 02/04/14 14:29, Marco van de Voort ha escrit:
 On Wed, Apr 02, 2014 at 01:19:39PM +0200, Luca Olivetti wrote:
 CLOCK_MONOTONIC_RAW would better emulate the WinAPI
 function GetTickCount. 

 Well, yes, isn't that the function we're trying to emulate?

 (note that I personally don't need the precision, for me
 CLOCK_MONOTONIC_COARSE would probably be more than enough).
 
 I don't see _RAW and _COARSE anywhere in the mentioned opengroup link.
 Keep in mind this is UNIX gettickcount, not linux gettickcount.


Correct, but the function clock_gettime is currently only defined for
Linux (at least I grepped the sources for fpc 2.6.4 and only found it
there).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-01 Thread Luca Olivetti
I use GetTickCount a lot to keep track of timeouts.
On windows, it is guaranteed to be monotonic, so my usual

  if GetTickCount-StartTimeTimeout then..

works fine (yes, even when the time wraps around, provided StartTime is
defined as DWORD and Timeout is smaller than a DWORD, of course I could
use GetTickCount64 but usually the 32bits version is enough).

For unix the implementation uses fpgettimeofday but that's not
monotonic, so it could break the above code.

For linux a more accurate implementation could be

function GetTickCount64: QWord;
var
  tp: timespec;
begin
  clock_gettime(CLOCK_MONOTONIC, @tp);
  Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_nsec div 100);
end;


And I say linux because CLOCK_MONOTONIC is only defined there in fpc,
though it should be available even in other systems:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Better implementation of GetTickcount using clock_gettime

2014-04-01 Thread Luca Olivetti
El 01/04/14 20:03, Mattias Gaertner ha escrit:
 On Tue, 01 Apr 2014 12:20:53 +0200
 Luca Olivetti l...@wetron.es wrote:
 
 [...]
 function GetTickCount64: QWord;
 var
   tp: timespec;
 begin
   clock_gettime(CLOCK_MONOTONIC, @tp);
   Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_nsec div 100);
 end;
 [...]
 
 Thanks. GetTickCount64 now uses it on Linux.

Wow, that was fast. Thank you.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Confused by help

2014-03-23 Thread Luca Olivetti
El 23/03/14 19:06, Graeme Geldenhuys ha escrit:
 On 2014-03-22 19:35, Luca Olivetti wrote:
 You just have to create a class derived from THelmManager (in unit
 HelpIntfs).
 
 
 Thanks for that info.
 
 
 On a side note:
 I see the Lazarus team still didn't update the OnHelp event - which uses
 the event signature written for Windows 3.1 help viewers (also showing
 Delphi's ancestry). I have suggested in the past they take up the Kylix
 3 OnHelp signature (shown below) which makes a lot more sense for
 cross-platform, newer or custom written help systems.
 
 type
  THelpEvent = function (HelpType: THelpType; HelpContext: Integer;
 HelpKeyword: string; HelpFile: string; var Handled: Boolean): Boolean of
 object;

While that is true for the OnHelp event, by subclassing THelpManager you
can bypass it and actually query by keyword or context.
Not as straightforward but it's possible.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Confused by help

2014-03-22 Thread Luca Olivetti
El 22/03/14 19:59, Graeme Geldenhuys ha escrit:

 So you can define numerical or keyword help inside your application -
 just like you would do with LCL or VCL applications. I don't know if you
 can override the default help viewer in LCL based apps.

Sure you can.
You just have to create a class derived from THelmManager (in unit
HelpIntfs).
I use it to invoke a pdf reader (sumatrapdf, since it accepts a keyword
as a command line parameter).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to access C and C++ libraries?

2014-03-06 Thread Luca Olivetti
El 06/03/14 20:31, Chavoux Luyt ha escrit:

 Now I am wondering about writing a simple Lazarus GUI to the Telegram
 API (all C header files, AFAICT) on Linux (and maybe Windows, if not too
 difficult to port). Any gotchas to keep in mind for using C and C++
 libraries from Lazarus/Free Pascal (on Linux and maybe Windows) or good
 guides?

Take a look here
ftp://ftp.freepascal.org/fpc/docs-pdf/CinFreePascal.pdf

and here
http://wiki.lazarus.freepascal.org/Creating_bindings_for_C_libraries

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Second Release Candidate, 1.2RC2

2014-02-14 Thread Luca Olivetti
El 14/02/14 00:21, Mattias Gaertner ha escrit:
 On Thu, 13 Feb 2014 20:17:31 +0100
 Luca Olivetti l...@wetron.es wrote:
 
 [...]
 TBuildManager.DoCheckIfProjectNeedsCompilation icon has changed Project
 /home/luca/Datos/1354_vision_dot/programas_pc/test_plc/project1.ico

 don't know why (I didn't change it but the date changes every time I try
 to run the project).
 
 Fixed. Please test.

It works, thank you!
(Note that I just took ide/buildmanager.pas and ide/projecticon.pas from
svn revision 44062).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Second Release Candidate, 1.2RC2

2014-02-13 Thread Luca Olivetti
El 13/01/14 18:34, Mattias Gaertner ha escrit:
 The Lazarus team would like to announce the second Release Candidate for the 
 upcoming Version 1.2.

...

I don't know if it's a known problem or it has already been reported,
but even with the option Always build (even if nothing changed)
unchecked, every time I try to run it recompiles and relinks.
These are the messages (hidden and shown) in the messages window:

(under windows)

Hint: Start of reading config file C:\FPC\2.6.2\bin\i386-Win32\fpc.cfg
Hint: End of reading config file C:\FPC\2.6.2\bin\i386-Win32\fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling project1.lpr
project1.lpr(10,10) Hint: Unit nodavelib not used in project1
project1.lpr(10,21) Hint: Unit synapse not used in project1
project1.lpr(10,48) Hint: Unit datos not used in project1
Compiling resource
D:\1354_vision_dot\programas_pc\test_plc\lib\i386-win32\project1.or
Linking project1.exe
20 lines compiled, 5.3 sec , 1420768 bytes code, 379340 bytes data
5 hint(s) issued
Project project1 successfully built

(under linux)

Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/07/06] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling project1.lpr
project1.lpr(10,10) Hint: Unit nodavelib not used in project1
project1.lpr(10,21) Hint: Unit synapse not used in project1
project1.lpr(10,48) Hint: Unit datos not used in project1
Compiling resource
/home/luca/Datos/1354_vision_dot/programas_pc/test_plc/lib/x86_64-linux/project1.or
Linking project1
/usr/bin/ld: aviso: link.res contiene secciones de salida. ¿Olvidó -T?
20 lines compiled, 1.4 sec
5 hint(s) issued
Project project1 successfully built


Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Second Release Candidate, 1.2RC2

2014-02-13 Thread Luca Olivetti
El 13/02/14 19:22, Mattias Gaertner ha escrit:
 
 Please create a bug report.

Fist I want to be sure is not a PEBKAC ;-)

  
 (under windows)

 Hint: Start of reading config file C:\FPC\2.6.2\bin\i386-Win32\fpc.cfg
 Hint: End of reading config file C:\FPC\2.6.2\bin\i386-Win32\fpc.cfg
 
 Please start the IDE with the command line
 parameter --debug-log=log.txt. This will log why it recompiles.

TBuildManager.DoCheckIfProjectNeedsCompilation icon has changed Project
/home/luca/Datos/1354_vision_dot/programas_pc/test_plc/project1.ico

don't know why (I didn't change it but the date changes every time I try
to run the project).

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] CopyFile in Windows

2013-11-11 Thread Luca Olivetti
Al 11/11/13 18:14, En/na Jürgen Hestermann ha escrit:
 
 So either you remove the windows unit or, if not possible,
 you need to fully qualify from which unit you want to call CopyFile (I
 don't know where it's defined).

in FileUtil.
Note that, differently than the windows CopyFile function (which returns
an error code), FileUtil.CopyFile will throw an exception in case of error.

Bye

-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Release Candidate 1 of 1.2

2013-11-07 Thread Luca Olivetti
Al 06/11/13 20:10, En/na Mattias Gaertner ha escrit:

 Once the release is out we will have to be more selective about which fixes 
 can be merged for further 1.2.x releases. 

I didn't test it yet (doing it now), but I suggest a simple fix that
doesn't warrant a bug report

--- C:/Documents and Settings/luca/Configuración
local/Temp/lazhelphtml.pas-revBASE.svn000.tmp.pas   Fri May 24 19:30:06 2013
+++ C:/laz_1_2/lcl/lazhelphtml.pas  Mon Sep 23 14:16:50 2013
@@ -365,10 +365,11 @@

   // run
   try
 BrowserProcess:=TProcessUTF8.Create(nil);
 try
+  BrowserProcess.InheritHandles:=false;
   BrowserProcess.CommandLine:=CommandLine;
   BrowserProcess.Execute;
 finally
   BrowserProcess.Free;
 end;



Unfortunately the default for InheritHandles is true, and while the
above has no effect until this bug in fpc is fixed
http://bugs.freepascal.org/view.php?id=22271
I don't think the spawned browser needs to inherit the handles of the
calling process.
In fact InheritHandles true caused me serious problems in the past.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus Release Candidate 1 of 1.2

2013-11-07 Thread Luca Olivetti
Al 07/11/13 09:47, En/na Michael Van Canneyt ha escrit:

 Unfortunately the default for InheritHandles is true, and while the
 above has no effect until this bug in fpc is fixed
 http://bugs.freepascal.org/view.php?id=22271
 
 I was not aware of this bugreport. I fixed it. It is probably a
 copy-paste bug, because the value is set to true in the constructor.

Thank you.
Will it be backported to 2.6.4?

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] WriteLn back to the GUI

2013-10-23 Thread Luca Olivetti
Al 23/10/13 21:01, En/na ListMember ha escrit:

 
 I could use the sample code you posted a link to (and, thank you also
 for that), and I adapted it to use TMemo for my use.
 
 But, why would I have to write 100+ lines of code just to capture the
 output of WriteLn.

You already did that and it works, right? So what's the problem?
 
 Plus, I keep getting segfaults when I close the application --something
 is calling InOutFunc when the app closes and still tries to write to a
 destroyed TMemo.

add a call to CloseFile(Output) to the form OnDestroy event.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Lazarus, Jedi etc.

2013-07-15 Thread Luca Olivetti
Al 15/07/13 15:12, En/na Mark Morgan Lloyd ha escrit:

 There was also a requirement to interface to PLCs etc. (using, I'm told,
 the nodave library)

For the record, libnodave works wonderfully with fpc.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-06-12 Thread Luca Olivetti
Al 13/05/13 11:37, En/na Juha Manninen ha escrit:
From Patrick Chevalley :
 If using the default Gtk theme oxygen-gtk there is no icon.
 By setting another theme (Clearlooks, qtcurve) all the menu have an icon.
 
 I can confirm that. All the problem are gone after switching to
 Raleigh Gtk2 theme (I don't have other choices there. Clearlooks
 etc. are KDE themes).
 
 These output lines were clearly related to the problem, they are also gone 
 now :
 
 (lazarus:10785): Gdk-WARNING **: Attempt to draw a drawable with depth
 24 to a drawable with depth 32
 
 The other problems, namely the dim Color dropdown list and the cut-off
 file name in editor tab's hint, are also cured by changing the Gtk2
 theme in KDE.

Just tried with with lazarus-1.0.10 and I can say these problems are
only there with oxygen-gtk.
The only problem is that the Raleigh theme is hideous :-/ especially in
a kde desktop.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 09:37, En/na Mattias Gaertner ha escrit:
 On Mon, 13 May 2013 06:51:18 +0100
 tim launchbury t...@tlaunchbury.ukfsn.org wrote:
 

 Hi all

 I have the same problem as Juha with the menu icons having dissapeared.
 This is on 64 bit Mageia Linux with the latest lazarus and fpc from svn.
 
 Do you use KDE or Gnome?
 Do you run the gtk2 or the qt version of Lazarus?
 When has it worked?

I'm not the original poster but I'm using mageia 2 64 bits too and I
just noticed the same problem (but with lazarus 1.0.8), however, the
colours in the colour selection combo-box are not washed up, they're
just transparent (I can see through the text that lies below).
I'm using kde and the gtk2 version of Lazarus.
Kde applications have icons in the menus, as do other gtk2 applications
(like, e.g. thunderbird)

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 10:35, En/na Mattias Gaertner ha escrit:

 
 For those who think that their gtk settings is treated wrong by the
 LCL and want to debug it:
 
 The code is in 
 lcl/interfaces/gtk2/gtk2themes.pas
 
 function TGtk2ThemeServices.GetOption
 and
 procedure MenuImagesChange

I created an application with a menu, put a breakpoint on those
functions and they are not called.
Just to be sure breakpoints are working, I also put one in InitThemes
and it stops there as it should.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 10:51, En/na Luca Olivetti ha escrit:
 Al 13/05/13 10:35, En/na Mattias Gaertner ha escrit:
 

 For those who think that their gtk settings is treated wrong by the
 LCL and want to debug it:

 The code is in 
 lcl/interfaces/gtk2/gtk2themes.pas

 function TGtk2ThemeServices.GetOption
 and
 procedure MenuImagesChange
 
 I created an application with a menu, put a breakpoint on those
 functions and they are not called.
 Just to be sure breakpoints are working, I also put one in InitThemes
 and it stops there as it should.

I added a TApplicationProperties to the form, set ShowMenuGlyphs to
sbgSystem, now GetOption is called and the result is 1, however no
glyphs are shown.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 11:34, En/na Paul Ishenin ha escrit:
 13.05.2013 17:04, Luca Olivetti пишет:
 
 I added a TApplicationProperties to the form, set ShowMenuGlyphs to
 sbgSystem, now GetOption is called and the result is 1, however no
 glyphs are shown.
 
 Maybe you can find something useful here:
 
 http://lazarus-dev.blogspot.ru/2009/05/changes-with-button-glyphs.html

Yes, I remembered something similar, that's why I added it. However,
even with the default setting (sbgAlways) the menu glyphs aren't shown
(glyphs in buttons are OK).


Bye


-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 11:37, En/na Juha Manninen ha escrit:

 I guess this happens only with KDE 4.10.x. I updated my Mint 14 for
 KDE 4.10 and the problem may have started then. It is not dependent on
 Lazarus revision.
 Can others confirm to have KDE 4.10?

kde 4.8.5 in mageia 2.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 16:03, En/na tim launchbury ha escrit:
 On Mon, 13 May 2013 16:12:07 +0300
 Juha Manninen juha.mannine...@gmail.com wrote:
 
 Based on Tim's and Luca's posts KDE is not related to the problem.
 However 64-bit OS is related. Can others confirm it?

 Anyone else saw these lines in stderr :

  (lazarus:10785): Gdk-WARNING **: Attempt to draw a drawable with
 depth 24 to a drawable with depth 32

 They show in the same console you started Lazarus from.
 
 I can confirm that I also get this message

Me too.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Regressions in GTK2 interface ?

2013-05-13 Thread Luca Olivetti
Al 13/05/13 14:04, En/na Paul Ishenin ha escrit:
 13.05.13, 17:52, Luca Olivetti пишет:
 
 Yes, I remembered something similar, that's why I added it. However,
 even with the default setting (sbgAlways) the menu glyphs aren't shown
 (glyphs in buttons are OK).
 
 Ok. Then check how DrawMenuItemIcon works and debug it in gtk2proc.inc

I tried but I can't: as soon as I click on the menu, the breakpoint
inside DrawMenuItemIcon triggers but then I cannot use the mouse or the
keyboard.
I had to switch to another tty to kill gdb.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Memory leak in dbgrids?

2013-05-10 Thread Luca Olivetti
Hello,

I'm migrating some programs from lazarus 0.9.30 to lazarus 1.0.8 (well,
actually updating and recompiling, there's no need to migrate anything).
Heaptrc is showing some memory leaks in dbgrid, though it doesn't
pinpoint the line exactly.
I think the leak is due to the change of type from TBookarkStr to
TBookmark, and dbgrids calls GetBookmark but never calls FreeBookmark
(it either discards the bookmark in local functions or assigns nil to it).
I'll try calling FreeBookmark and see if the leak goes away.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Memory leak in dbgrids?

2013-05-10 Thread Luca Olivetti
Al 10/05/13 09:36, En/na Luca Olivetti ha escrit:
 Al 10/05/13 09:13, En/na Luca Olivetti ha escrit:
 Hello,

 I'm migrating some programs from lazarus 0.9.30 to lazarus 1.0.8 (well,
 actually updating and recompiling, there's no need to migrate anything).
 Heaptrc is showing some memory leaks in dbgrid, though it doesn't
 pinpoint the line exactly.
 I think the leak is due to the change of type from TBookarkStr to
 TBookmark, and dbgrids calls GetBookmark but never calls FreeBookmark
 (it either discards the bookmark in local functions or assigns nil to it).
 I'll try calling FreeBookmark and see if the leak goes away.
 
 Mmh, actually it does, because FKeyBoomark is assigned nil only after
 clearing the list of selected records.
 Maybe the problem comes from the version of zeos in case it returns a
 different pointer for the same record?

Now I made a test project using SQLdb instead of zeos and the leak is
still there.
It happens with multiselect, each new selection increases the non-freed
block count.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


  1   2   3   >