Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

Hint at statusbar.

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Henrique Faria

Hello List.

I have this piece of code that shows the hint at statusbar on Delphi:

...

  private
    { private declarations }
    procedure AppHint(Sender : TObject);

...

procedure TFormPrincipal.AppHint(Sender: TObject);
begin
  StatusBar1.Panels[0].Text:= Application.Hint;
end;
procedure TFormPrincipal.FormCreate(Sender: TObject);
begin
  Application.OnHint:= AppHint;
end;

So i tried to run this code in lazarus and it says "Error: Wrong number of parameters specified for call to "AppHint" " in the procedure TFormPrincipal.FormCreate(Sender: TObject);

Which parameter i should specify for call to AppHint (Delphi doesn't need it)?

Can anyone help me?

_________________________________________________________________ Receba GR?TIS as mensagens do Messenger no seu celular quando voc? estiver offline. Conhe?a o MSN Mobile! http://mobile.live.com/signup/signup2.aspx?lc=pt-br -------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081030/77e22ac6/attachment.html

Reply by email

Graeme Geldenhuys
to Henrique Faria

2008/10/30 Henrique Faria :

I have this piece of code that shows the hint at statusbar on Delphi:

I take it you are using compiler mode "objfpc" which is the default compiler mode Lazarus specifies in units? Second line from the top in a new unit.

procedure TFormPrincipal.FormCreate(Sender: TObject); begin Application.OnHint:= AppHint; end;

In that case change the above line to

   Application.OnHint:= @AppHint;

And it should be fixed. Alternatively you can switch to the "delphi" compiler mode, but I would stick to the "objfpc" if I was you. It's a bit more strict, but makes for more correct code. [my personal opinion]

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Henrique Faria
to Graeme Geldenhuys

Thankyou, works fine.Henrique.

Date: Thu, 30 Oct 2008 23:10:04 +0200> From: > To: > Subject: Re: [Lazarus] Hint at statusbar.> > 2008/10/30 Henrique Faria :> >> > I have this piece of code that shows the hint at statusbar on Delphi:> > I take it you are using compiler mode "objfpc" which is the default> compiler mode Lazarus specifies in units? Second line from the top in> a new unit.> > > > procedure TFormPrincipal.FormCreate(Sender: TObject);> > begin> > Application.OnHint:= AppHint;> > end;> > In that case change the above line to> > Application.OnHint:= @AppHint;> > And it should be fixed. Alternatively you can switch to the "delphi"> compiler mode, but I would stick to the "objfpc" if I was you. It's a> bit more strict, but makes for more correct code. [my personal> opinion]> > > Regards,> - Graeme -> > > _______________________________________________> fpGUI - a cross-platform Free Pascal GUI toolkit> http://opensoft.homeip.net/fpgui/> _______________________________________________> Lazarus mailing list> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

_________________________________________________________________ Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o Messenger! ? GR?TIS! http://www.msn.com.br/emoticonpack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081030/f559cca6/attachment.html

Reply by email

Henrique Faria
to Luca Olivetti

It can't be done, because AppHint have to be private. And when i declare it public returns an error "raised exception class 'External: SIGSEGV' "

Henrique.

Show quoted text 20 lines
Date: Fri, 31 Oct 2008 08:34:38 +0100 From: To: Subject: Re: [Lazarus] Hint at statusbar. En/na Henrique Faria ha escrit: > Thankyou, works fine. Even easier: you can drop a TApplicationProperties component on the form (in the additional tab) and assign the OnHint event in the object inspector. Bye -- Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007 _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

_________________________________________________________________ Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o Messenger! ? GR?TIS! http://www.msn.com.br/emoticonpack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081031/dc5c014a/attachment.html

Reply by email

Luca Olivetti
to Henrique Faria

En/na Henrique Faria ha escrit:

It can't be done, because AppHint have to be private. And when i declare it public returns an error "raised exception class 'External: SIGSEGV' "

It's a bug in application.inc:

procedure TApplication.SetHint(const AValue: string);
begin
   if FHint = AValue then
     Exit;
   FHint := AValue;
   if Assigned(FOnHint) or (FApplicationHandlers[ahtHint].Count > 0) then
   begin
     FOnHint(Self);
     FApplicationHandlers[ahtHint].CallNotifyEvents(Self);

If you use TApplicationProperties.OnHint, FOnHint is *not* set, but the above code would try to execute it nevertheless, hence the SIGSEGV.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti
Show quoted text 22 lines
En/na Henrique Faria ha escrit: > It can't be done, because AppHint have to be private. And when i > declare it public returns an error "raised exception class > 'External: SIGSEGV' " It's a bug in application.inc: procedure TApplication.SetHint(const AValue: string); begin if FHint = AValue then Exit; FHint := AValue; if Assigned(FOnHint) or (FApplicationHandlers[ahtHint].Count > 0) then begin FOnHint(Self); FApplicationHandlers[ahtHint].CallNotifyEvents(Self); If you use TApplicationProperties.OnHint, FOnHint is *not* set, but the above code would try to execute it nevertheless, hence the SIGSEGV.

Thanks for the hint. Fixed in 17166.

Mattias

Reply by email