On Fri, 29 Dec 2006, Dave Coventry wrote:
> Ok, if I need to declare something when the program is starting up, where
> would I put it?
>
> I'm placing all my initialisation stuff in FormCreate, and all my housekeeping
> in FormClose.
>
> Clearly I need to re-evaluate this if FormResize comes before FormCreate.
No, your reasoning is correct.
The Lazarus behaviour is inconsistent with Delphi. During loading of
properties, the OnResize event should not be triggered.
In Delphi, the order of the events is respected.
You can remedy the situation by adding a check:
procedure TForm1.FormResize(Sender: TObject);
begin
If BufferBitmap<>Nil then
begin
BufferBitMap.Width:=Image1.Width;
BufferBitMap.Height:=Image1.Height;
end;
end;
Then it will work ok.
Michael.
>
> Dave Coventry wrote:
> > Oh.
> >
> > :-[
> >
> > Michael Van Canneyt wrote:
> > > On Fri, 29 Dec 2006, Dave Coventry wrote:
> > >
> > >
> > > > Hi,
> > > >
> > > > If I set the size of the TBitmap in the FormCreate procedure rather than
> > > > the
> > > > FormResize procedure, then the error does not arise.
> > > >
> > > > In other words, if I have the following:
> > > > //~~~~~~~~~~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~~~~~~~~~~
> > > > BufferBitMap:=TBitMap.Create;
> > > > BufferBitMap.Width:=Image1.Width;
> > > > BufferBitMap.Height:=Image1.Height;
> > > > //~~~~~~~~~~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~~~~~~~~~~
> > > > in the same procedure rather than splitting it up over 2 different
> > > > procedures,
> > > > then I don't get the SIGSEGV error.
> > > >
> > >
> > > That's because the OnResize method is called before OnCreate.
> > >
> > > Michael.
> > >
> > >
> > > > Dave Coventry wrote:
> > > >
> > > > > Marc Weustink wrote:
> > > > >
> > > > > > Can you give us a little code sample ?
> > > > > >
> > > > > > Marc
> > > > > Yes, certainly:
> > > > > //~~~~~~~~~~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~~~~~~~~~~
> > > > > var
> > > > > BufferBitMap:TBitmap;
> > > > >
> > > > > procedure TForm1.FormCreate(Sender: TObject);
> > > > > begin
> > > > > BufferBitMap:=TBitMap.Create;
> > > > > end;
> > > > >
> > > > > procedure TForm1.FormResize(Sender: TObject);
> > > > > begin
> > > > > BufferBitMap.Width:=Image1.Width;
> > > > > BufferBitMap.Height:=Image1.Height;
> > > > > end;
> > > > > //~~~~~~~~~~~~~~~~~~~~~~~ snip ~~~~~~~~~~~~~~~~~~~~~~~
> > > > >
> > > > >
> > > > --
> > > > Dave Coventry
> > > > Tel: +27(0)31 3092301
> > > > Fax: +27(0)31 3092301
> > > > Cell: +27(0)82 3685983
> > > >
> >>> _________________________________________________________________
> > > > To unsubscribe: mail [EMAIL PROTECTED] with
> > > > "unsubscribe" as the Subject
> > > > archives at http://www.lazarus.freepascal.org/mailarchives
> > > >
> > > >
> > > >
> > >
> >> _________________________________________________________________
> > > To unsubscribe: mail [EMAIL PROTECTED] with
> > > "unsubscribe" as the Subject
> > > archives at http://www.lazarus.freepascal.org/mailarchives
> > >
> > >
> > >
> >
> >
>
>
> --
> Dave Coventry
> Tel: +27(0)31 3092301
> Fax: +27(0)31 3092301
> Cell: +27(0)82 3685983
>
> _________________________________________________________________
> To unsubscribe: mail [EMAIL PROTECTED] with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
>
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives