Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Component Visible  using Mouse

Posted on 2003-03-10
3
Medium Priority
?
174 Views
Last Modified: 2010-04-04
I have a project which has an Timage on the form. When i bring the mouse over it i want it to show a hidden panel and when i move the mouse off the image the panel should become invisible. I have put code in the image mouse move which is

if panel1.visible then panel1.hide else panel1.show;

However to get this to work i heve to move the mouse on to the image to show the panel and off and on to hide it

I want the panel to act as a hint.

How is it done?
0
Comment
Question by:Al_Shepstone
3 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 80 total points
ID: 8102360
here is a sample:


  TForm1 = class(TForm)
    Image1: TImage;
    Panel1: TPanel;
  ....
    procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
  end;



procedure TForm1.CMMouseEnter(var Message: TMessage);
begin
  if Message.LParam = Integer(Image1) then
    Panel1.Visible := True;
end;

procedure TForm1.CMMouseLeave(var Message: TMessage);
begin
  if Message.LParam = Integer(Image1) then
    Panel1.Visible := False;
end;


----
Igor
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8102394
Hi.

Use the CM_MOUSELEAVE and CM_MOUSEENTER messages.


private
  procedure CmMouseEnter(var Msg : TCmMouseEnter); message CM_MOUSEENTER;
  procedure CmMouseLeave(var Msg : TCmMouseLeave); message CM_MOUSELEAVE;

...

procedure TForm1.CmMouseEnter(var Msg : TCmMouseEnter);
begin
  if (TImage(Msg.Sender) = Image1) then
   Label1.Caption := 'Over Me';
end;

procedure TForm1.CmMouseLeave(var Msg : TCmMouseLeave);
begin
  if (TImage(Msg.Sender) = Image1) then
   Label1.Caption := 'Not Over Me';
end;

(not tested!)

Markus
0
 

Author Comment

by:Al_Shepstone
ID: 8102652
Thanks for your help

Al
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Screencast - Getting to Know the Pipeline
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question