Re: [Lazarus] Vertical String Grid

2013-12-09 Thread Richard Mace
Hi Graeme,
Sounds very interesting, however, I think it is a bit higher than my
current coding knowledge. Also, your application looks amazing, what
components are you using that aren't installed with the defaul Lazarus
install?

Also, how long do you think it would take to set a new property onthe
StringGrid to have orinetaion: Horizontal or Vertical to make things
really easy?

Richard


On 6 December 2013 06:47, Graeme Geldenhuys gra...@geldenhuys.co.uk wrote:

 On 2013-12-03 15:12, Richard Mace wrote:
  Could you give me any hints or example code?

 You can do whatever painting you want in the OnDrawCell. Combine that
 with hiding the column titles and grid lines, and pretty much have a
 blank canvas to paint anything. Google TStringGrid and OnDrawCell.

 Here are some results:

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


 http://docwiki.embarcadero.com/CodeExamples/XE4/en/OnDrawCell_%28Delphi%29


 http://stackoverflow.com/questions/3540570/delphi-how-to-make-cells-texts-in-tstringgrid-center-aligned


 Here are some of my own results:
   http://geldenhuys.co.uk/~graemeg/stringgrid1.png
   http://geldenhuys.co.uk/~graemeg/stringgrid2.png


 Regards,
   Graeme


 --
 fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
 http://fpgui.sourceforge.net/

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

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


[Lazarus] Pointer type handling

2013-12-09 Thread Leonardo M . Ramé
Hi, I'm passing a pointer buffer as void * to a C library that returns
Uint8 or Uint16 (and signed types).

If I explicitly declare the buffer as PByte, PWord, etc. I get exactly
what I need, but, I would like to work with an abstract type (for
example Pointer) and cast it depending on a flag returned by the
library.

If I pass a Pointer (instead of a PWord or PByte) and cast it to PWord,
for example. I get the same result if I have passed a PByte.

How can I handle a situation like this without explicitly define each
type?.

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] Pointer type handling

2013-12-09 Thread Hans-Peter Diettrich

Leonardo M. Ramé schrieb:

Hi, I'm passing a pointer buffer as void * to a C library that returns
Uint8 or Uint16 (and signed types).

If I explicitly declare the buffer as PByte, PWord, etc. I get exactly
what I need, but, I would like to work with an abstract type (for
example Pointer) and cast it depending on a flag returned by the
library.

If I pass a Pointer (instead of a PWord or PByte) and cast it to PWord,
for example. I get the same result if I have passed a PByte.

How can I handle a situation like this without explicitly define each
type?.


I'm not sure what you mean. How does your code look like now, and how do 
you want it to look?


You can modify the function declarations in your units, to accept the 
properly typed pointer or an Var parameter.


DoDi


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


Re: [Lazarus] Pointer type handling

2013-12-09 Thread Leonardo M . Ramé
On 2013-12-09 16:24:22 +0100, Hans-Peter Diettrich wrote:
 Leonardo M. Ramé schrieb:
 Hi, I'm passing a pointer buffer as void * to a C library that returns
 Uint8 or Uint16 (and signed types).
 
 If I explicitly declare the buffer as PByte, PWord, etc. I get exactly
 what I need, but, I would like to work with an abstract type (for
 example Pointer) and cast it depending on a flag returned by the
 library.
 
 If I pass a Pointer (instead of a PWord or PByte) and cast it to PWord,
 for example. I get the same result if I have passed a PByte.
 
 How can I handle a situation like this without explicitly define each
 type?.
 
 I'm not sure what you mean. How does your code look like now, and
 how do you want it to look?
 
 You can modify the function declarations in your units, to accept
 the properly typed pointer or an Var parameter.
 
 DoDi
 

If you mean overloading functions, that is exactly what I don't want to
do.

My methods are similar to this:

procedure TImageDrawer.Draw(ABuffer: PWord);
begin
  ...
end;

As you can see, I'm passing a PWord, this works as expected, the same if
I modify the funcion passing a PByte. But, as I cannot create a new
function for each pointer type, I would like to pass a generic pointer,
and typecast it inside the function, for example:

procedure TImageDrawer.Draw(ABuffer: Pointer);
begin
  ...
  if MyImage.DataType = Uint16 then
data = PWord(ABuffer)^
  else
  if MyImage.DataType = Uint8 then
data = PByte(ABuffer)^;
end;

If I do this, the result of PWord(ABuffer) is the same as
PByte(ABuffer). I'm starting to think PByte is equal to Pointer type.

-- 
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] TAChart - Logarithmic Transform fails for X Axis

2013-12-09 Thread Peter Thurner

Hello Salvatore,
Thanks for the reply.
Yes, I used the same dataset and switched x and y. It worked when I did 
log transform with left-axis.

the same dataset fails if I switch x and y and do transform on bottom axis.
BR Peter


Am 08.12.2013 18:44, schrieb Salvatore Coppola:

Have you checked data (0)?
Salvatore


2013/12/7 Peter Thurner pm.thur...@gmx.at mailto:pm.thur...@gmx.at

Hello *,

This is the first time that I post something, so please be patient
with me :-)

I have been using Plotpanel now for a while to plot Bode diagrams
within Lazarus GUIs.
Now I would like to switch to TAChart which seems very powerfull too.
I tried it out with linear graphs and it works very well.

But If I try to plot a bode diagram with a logarithmic x Axis then
it crashes.
I followed the tutorial about logarithmic transform:

http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting
and I did all the steps successfully.

BUT If I try to apply a logarithmic transform to the bottom axis
(x-axis) then it crashes.
It displays the graph but the grid lines are gone.
Has anybody tried already to apply log transform to bottom axis?
It works for left axis.

Thanks
PeterT

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




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


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