Re: [Lazarus] Fuzzy translations ignored

2014-09-20 Thread Giuliano Colla


Il 19/09/2014 22:30, Bart ha scritto:

I refactored the GraphStat form using a TListView and a TImageList.
See r46256.


I open a new thread, with "pochecker" subject because this one is 
becoming uncomfortably lengthy.

See my comments there.

Giuliano


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


[Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Giuliano Colla

Il 19/09/2014 22:30, Bart ha scritto:
I refactored the GraphStat form using a TListView and a TImageList.
See r46256. 


Bad news!
On Windows it looks fine, it would just require some ironing (next hints 
shows only if you click on an empty area before) but on Linux it doesn't 
work.


Windows:
http://www.bononiadocta.it/Lazarus/Pochecker-a.png

Linux (Qt Widgetset):
http://www.bononiadocta.it/Lazarus/Pochecker-a1.png

Linux (Gtk2 Widgetset):
http://www.bononiadocta.it/Lazarus/Pochecker-a2.png

It would appear that the Icon view of Listview  (/ViewStyle:=vsIcon/) 
has not been implemented on those platforms.


Actually ListView is a Windows native function, therefore on Windows it 
works "by default". For other platforms it must be implemented.


Two solutions:

a) Someone implements it.
b) We take a different approach.

Giuliano

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


[Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

Hi,

While trying to fix bug http://bugs.freepascal.org/view.php?id=26651 
(for WinCE), the compiler complained with:

Identifier not found "GetProcessAffinityMask" (in utf8process.pp).

However, codetools' find declaration locates the function in 
fpc/rtl/win/wininc/redef.inc.


Where's the catch?

Note: GetProcessAffinityMask is defined as well in 
fpc/rtl/win/wininc/func.inc (inc file is used for Win32/64 but not for 
WinCE).


Thanks,
Stephano

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread FreeMan

On 20-09-2014 13:42, patspiper wrote:
While trying to fix bug http://bugs.freepascal.org/view.php?id=26651 
(for WinCE), the compiler complained with:

Identifier not found "GetProcessAffinityMask" (in utf8process.pp).

If you wanna get quick and without problem, my solution is,
on http://www.lazarus.freepascal.org/index.php?page=downloads
"Windows (32 Bits) Add ons"  link has wince binutils and others, just 
make clean install this files in winxp x32
I made in virtualbox, new xp and install just that link's files and then 
make crosscompile to wince.
I update my fpc svn before write this message (r28697) I get fatal error 
while make "OS_TARGET=wince CPU_TARGET=arm" maybe my binutil has a problem.
But still work on vbox, 3 hours ago I added some lines to wince project 
and sent it, its work on wince.



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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

On 20/09/14 14:50, FreeMan wrote:

On 20-09-2014 13:42, patspiper wrote:
While trying to fix bug http://bugs.freepascal.org/view.php?id=26651 
(for WinCE), the compiler complained with:

Identifier not found "GetProcessAffinityMask" (in utf8process.pp).

If you wanna get quick and without problem, my solution is,
on http://www.lazarus.freepascal.org/index.php?page=downloads
"Windows (32 Bits) Add ons"  link has wince binutils and others, just 
make clean install this files in winxp x32
I made in virtualbox, new xp and install just that link's files and 
then make crosscompile to wince.
I update my fpc svn before write this message (r28697) I get fatal 
error while make "OS_TARGET=wince CPU_TARGET=arm" maybe my binutil has 
a problem.
But still work on vbox, 3 hours ago I added some lines to wince 
project and sent it, its work on wince.


I build the WinCE cross compiler without any issue. The issue occurs 
only when compiling a WinCE project with lazarus svn. Do you use lazarus 
svn or a stable version?


Stephano

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread FreeMan

On 20-09-2014 15:05, patspiper wrote:
I build the WinCE cross compiler without any issue. The issue occurs 
only when compiling a WinCE project with lazarus svn. Do you use 
lazarus svn or a stable version? 


I wrote my system detail in my bugtracker, fpc and lazarus svn (last 
update)on kubuntu 14.04 x64

What is yours system detail ?

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Felipe Monteiro de Carvalho
The Qt seams to be working fine, it just puts all icons in a very long
line instead of spreading them out in the area.

ListView is the hardest control to implement always =) because it has
multiple styles and so many details...

Felipe Monteiro


On Sat, Sep 20, 2014 at 10:57 AM, Giuliano Colla
 wrote:
> Il 19/09/2014 22:30, Bart ha scritto:
> I refactored the GraphStat form using a TListView and a TImageList.
> See r46256.
>
>
> Bad news!
> On Windows it looks fine, it would just require some ironing (next hints
> shows only if you click on an empty area before) but on Linux it doesn't
> work.
>
> Windows:
> http://www.bononiadocta.it/Lazarus/Pochecker-a.png
>
> Linux (Qt Widgetset):
> http://www.bononiadocta.it/Lazarus/Pochecker-a1.png
>
> Linux (Gtk2 Widgetset):
> http://www.bononiadocta.it/Lazarus/Pochecker-a2.png
>
> It would appear that the Icon view of Listview  (ViewStyle:=vsIcon) has not
> been implemented on those platforms.
>
> Actually ListView is a Windows native function, therefore on Windows it
> works "by default". For other platforms it must be implemented.
>
> Two solutions:
>
> a) Someone implements it.
> b) We take a different approach.
>
> Giuliano
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Felipe Monteiro de Carvalho

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread Mattias Gaertner
On Sat, 20 Sep 2014 13:42:44 +0300
patspiper  wrote:

> Hi,
> 
> While trying to fix bug http://bugs.freepascal.org/view.php?id=26651 
> (for WinCE), the compiler complained with:
> Identifier not found "GetProcessAffinityMask" (in utf8process.pp).
> 
> However, codetools' find declaration locates the function in 
> fpc/rtl/win/wininc/redef.inc.

included in fpc 2.6.4 by
rtl/wince/wince/windows.pp

which looks right to me.
 
> Where's the catch?
> 
> Note: GetProcessAffinityMask is defined as well in 
> fpc/rtl/win/wininc/func.inc (inc file is used for Win32/64 but not for 
> WinCE).

They differ by the type of hProcess: THandle vs HANDLE. Maybe there is
a difference on WinCE?

Mattias

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

On 20/09/14 16:29, patspiper wrote:

On 20/09/14 15:44, Mattias Gaertner wrote:

On Sat, 20 Sep 2014 13:42:44 +0300
patspiper  wrote:


Hi,

While trying to fix bug http://bugs.freepascal.org/view.php?id=26651
(for WinCE), the compiler complained with:
Identifier not found "GetProcessAffinityMask" (in utf8process.pp).

However, codetools' find declaration locates the function in
fpc/rtl/win/wininc/redef.inc.

included in fpc 2.6.4 by
rtl/wince/wince/windows.pp

which looks right to me.

Right!

Where's the catch?

Note: GetProcessAffinityMask is defined as well in
fpc/rtl/win/wininc/func.inc (inc file is used for Win32/64 but not for
WinCE).

They differ by the type of hProcess: THandle vs HANDLE. Maybe there is
a difference on WinCE?


GetProcessAffinityMask expects a THAndle as 1st parameter. 
GetCurrentProcess's result is a HANDLE.


For WinCE, using codetools' find declaration:
fpc/rtl/win/wininc/redef.inc: THANDLE = HANDLE
fpc/rtl/win/wininc/base.inc: HANDLE = System.THandle
fpc/rtl/win/sysosh.inc: THandle = DWord

So they are essentially the same.

Nevetheless, I tried to cast the 1st parameter to a THandle in the 
call to GetProcessAffinityMask, but the problem persists.


That seems to be a tough nut to crack.

Stephano


I just realised that the identifier is completely not recognised, ie it 
is not an issue of mismatched parameters. I noted as well the use of 
compiler directives such as {$IF defined(windows)} instead of {$IFDEF 
WINDOWS} in lazarus/components/lazutils/utf8process.pp. Could this be 
the cause?


Stephano

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Bart
On 9/20/14, Giuliano Colla  wrote:

> Bad news!
> On Windows it looks fine, it would just require some ironing (next hints
> shows only if you click on an empty area before)

For me this part behaves as expected (Win7).

> but on Linux it doesn't
> work.
...
> It would appear that the Icon view of Listview  (/ViewStyle:=vsIcon/)
> has not been implemented on those platforms.
>

> a) Someone implements it.
Preferrably

> b) We take a different approach.
If we keep working around it, then this will never get fixed.

I could find an issue in bugtracker that says LargeIcons do not work
on Carbon, I could not find an issue stating the same problem for
GTK2, so why doesn't it draw the icons there?

Bart

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Bart
The "restricted" tab in OI only mentions Color, Columns, Font and
HideSelection as possible restricted properties

If this component is as broken (on non-windows) as it seems to be,
ther should be far more restrictions mentioned in OI.

Bart

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Bart
On 9/20/14, Giuliano Colla  wrote:

>... but on Linux it doesn't
> work.

I moved the calling of DrawGraphs to the formś OnActivate, and now the
Icons are there.
Please test with r46266.

Bart

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

On 20/09/14 17:11, patspiper wrote:

On 20/09/14 16:29, patspiper wrote:

On 20/09/14 15:44, Mattias Gaertner wrote:

On Sat, 20 Sep 2014 13:42:44 +0300
patspiper  wrote:


Hi,

While trying to fix bug http://bugs.freepascal.org/view.php?id=26651
(for WinCE), the compiler complained with:
Identifier not found "GetProcessAffinityMask" (in utf8process.pp).

However, codetools' find declaration locates the function in
fpc/rtl/win/wininc/redef.inc.

included in fpc 2.6.4 by
rtl/wince/wince/windows.pp

which looks right to me.

Right!

Where's the catch?

Note: GetProcessAffinityMask is defined as well in
fpc/rtl/win/wininc/func.inc (inc file is used for Win32/64 but not for
WinCE).

They differ by the type of hProcess: THandle vs HANDLE. Maybe there is
a difference on WinCE?


GetProcessAffinityMask expects a THAndle as 1st parameter. 
GetCurrentProcess's result is a HANDLE.


For WinCE, using codetools' find declaration:
fpc/rtl/win/wininc/redef.inc: THANDLE = HANDLE
fpc/rtl/win/wininc/base.inc: HANDLE = System.THandle
fpc/rtl/win/sysosh.inc: THandle = DWord

So they are essentially the same.

Nevetheless, I tried to cast the 1st parameter to a THandle in the 
call to GetProcessAffinityMask, but the problem persists.


That seems to be a tough nut to crack.

Stephano


I just realised that the identifier is completely not recognised, ie 
it is not an issue of mismatched parameters. I noted as well the use 
of compiler directives such as {$IF defined(windows)} instead of 
{$IFDEF WINDOWS} in lazarus/components/lazutils/utf8process.pp. Could 
this be the cause?


I guess I found the cause. The problem is 2 fold:

1- The function GetProcessAffinityMask is not defined for WinCE, as it 
is not defined in fpc/rtl/wince/wininc/redef.inc (as opposed to 
fpc/rtl/win/wininc/redef.inc which includes GetProcessAffinityMask). 
Hence this function should be eliminated from utf8process.pp for WinCE.


2- Codetools are still pointing to the win version of redef.inc 
eventhough the project's LCLwidgetset is WinCE.


Stephano

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread Mattias Gaertner
On Sat, 20 Sep 2014 17:11:56 +0300
patspiper  wrote:

>[...] I noted as well the use of 
> compiler directives such as {$IF defined(windows)} instead of {$IFDEF 
> WINDOWS} in lazarus/components/lazutils/utf8process.pp. Could this be 
> the cause?

No. They are the same.

Mattias

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread Mattias Gaertner
On Sat, 20 Sep 2014 19:14:31 +0300
patspiper  wrote:

>[...]
> I guess I found the cause. The problem is 2 fold:
> 
> 1- The function GetProcessAffinityMask is not defined for WinCE, as it 
> is not defined in fpc/rtl/wince/wininc/redef.inc (as opposed to 
> fpc/rtl/win/wininc/redef.inc which includes GetProcessAffinityMask). 
> Hence this function should be eliminated from utf8process.pp for WinCE.
> 
> 2- Codetools are still pointing to the win version of redef.inc 
> eventhough the project's LCLwidgetset is WinCE.

LCL widget set <> OS.
The LCL setting has nothing to do with the FPC sources.

You must set Target OS to Wince. By default this will select LCL
widgetset wince. Not the other way round.

Mattias

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

On 20/09/14 20:01, Mattias Gaertner wrote:

On Sat, 20 Sep 2014 19:14:31 +0300
patspiper  wrote:


[...]
I guess I found the cause. The problem is 2 fold:

1- The function GetProcessAffinityMask is not defined for WinCE, as it
is not defined in fpc/rtl/wince/wininc/redef.inc (as opposed to
fpc/rtl/win/wininc/redef.inc which includes GetProcessAffinityMask).
Hence this function should be eliminated from utf8process.pp for WinCE.

2- Codetools are still pointing to the win version of redef.inc
eventhough the project's LCLwidgetset is WinCE.

LCL widget set <> OS.
The LCL setting has nothing to do with the FPC sources.

You must set Target OS to Wince. By default this will select LCL
widgetset wince. Not the other way round.


I should have said both target OS and widgetset. They were both 
explicitly set to WinCE, and the target CPU to arm.


Stephano

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Giuliano Colla


Il 20/09/2014 17:51, Bart ha scritto:

On 9/20/14, Giuliano Colla  wrote:


... but on Linux it doesn't
work.

I moved the calling of DrawGraphs to the formś OnActivate, and now the
Icons are there.
Please test with r46266.


Now on Linux Gtk2 there's a significant improvement.

However there's still an issue:
when there are many files, and you must scroll the window, the hint 
shown is not related to the proper icon, but to the one which would have 
been in that position before scrolling.
I saw some discrepancies, and I suspected an error in the pie drawing. 
Then, in order to verify, I added one more line to the hint, with 
AStat.PoName, and I realized that it was simply showing the wrong Stats.
Does it work in Windows? /Lazarus/languages/lazaruside.xx.po should have 
enough files to generate a scroll.
Maybe you'll find a way adjust the Y coordinate for Listview.GetItemAt, 
but I'm afraid that we're again in trouble, because the procedure 
TControl.GetClientScrollOffset is implemented just with 
/Result:=Point(0,0);/ !


With Qt no change: Icons are too small, all items in one row, and no 
hint shown. But, Qt is somehow optional (even if IMHO Qt widgetset is 
better and more complete than Gtk2) and we may live with it, if you 
manage to make it work with Gtk2.


Giuliano


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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread Mattias Gaertner
On Sat, 20 Sep 2014 20:18:19 +0300
patspiper  wrote:

>[...]
> >> 1- The function GetProcessAffinityMask is not defined for WinCE, as it
> >> is not defined in fpc/rtl/wince/wininc/redef.inc (as opposed to
> >> fpc/rtl/win/wininc/redef.inc which includes GetProcessAffinityMask).
> >> Hence this function should be eliminated from utf8process.pp for WinCE.

Thanks for the hint.

I added the include path rtl/TargetOS/wininc for Windows targets.

Mattias

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


[Lazarus] Hint as text over TAChart

2014-09-20 Thread Leonardo M. Ramé
Hi, I want to display the value of the point below the mouse cursor as 
text over the chart.


The way I'm trying to implement this is by first add a TChartToolSet and 
DataPointHintTool, with an onHintPosition event handler to determine the 
point value, for example:


procedure TForm1.ChartToolset1DataPointHintTool1HintPosition(
  ATool: TDataPointHintTool; var APoint: TPoint);
begin
  FmyHint := Format('O: %f, H: %f, L: %f, C: %f',
[FOHLCArray[ATool.PointIndex].open,
FOHLCArray[ATool.PointIndex].high,
FOHLCArray[ATool.PointIndex].low,
FOHLCArray[ATool.PointIndex].close]);
end;

This just set a value for a variable, in this case FMyHint. Then, to 
draw the value over the chart, I use the onAfterPaint event of TAChart:


procedure TForm1.Chart1AfterPaint(ASender: TChart);
begin
  Sender.Canvas.TextOut(10, 10, FmyHint);
end;

But this event is not called after DataPointHintToolPosition, but on 
other events, such as Form.onResize.


One question is, is this the correct way to display text over a 
TAChart?, I don't like to add a TLabel over the chart.


The second question, how can I force a call to TAChart.onAftertPaint?.

Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread patspiper

On 20/09/14 21:38, Mattias Gaertner wrote:

[...]
Thanks for the hint. I added the include path rtl/TargetOS/wininc for 
Windows targets.


Although find declaration now rightly fails to locate 
GetProcessAffinityMask for WinCE, I am not sure how adding 
rtl/TargetOS/wininc without removing rtl/win/wininc did the trick.


On the other hand, compilation of WinCE projects still fails due to that 
missing function. I have opened a bug report and included a patch for 
function GetSystemThreadCount that returns the processor count instead.


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

Thanks,
Stephano

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Giuliano Colla


Il 20/09/2014 14:44, Felipe Monteiro de Carvalho ha scritto:

The Qt seams to be working fine, it just puts all icons in a very long
line instead of spreading them out in the area.
If it weren't that the purpose would be to show in a compact way the 
situation of as many translations as possible, and that it doesn't show 
the hint (required to have actual numbers, and maybe some extra 
information)!

ListView is the hardest control to implement always =) because it has
multiple styles and so many details...
That's what frightens me. I'm under the impression that someone in the 
past has implemented the bare minimum he needed for a specific purpose, 
and since then nobody else dared to put his hands on that matter!


Giuliano


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


[Lazarus] Hint as text over TAChart

2014-09-20 Thread Werner Pamler
Using the TDataPointHintTool is correct. It is just a little bit awkward 
to use... In particular you are not picking the correct event.


Here's a step-by-step instruction. Code shown will be based on the 
"financial" demo which I added to TAChart recently:


 * Add a TChartToolset to the form
 * Set the chart's "Toolset" property to the toolset added.
 * Add a TDatapointHintTool.
 * Set "DistanceMode" to cdmOnlyX - this means that only the x
   coordinate of the mouse is evaluated to find the data point under
   the mouse; otherwise you'd have to move the move correctly to x and
   y. "GrabRadius" is the tolerance for point detection; you may want
   to increase the value a bit.
 * Add code to the "OnHint" event of the DatapointHintTool, this is the
   code which generates the hint text. Adapt your code to the following
   which works with the "financial" demo (note that the hint string may
   contain line breaks!):

   procedure TMainForm.ChartToolset1DataPointHintTool1Hint(ATool:
   TDataPointHintTool;
  const APoint: TPoint; var AHint: String);
   var
  ser: TOpenHighLowCloseSeries;
   begin
  ser := ATool.Series as TOpenHighLowCloseSeries;
  AHint := Format('Date: %s'#13'  Open: %.2f'#13'  High: %.2f'#13' 
   Low: %.2f'#13'  Close: %.2f', [

ser.ListSource[Atool.PointIndex]^.Text,// In
   this example the date is not stored in "x", but in the "Text" of the
   data point
ser.ListSource[ATool.PointIndex]^.YList[0],
ser.ListSource[ATool.PointIndex]^.YList[2],
ser.ListSource[ATool.PointIndex]^.Y,
ser.ListSource[ATool.PointIndex]^.YList[1]
  ]);
   end;

 * When you compile the hints should work already. However, they are
   not properly positioned. I'd prefer to move them above a data point
   and center them horizontally to the data points. The OnHintPosition
   event is responsible to determine the location of the upper/left
   corner of the hint window.

   procedure
   TMainForm.ChartToolset1DataPointHintTool1HintPosition(ATool:
   TDataPointHintTool;
  var APoint: TPoint);
   var
  ser: TOpenHighLowCloseSeries;
  x, y: Integer;
  w, h: Integer;
  r: TRect;
  hintwnd : THintWindow;
  s: String;
   begin
  { Calculate screen coordinates of the "high" point }

  ser := ATool.Series as TOpenHighLowCloseSeries;
  x :=
   FinancialChart.XGraphToImage(ser.ListSource[ATool.PointIndex]^.X);
  y :=
   FinancialChart.YGraphToImage(ser.ListSource[ATool.PointIndex]^.YList[2]);
// "High" value, i.e. max of data point

  { Calculate size of hint window }

  // Get hint text - just call the event handler of OnHint
  ChartToolset1DataPointHintTool1Hint(ATool, APoint, s);

  // Calculation - borrowed from TATools
  hintwnd := THintWindow.Create(nil);
  try
r := hintwnd.CalcHintRect(FinancialChart.Width, s, nil);
w := r.Right - r.Left;  // Hint width
h := r.Bottom - r.Top;  // Hint height
  finally
hintwnd.Free;
  end;

  // Center hint horizontally relative to data point
  APoint.x := x - w div 2;

  // Move hint 10 pixels above the "High" data point
  APoint.y := y - h - 10;

  // Hint coordinates are relative to screen
  APoint := FinancialChart.ClientToScreen(APoint);
   end;


Regarding your second question how to call "OnAfterPaint": Just call it 
like I call the OnHint event in above example.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Codetools vs compiler

2014-09-20 Thread Mattias Gaertner
On Sat, 20 Sep 2014 22:16:55 +0300
patspiper  wrote:

> On 20/09/14 21:38, Mattias Gaertner wrote:
> > [...]
> > Thanks for the hint. I added the include path rtl/TargetOS/wininc for 
> > Windows targets.
> 
> Although find declaration now rightly fails to locate 
> GetProcessAffinityMask for WinCE,

As the compiler. Good.

> I am not sure how adding 
> rtl/TargetOS/wininc without removing rtl/win/wininc did the trick.

It now finds the right redef.inc.


Mattias

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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-20 Thread Bart
On 9/20/14, Giuliano Colla  wrote:

> Now on Linux Gtk2 there's a significant improvement.

Fine!

>
> However there's still an issue:
> when there are many files, and you must scroll the window, the hint
> shown is not related to the proper icon, but to the one which would have
> been in that position before scrolling.

You mean, you scroll, then put the mouse over an icon and wait for the
hitn, and the hint is the wrong one?

> Maybe you'll find a way adjust the Y coordinate for Listview.GetItemAt,
> but I'm afraid that we're again in trouble, because the procedure
> TControl.GetClientScrollOffset is implemented just with
> /Result:=Point(0,0);/ !

On windows it displays the correct hint.
It would mean that this part:
  pt:= listview.ScreenToClient( mouse.cursorpos );
  item := listview.GetItemAt( pt.x, pt.y );
does not function properly unde GTK2

> With Qt no change: Icons are too small,

I tested QT-Linux, and IIRC the icons were the same size as on GTK2

> all items in one row,

Yes, that sucks.
Do you know if QT interface has a native ListView, or how is the drawin done?

> But, Qt is somehow optional (even if IMHO Qt widgetset is
> better and more complete than Gtk2) and we may live with it, if you
> manage to make it work with Gtk2.

Many seem to prefer QT on Linux over GTK2 (visually more attractive?).

Bart

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


Re: [Lazarus] Hint as text over TAChart

2014-09-20 Thread Leonardo M. Ramé

On 20/09/14 17:08, Werner Pamler wrote:

Using the TDataPointHintTool is correct. It is just a little bit awkward
to use... In particular you are not picking the correct event.

Here's a step-by-step instruction. Code shown will be based on the
"financial" demo which I added to TAChart recently:

  * Add a TChartToolset to the form
  * Set the chart's "Toolset" property to the toolset added.
  * Add a TDatapointHintTool.
  * Set "DistanceMode" to cdmOnlyX - this means that only the x
coordinate of the mouse is evaluated to find the data point under
the mouse; otherwise you'd have to move the move correctly to x and
y. "GrabRadius" is the tolerance for point detection; you may want
to increase the value a bit.
  * Add code to the "OnHint" event of the DatapointHintTool, this is the
code which generates the hint text. Adapt your code to the following
which works with the "financial" demo (note that the hint string may
contain line breaks!):

procedure TMainForm.ChartToolset1DataPointHintTool1Hint(ATool:
TDataPointHintTool;
   const APoint: TPoint; var AHint: String);
var
   ser: TOpenHighLowCloseSeries;
begin
   ser := ATool.Series as TOpenHighLowCloseSeries;
   AHint := Format('Date: %s'#13'  Open: %.2f'#13'  High: %.2f'#13'
Low: %.2f'#13'  Close: %.2f', [
 ser.ListSource[Atool.PointIndex]^.Text,// In
this example the date is not stored in "x", but in the "Text" of the
data point
 ser.ListSource[ATool.PointIndex]^.YList[0],
 ser.ListSource[ATool.PointIndex]^.YList[2],
 ser.ListSource[ATool.PointIndex]^.Y,
 ser.ListSource[ATool.PointIndex]^.YList[1]
   ]);
end;

  * When you compile the hints should work already. However, they are
not properly positioned. I'd prefer to move them above a data point
and center them horizontally to the data points. The OnHintPosition
event is responsible to determine the location of the upper/left
corner of the hint window.

procedure
TMainForm.ChartToolset1DataPointHintTool1HintPosition(ATool:
TDataPointHintTool;
   var APoint: TPoint);
var
   ser: TOpenHighLowCloseSeries;
   x, y: Integer;
   w, h: Integer;
   r: TRect;
   hintwnd : THintWindow;
   s: String;
begin
   { Calculate screen coordinates of the "high" point }

   ser := ATool.Series as TOpenHighLowCloseSeries;
   x :=
FinancialChart.XGraphToImage(ser.ListSource[ATool.PointIndex]^.X);
   y :=
FinancialChart.YGraphToImage(ser.ListSource[ATool.PointIndex]^.YList[2]);
 // "High" value, i.e. max of data point

   { Calculate size of hint window }

   // Get hint text - just call the event handler of OnHint
   ChartToolset1DataPointHintTool1Hint(ATool, APoint, s);

   // Calculation - borrowed from TATools
   hintwnd := THintWindow.Create(nil);
   try
 r := hintwnd.CalcHintRect(FinancialChart.Width, s, nil);
 w := r.Right - r.Left;  // Hint width
 h := r.Bottom - r.Top;  // Hint height
   finally
 hintwnd.Free;
   end;

   // Center hint horizontally relative to data point
   APoint.x := x - w div 2;

   // Move hint 10 pixels above the "High" data point
   APoint.y := y - h - 10;

   // Hint coordinates are relative to screen
   APoint := FinancialChart.ClientToScreen(APoint);
end;


Regarding your second question how to call "OnAfterPaint": Just call it
like I call the OnHint event in above example.




Great, calling onAfterPaint did the trick. Btw, thanks for the example.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


[Lazarus] TAchart frame left and top values

2014-09-20 Thread Leonardo M. Ramé
I need to draw text just at the top left corner of a chart, is there a 
property to allow me to know the top, left (and of course right and 
bottom) points of the frame containing the chart?.


I attached a screenshot showing what I'm looking for.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus