Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7977545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:13:54+00:00 2026-06-04T09:13:54+00:00

Here is my code to animate the TPanel when the mouse cursor is hovered

  • 0

Here is my code to “animate” the TPanel when the mouse cursor is hovered over it. I also have a code block to unanimate it.

procedure Tmain.pStarting1MouseEnter(Sender: TObject);
begin
  if sender = pStarting1 then pStarting1.BevelInner := bvLowered;
  if sender = pStarting2 then pStarting2.BevelInner := bvLowered;
  if sender = pStarting3 then pStarting3.BevelInner := bvLowered;
  if sender = pStarting4 then pStarting4.BevelInner := bvLowered;
  if sender = pStarting5 then pStarting5.BevelInner := bvLowered;
  if sender = pStarting6 then pStarting6.BevelInner := bvLowered;
  if sender = pStarting7 then pStarting7.BevelInner := bvLowered;
  if sender = pStarting8 then pStarting8.BevelInner := bvLowered;
  if sender = pStarting9 then pStarting9.BevelInner := bvLowered;
end;

As you can see, its very repetitious and since I have another 27 TPanels to animate, that would mean another 27 lines of repetitious code. So is there a way I can optimise this?

I have also tried placing that block of code into a separate procedure (in the same unit). but Delphi tells me that sender is undeclared.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:13:56+00:00Added an answer on June 4, 2026 at 9:13 am
    if Sender is TPanel then
      TPanel(Sender).BevelInner := bvLowered;
    

    or, if you are certain that Sender is always a TPanel, simply

    (Sender as TPanel).BevelInner := bvLowered;
    

    or (if you are really certain)

    TPanel(Sender).BevelInner := bvLowered;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is the code: http://jsfiddle.net/hQnXm/7/ So basically i need when hover, it should animate
enter code here I have a table on SQL server 2005 with bigint primary
I have some code, that simulate google images effect. How can I animate nested
I have two sortable lists, one being nested, with a mouse over effect on
Here is my code: dialog = $(this).closest('.ui-dialog') dialog.animate({ left: document.width - dialog.width(), // or
Here is my code for a mouseover: $('.caption').mouseover(function() { $(this).fadeTo('slow',1); $(this).css('color','#ddd').animate({'color': 'white'}, 500); $(this).css('font-weight','bold');
i found a code here, to let the mouse on the click and scroll
I'm trying to animate an image so that it centers itself. Here's the code
Here is a simple code to animate webview screen. But the problem is, the
Why can't I animate a background colour to transparent ? Here is my code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.