[Lazarus] Setting String Properties of Custom Component = AV
Lee Jenkins
lee at datatrakpos.com
Fri May 2 01:57:33 CEST 2008
Mattias Gaertner wrote:
> On Thu, 01 May 2008 14:31:13 -0400
> Lee Jenkins <lee at datatrakpos.com> wrote:
>
>> Lee Jenkins wrote:
>>> Lee Jenkins wrote:
>>>> Hi all, I have a custom component that I've created and I get an
>>>> AV anytime I try to change/set a string property within the IDE.
>>>> Setting these properties at runtime doesn't produce the AV.
>>>>
>>>> Also, the message that I get is simply "Access Violation". No
>>>> more information other than that.
>>>>
>>>> I'm using Lazarus 0.9.24.
>>>>
>>>> Thanks,
>>>>
>>> Also, I'm having another problem with this component. It's a
>>> TShape descendant and I have hooked up mousedown and mouseup events
>>> to change Pen.color and Brush.Color properties to different values
>>> in order to indicate visual feedback.
>
> MousDown and MouseUp events are handled by the IDE (designer).
>
>
Sorry Mattias, I wasn't clear enough. When I site the component at *design
time*, the mouse down events do not fire at *runtime*. In the create event, I
have this:
constructor TPOSButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.OnMouseDown := HandleMouseDown; // <== handlers with correct signatures.
self.OnMouseUp := HandleMouseUp;
end;
>>> If I create the component at runtime, the values work. IE: If I
>>> mouse down on the component the colors changes as expected. If I
>>> create the component at design time, then there is no change.
>>>
>>> I suspect there are some subtle difference in streaming or
>>> something between the way Delphi does it and Lazarus, but am at a
>>> loss as to what those could be.
>>>
>>> Thanks again,
>>>
>> Setting Mode to Delphi fixed it, but I'm curious as to how to get
>> this to work in FPC mode.
>
> Maybe this helps:
> http://www.freepascal.org/docs-html/prog/progap4.html#progse62.html
>
I'll take a look. Thank you.
--
Warm Regards,
Lee
More information about the Lazarus
mailing list