?
Solved

Component Visible  using Mouse

Posted on 2003-03-10
3
Medium Priority
?
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 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