Guest Posted October 28, 2010 Share Posted October 28, 2010 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 . Quote Link to comment Share on other sites More sharing options...
Guest Posted October 28, 2010 Author Share Posted October 28, 2010 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. . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.