[lazarus] I got tired of waiting for a TMaskedEdit

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Apr 16 03:07:32 EDT 2003


On 16 Apr 2003 02:17:32 -0500
Tony Maro <tony at maro.net> wrote:

> On Wed, 2003-04-16 at 01:57, Mattias Gaertner wrote:
> > On 16 Apr 2003 01:41:44 -0500
> > Tony Maro <tony at maro.net> wrote:
> >
> > > I've noticed that the csDesigning check doesn't seem to work anymore. 
> > > Is there a bug in Lazarus or the LCL that breaks this?  I can't get
> > > the designing check to work in anything I do...
> > 
> > It works for me. When/Where do you check csDesigning?
> > 
> 
> Well, the mask.pp is pretty complex in that and may have a bug, however
> the help system component I'm working on is simple.
> 
> constructor THelpSystem.create(AOwner: TComponent);
> begin
>   // squeeze myself into the form's OnKeyUp event
>   // without ignoring anything already set there...
>   FForm := nil;
>   FOldKeyUp := nil;
>   FItems := TStringList.Create;
>   
>   if not(csDesigning in componentstate) then begin
>     if AOwner is TForm then begin
>       FForm := AOwner as TForm;
>       if assigned(FForm.OnKeyUp) then begin
>         FOldKeyUP := FForm.OnKeyUp;
>       end;    
>       FForm.OnKeyUP := @FormKEYUP;
>       FForm.KeyPreview := True;
>     end;
>   end;
>   
>   inherited create(AOwner);
> end;

csDesigning is copied from its owner in the constructor of TComponent.
Before the 'inherited Create' you can use this:

if (Owner<>nil) and not (csDesigning in Owner.componentstate) then begin


Mattias


> Despite the fact that the section that assigns the OnKeyUp event is
> supposed to be checking to see if we're csDesigning, as soon as you drop
> this component on a form, it affects the OnKeyUp event of the form,
> changing it to "<unpublished>".
> 
> Now, I don't plan on using this code later, because of the changes
> discussed, but it illustrates the problem I'm having.
> 
> This is a fresh CVS download of Lazarus from a few hours ago.
> 
> -Tony
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives






More information about the Lazarus mailing list