Jump to content

TUniExtSpeedButton problem


Guest

Recommended Posts

Message from: "koney"

 

I want identify which one TUniSpeedButton is clicked,

but TUniExtSpeedButton is complied error.

How to fix the error ?

 

Koney

 

procedure TFrmBS00A.sbClick(Sender: TObject);

begin

if Sender is TUniExtSpeedButton then

begin

if (Sender as TUniExtSpeedButton).Name = 'sbFirst' then

begin

sbFirst.Enabled := False;

sbPrior.Enabled := False;

end;

 

if (Sender as TUniExtSpeedButton).Name = 'sbPrior' then

begin

..

end;

end;

end;

 

 

 

__________ Information from ESET Smart Security, version of virus signature database 5570 (20101028) __________

 

The message was checked by ESET Smart Security.

 

http://www.eset.com

 

 

 

 

.

 

Link to comment
Share on other sites

Message from: "Farshad Mohajeri"

 

"koney" wrote in message

news:hb51fMqdLHA.2080@anaxagvs227...

>I want identify which one TUniSpeedButton is clicked,

> but TUniExtSpeedButton is complied error.

> How to fix the error ?

>

> Koney

>

> procedure TFrmBS00A.sbClick(Sender: TObject);

> begin

> if Sender is TUniExtSpeedButton then

> begin

> if (Sender as TUniExtSpeedButton).Name = 'sbFirst' then

> begin

> sbFirst.Enabled := False;

> sbPrior.Enabled := False;

> end;

>

> if (Sender as TUniExtSpeedButton).Name = 'sbPrior' then

> begin

> ..

> end;

> end;

> end;

 

Rewrite your code as below:

 

procedure TFrmBS00A.sbClick(Sender: TObject);

begin

if UniIs(Sender, TUniSpeedButton) then

begin

if TUniSpeedButton(Sender).Name = 'sbFirst' then

begin

sbFirst.Enabled := False;

sbPrior.Enabled := False;

end;

 

if TUniSpeedButton(Sender).Name = 'sbPrior' then

begin

..

end;

end;

end;

 

I'm currently busy making some major changes to library core so such type

casting confusions will no longer happen.

 

 

 

 

 

 

 

.

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...