Jump to content

Recommended Posts

Posted

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

 

 

 

 

.

 

Posted

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.

 

 

 

 

 

 

 

.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...