[Lazarus] Strange inconsistency between Linux and Mac TEdit Height

2013-01-24 Thread Donald Ziesig

Hi All!

I am sitting here with a Linux PC and a Mac in front of me.  I have just 
uploaded the Linux version of a program for my Granddaughter to github 
and cloned it to the Mac.


On the Linux box I have a TEdit control whose height is set to 65 pixels 
(the Font height is -53); the control height is consistent with the font.


On the Mac I have the same form, all of which is consistent with the PC 
except for the TEdit control.  The height of the TEdit is 22 (only the 
very top  of the text is visible).  The font height is -53 as on the PC.


I looked at the .lfm file and the TEdit data are identical on both machines.

I attempted to resize the TEdit on the Mac by setting its height to 65 
in the Object Inspector.  As soon as I exit the height field it returns 
to 22.  I tried to resize it graphically, but dragging the bottom handle 
is ignored and the height remains at 22.  Doing the same on the PC works 
as expected.


Even more interesting.  When executing the program, the TEdit starts 
with a height of 22, but as soon as I change the text contents it 
resizes to 65 and displays the results exactly as they appear on the 
PC.  It works properly from there on until I exit and restart the program.


Does anyone have an idea of how to fix this?

The github account is dziesig and the two projects (public) are 
"MagicLibraries" and "MagicArithmetic".  The problem occurs on the main 
form of MagicArithmetic (flash cards for my granddaughter ;-) ).


Thanks,

Don Ziesig


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


Re: [Lazarus] Lazarus books

2013-01-24 Thread Miquel Bruns
Also this one:

http://www.blaisepascal.eu/index.php?actie=./subscribers/UK_Book_Department_LearnToProgramUsingLazarus



On 1/24/13, Howard Page-Clark  wrote:
> On 24/1/13 6:51, appjaws wrote:
>
>> I need a book or site that can explain these details and provide working
>> examples that I can use as practise.
>> I know what I want to achieve with a gui program but not the best way to
>> to complete an operation.
>
> Have you looked at Lazarus the Complete Guide (available in German or
> English)?
> http://www.blaisepascal.eu/index.php?actie=./subscribers/lazarusbookinfoEnglish
>
> There is a free online book by Motaz Azeem at
> http://code.sd/startprog/index.html
> (in Arabic or English)
>
>
> --
> ___
> 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


Re: [Lazarus] Lazarus books

2013-01-24 Thread Héctor F . Fiandor Rosario
Dear appjaws:

for a long time I have worked with pascal (turboPascal and Delphi) and really, 
it was easy to me to start working with FP, but

I have not dissabled the Delphi5 installation, and often I consult the Delphi´s 
help  for some details. 

it is an idea awaiting you can get the book.

yours,

Ing. Héctor F. Fiandor Rosario
hfian...@infomed.sld.cu


--

Este mensaje le ha llegado mediante el servicio de correo electronico 
que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistem
a Nacional de Salud. La persona que envia este correo asume el compromiso de
 usar el servicio a tales fines y cumplir con las regulaciones establecidas


Infomed: http://www.sld.cu/


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


Re: [Lazarus] Lazarus books

2013-01-24 Thread Howard Page-Clark

On 24/1/13 6:51, appjaws wrote:


I need a book or site that can explain these details and provide working
examples that I can use as practise.
I know what I want to achieve with a gui program but not the best way to
to complete an operation.


Have you looked at Lazarus the Complete Guide (available in German or 
English)?

http://www.blaisepascal.eu/index.php?actie=./subscribers/lazarusbookinfoEnglish

There is a free online book by Motaz Azeem at
http://code.sd/startprog/index.html
(in Arabic or English)


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


[Lazarus] Lazarus books

2013-01-24 Thread appjaws

Hi all,
I am trying to get to grips with lazarus and freepascal, but I am 
finding it difficult to find out all of the attributes that can be used 
and indeed what some of the components can be used for.
I need a book or site that can explain these details and provide working 
examples that I can use as practise.
I know what I want to achieve with a gui program but not the best way to 
to complete an operation.

Any pointers would be most welcome,
Paul
--
---This message has been sent using Thunderbird on kubuntu---

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


Re: [Lazarus] Keeping a main menu item visible after it's been clicked

2013-01-24 Thread Mark Morgan Lloyd

Mark Morgan Lloyd wrote:
If a main menu item contains something like "More detail ↴" which 
enables additional lines, is it possible to prevent the item closing 
when that's clicked? I've tried doing this (Linux/gtk2)...


Or put another way: under program control how can a main-menu item be 
made visible, as though it had been clicked?


Any thoughts would be appreciated, I haven't had much success with the 
documentation and archive.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

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


Re: [Lazarus] TFPHttpClient: resume download.

2013-01-24 Thread silvioprog
2013/1/24 Graeme Geldenhuys 

> Hi silvioprog,
>
> Please discuss FPC related topics in fpc-pascal. That way everybody
> interested in FPC only discussions can follow. eg: I almost missed these
> discussions (which I am interested in), because I auto-mark Lazarus
> mailing list messages as read.
>
> Thanks,
>   G.
>

OKs. Sorry.

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Xiangrong Fang
One more report:

I finally decided to use the solution suggested by Fei, i.e. empty method
in base class instead of Abstract method. Becuase comparing address to
@system.AbstractError caused trouble if I put my class into a shared
library.

Thanks.



2013/1/24 Mattias Gaertner 

>
> Xiangrong Fang  hat am 24. Januar 2013 um 14:03
> geschrieben:
>
> > This is a clean solution. And as a matter of fact, the compiler does NOT
> warn
> > me while instantiate class with abstract method.
>
> Normally the compiler warns for each abstract method. For example, this
> creates
> 5 warnings:
>  TStrings.Create;
> If not then please create a bug report.
>
>
> > This is different than Java, in which you must implement all abstract
> method
> > while inherits from an abstract class.
> >
> >  Why I shall not instantiate a sub-class that has not fully implemented
> > abstract methods of its parent class?
>
> Well, you can shoot yourself in the foot. ;)
>
> Mattias
>
> --
> ___
> 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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Mattias Gaertner

Xiangrong Fang  hat am 24. Januar 2013 um 14:03 geschrieben:

> This is a clean solution. And as a matter of fact, the compiler does NOT warn
> me while instantiate class with abstract method.

Normally the compiler warns for each abstract method. For example, this creates
5 warnings:
 TStrings.Create;
If not then please create a bug report.


> This is different than Java, in which you must implement all abstract method
> while inherits from an abstract class.
>
>  Why I shall not instantiate a sub-class that has not fully implemented
> abstract methods of its parent class?

Well, you can shoot yourself in the foot. ;)

Mattias

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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Xiangrong Fang
Sorry I overlooked the message. Complie DO emit warnings.

As the use of sub-class is well controlled, I will check in every place the
abstract method is called, so this is ok for me.

Thanks a lot.

2013/1/24 Michael Van Canneyt 

>
>
> On Thu, 24 Jan 2013, Xiangrong Fang wrote:
>
>  This is a clean solution. And as a matter of fact, the compiler does NOT
>> warn me while instantiate class with abstract method.
>>
>
> It definitely does, unless you use a class pointer to do it of course.
>
> In the below example:
>
>   TParentClass = Class of TParent;
>
> Var
>   PC : TParentClass;
>
> begin
>   PC:=TChild;
>   C:=PC.Create;
> end;
>
> You will not get a warning. But if you run the example as I described it,
> you get:
>
> home: >fpc -S2 -vwh te.pp
> te.pp(15,19) Warning: Constructing a class "TChild" with abstract method
> "MyMethod"
> te.pp(5,15) Hint: Found abstract method: procedure MyMethod();
>
>
>   This is different than Java,
>> in which you must implement all abstract method while inherits from an
>> abstract class.
>>
>
>
>> Why I shall not instantiate a sub-class that has not fully implemented
>> abstract methods of its parent class?
>>
>
> Obviously:
> Because then you run the risk that you try to execute a method that is not
> implemented.
>
> Michael.
>
>
>> Thanks!
>> Shannon
>>
>>
>> 2013/1/24 Michael Van Canneyt 
>>
>>
>>   On Thu, 24 Jan 2013, xrfang wrote:
>>
>> Hi All,
>> I wrote a TPainter abstract class, and a TPaintRect class.
>>  In the TPaintRect class I have this code:
>>
>> procedure TPaintRect.OnMouseEnter(**Sender: TObject);
>> var
>>   i: Integer;
>>   p: TPainter;
>> begin
>>   for i := 0 to painters.Count - 1 do begin
>> p := TPainter(painters.Objects[i]);
>> try
>>   p.OnMouseEnter(Sender);
>> except on EAbstractError do ; end;
>>   end;
>>   if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
>> end;
>>
>> While running in IDE, the program will crash because
>> OnMouseEnter is abstract.
>>
>> My problems are:
>>
>> 1) As I already wrapped it with try-except, I hope it won't
>> trigger IDE exception. But even I turn off "Notify on Lazarus Exception" in
>> debugger options it
>> still pops up, and the popup said RunError(211), NOT
>> EAbstractError.  The program runs well outside of IDE.
>>
>> 2) Is there a way to detect if an abstract method is
>> implemented or not, without trying to call it and try...except?
>>
>>
>> The following will do it:
>>
>> uses sysutils;
>>
>> Type
>>   TParent = Class
>> Procedure MyMethod; virtual; abstract;
>>   end;
>>
>>   TChild = class(TParent)
>>   end;
>>
>> var
>>   C : TParent;
>>
>> begin
>>   c:=TChild.Create;
>>   If TMethod(@C.MyMethod).Code=**Pointer(@system.AbstractError) then
>> Writeln('Not implemented')
>>   else
>> Writeln('Implemented')
>> end.
>>
>> When run, it will print 'Not implemented'.
>>
>> But you should not instantiate objects with abstract methods to begin
>> with.
>>
>> The compiler warns you if you do.
>> (compile the above program with warnings/hints to see it)
>>
>> Michael.
>> --
>> __**_
>> 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 mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Michael Van Canneyt



On Thu, 24 Jan 2013, Xiangrong Fang wrote:


This is a clean solution. And as a matter of fact, the compiler does NOT warn 
me while instantiate class with abstract method.  


It definitely does, unless you use a class pointer to do it of course.

In the below example:

  TParentClass = Class of TParent;

Var
  PC : TParentClass;

begin
  PC:=TChild;
  C:=PC.Create;
end;

You will not get a warning. But if you run the example as I described it, you 
get:

home: >fpc -S2 -vwh te.pp
te.pp(15,19) Warning: Constructing a class "TChild" with abstract method 
"MyMethod"
te.pp(5,15) Hint: Found abstract method: procedure MyMethod();


 This is different than Java,
in which you must implement all abstract method while inherits from an abstract 
class.




Why I shall not instantiate a sub-class that has not fully implemented abstract 
methods of its parent class?


Obviously:
Because then you run the risk that you try to execute a method that is not 
implemented.

Michael.


Thanks!
Shannon


2013/1/24 Michael Van Canneyt 


  On Thu, 24 Jan 2013, xrfang wrote:

Hi All,
I wrote a TPainter abstract class, and a TPaintRect class.  In the 
TPaintRect class I have this code:

procedure TPaintRect.OnMouseEnter(Sender: TObject);
var
  i: Integer;
  p: TPainter;
begin
  for i := 0 to painters.Count - 1 do begin
    p := TPainter(painters.Objects[i]);
    try
      p.OnMouseEnter(Sender);
    except on EAbstractError do ; end;
  end;
  if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
end;

While running in IDE, the program will crash because OnMouseEnter 
is abstract.

My problems are:

1) As I already wrapped it with try-except, I hope it won't trigger IDE 
exception. But even I turn off "Notify on Lazarus Exception" in
debugger options it
still pops up, and the popup said RunError(211), NOT 
EAbstractError.  The program runs well outside of IDE.

2) Is there a way to detect if an abstract method is implemented or 
not, without trying to call it and try...except?


The following will do it:

uses sysutils;

Type
  TParent = Class
    Procedure MyMethod; virtual; abstract;
  end;

  TChild = class(TParent)
  end;

var
  C : TParent;

begin
  c:=TChild.Create;
  If TMethod(@C.MyMethod).Code=Pointer(@system.AbstractError) then
    Writeln('Not implemented')
  else
    Writeln('Implemented')
end.

When run, it will print 'Not implemented'.

But you should not instantiate objects with abstract methods to begin with.

The compiler warns you if you do.
(compile the above program with warnings/hints to see it)

Michael.
--
___
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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Xiangrong Fang
This is a clean solution. And as a matter of fact, the compiler does NOT
warn me while instantiate class with abstract method.   This is different
than Java, in which you must implement all abstract method while inherits
from an abstract class.

Why I shall not instantiate a sub-class that has not fully implemented
abstract methods of its parent class?

Thanks!
Shannon


2013/1/24 Michael Van Canneyt 

>
>
> On Thu, 24 Jan 2013, xrfang wrote:
>
>  Hi All,
>> I wrote a TPainter abstract class, and a TPaintRect class.  In the
>> TPaintRect class I have this code:
>>
>> procedure TPaintRect.OnMouseEnter(**Sender: TObject);
>> var
>>   i: Integer;
>>   p: TPainter;
>> begin
>>   for i := 0 to painters.Count - 1 do begin
>> p := TPainter(painters.Objects[i]);
>> try
>>   p.OnMouseEnter(Sender);
>> except on EAbstractError do ; end;
>>   end;
>>   if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
>> end;
>>
>> While running in IDE, the program will crash because OnMouseEnter is
>> abstract.
>>
>> My problems are:
>>
>> 1) As I already wrapped it with try-except, I hope it won't trigger IDE
>> exception. But even I turn off "Notify on Lazarus Exception" in debugger
>> options it
>> still pops up, and the popup said RunError(211), NOT EAbstractError.  The
>> program runs well outside of IDE.
>>
>> 2) Is there a way to detect if an abstract method is implemented or not,
>> without trying to call it and try...except?
>>
>
> The following will do it:
>
> uses sysutils;
>
> Type
>   TParent = Class
> Procedure MyMethod; virtual; abstract;
>   end;
>
>   TChild = class(TParent)
>   end;
>
> var
>   C : TParent;
>
> begin
>   c:=TChild.Create;
>   If TMethod(@C.MyMethod).Code=**Pointer(@system.AbstractError) then
> Writeln('Not implemented')
>   else
> Writeln('Implemented')
> end.
>
> When run, it will print 'Not implemented'.
>
> But you should not instantiate objects with abstract methods to begin with.
>
> The compiler warns you if you do.
> (compile the above program with warnings/hints to see it)
>
> Michael.
> --
> ___
> 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


Re: [Lazarus] TOpenGLControl.DepthBits default value

2013-01-24 Thread Kostas Michalopoulos
Ah, interesting. I probably had ChoosePixelFormat in mind which from what i
remember tries to get a close format and falls back to whatever is
available if it cannot find one.


On Wed, Jan 23, 2013 at 4:48 PM, Michalis Kamburelis <
michalis.ka...@gmail.com> wrote:

> Kostas Michalopoulos wrote:
>
>> AFAIK even if you ask for 24 and there is no support for it, you'll get
>> a 16bit buffer anyway.
>>
>>
> No. This is a required minimal value, at least for GLX and modern
> wglChoosePixelFormatARB. It was *possibly* treated in more relaxed way by
> the old ChoosePixelFormat, but you should not depend on that. Links to
> relevant docs are on 
> http://wiki.freepascal.org/**Extending_TOpenGLControl.
>
>
> Michalis
>
>
> --
> __**_
> 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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Graeme Geldenhuys
On 01/24/13 08:31, Michael Van Canneyt wrote:
> 
> But you should not instantiate objects with abstract methods to begin with.
> 
> The compiler warns you if you do.
> (compile the above program with warnings/hints to see it)


I was about to say the same thing.


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


Re: [Lazarus] TFPHttpClient: resume download.

2013-01-24 Thread Graeme Geldenhuys
Hi silvioprog,

Please discuss FPC related topics in fpc-pascal. That way everybody
interested in FPC only discussions can follow. eg: I almost missed these
discussions (which I am interested in), because I auto-mark Lazarus
mailing list messages as read.

Thanks,
  G.


On 01/23/13 16:21, silvioprog wrote:
> Hello,
> 
> Some times, we need to resume a download. To do this is very easy, enough
> read byte by byte and continuing from the last 50KB (Chrome and Firefox
> works so).
> 
> So, TFPHttpClient allow to read byte by byte of a content?
> 
> Thank you!

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


[Lazarus] Keeping a main menu item visible after it's been clicked

2013-01-24 Thread Mark Morgan Lloyd
If a main menu item contains something like "More detail ↴" which 
enables additional lines, is it possible to prevent the item closing 
when that's clicked? I've tried doing this (Linux/gtk2):


procedure TMainForm.OnAfterOverridesVisibleClick(checked: LONGINT);

begin
  if checked <> 0 then
MenuConfiguration.Click
end { TMainForm.OnAfterOverridesVisibleClick } ;

procedure TMainForm.MenuConfigurationProfileOverridesClick(Sender: TObject);

begin
  with MenuConfigurationProfileOverrides do begin
Checked := not Checked;
..
Application.QueueAsyncCall(@OnAfterOverridesVisibleClick, Ord(Checked))
  end;
end { TMainForm.MenuConfigurationProfileOverridesClick } ;

but it has no obvious effect... I presume that I need more of a delay in 
there.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Michael Van Canneyt



On Thu, 24 Jan 2013, xrfang wrote:


Hi All,
I wrote a TPainter abstract class, and a TPaintRect class.  In the TPaintRect 
class I have this code:

procedure TPaintRect.OnMouseEnter(Sender: TObject);
var
  i: Integer;
  p: TPainter;
begin
  for i := 0 to painters.Count - 1 do begin
    p := TPainter(painters.Objects[i]);
    try
      p.OnMouseEnter(Sender);
    except on EAbstractError do ; end;
  end;
  if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
end;

While running in IDE, the program will crash because OnMouseEnter is abstract.

My problems are:

1) As I already wrapped it with try-except, I hope it won't trigger IDE exception. But 
even I turn off "Notify on Lazarus Exception" in debugger options it
still pops up, and the popup said RunError(211), NOT EAbstractError.  The 
program runs well outside of IDE.

2) Is there a way to detect if an abstract method is implemented or not, 
without trying to call it and try...except?


The following will do it:

uses sysutils;

Type
  TParent = Class
Procedure MyMethod; virtual; abstract;
  end;

  TChild = class(TParent)
  end;

var
  C : TParent;

begin
  c:=TChild.Create;
  If TMethod(@C.MyMethod).Code=Pointer(@system.AbstractError) then
Writeln('Not implemented')
  else
Writeln('Implemented')
end.

When run, it will print 'Not implemented'.

But you should not instantiate objects with abstract methods to begin with.

The compiler warns you if you do.
(compile the above program with warnings/hints to see it)

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


Re: [Lazarus] Check if an abstract method is implemented or not

2013-01-24 Thread Fei Valentain
Hi, I don't test it in fp. But in Delphi I just create virtual method with
empty body in this situation.
24.01.2013 15:11 пользователь "xrfang"  написал:

> Hi All,
>
> I wrote a TPainter abstract class, and a TPaintRect class.  In the
> TPaintRect class I have this code:
>
> procedure TPaintRect.OnMouseEnter(Sender: TObject);
> var
>   i: Integer;
>   p: TPainter;
> begin
>   for i := 0 to painters.Count - 1 do begin
> p := TPainter(painters.Objects[i]);
> try
>   p.OnMouseEnter(Sender);
> except on EAbstractError do ; end;
>   end;
>   if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
> end;
>
> While running in IDE, the program will crash because OnMouseEnter is
> abstract.
>
> My problems are:
>
> 1) As I already wrapped it with try-except, I hope it won't trigger IDE
> exception. But even I turn off "Notify on Lazarus Exception" in debugger
> options it still pops up, and the popup said RunError(211), NOT
> EAbstractError.  The program runs well outside of IDE.
>
> 2) Is there a way to detect if an abstract method is implemented or not,
> without trying to call it and try...except?
>
> Thanks,
> Shannon
>
>
>
> --
> ___
> 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] Check if an abstract method is implemented or not

2013-01-24 Thread xrfang
Hi All,

I wrote a TPainter abstract class, and a TPaintRect class.  In the TPaintRect 
class I have this code:

procedure TPaintRect.OnMouseEnter(Sender: TObject);
var
  i: Integer;
  p: TPainter;
begin
  for i := 0 to painters.Count - 1 do begin
    p := TPainter(painters.Objects[i]);
    try
      p.OnMouseEnter(Sender);
    except on EAbstractError do ; end;
  end;
  if Assigned(FOnMouseEnter) then FOnMouseEnter(Sender);
end;

While running in IDE, the program will crash because OnMouseEnter is abstract.

My problems are:

1) As I already wrapped it with try-except, I hope it won't trigger IDE 
exception. But even I turn off "Notify on Lazarus Exception" in debugger 
options it still pops up, and the popup said RunError(211), NOT EAbstractError. 
 The program runs well outside of IDE.

2) Is there a way to detect if an abstract method is implemented or not, 
without trying to call it and try...except?

Thanks,
Shannon


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