Sliding an image and running problems!

Posted on 2003-03-22
Medium Priority
Last Modified: 2010-04-04
I've got two problems here, one is with delphi running. My project was working fine until I restarted my computer the next morning and clicked run on my project. It looked like it was about to run but then instantly closed and went back to my Form. It does it so fast you can't see what is happening..
So basically, when I click run it just loops back to the form and there are no errors.

Also, I want to how to:

Create an image on the screen that has a hotspot on it (Just give me an example for now) that is located with X,Y. Then when someone clicks this Hotspot, the image slides from one place to another, say 200 pixels left but you see it slide along. Thankyou!

Question by:99jfender
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

Accepted Solution

LukA_YJK earned 500 total points
ID: 8186480
I use Shape instead of a hotspot and it works fine. Set border of the Shape to zero, then it will be invisible, but it will generate OnClick event where you can write with Image1 do Left := Left - 200;

Expert Comment

ID: 8186483
Regarding your problem maybe deleting some additional files (like .dsk, .dof) will solve it?
LVL 34

Assisted Solution

Slick812 earned 500 total points
ID: 8186826
hello 99jfender,, You could define your Image "HotSpots" with another Component, but you could just define your Click Rect and then test the position if the cursor in the TImage OnMouseUp with PtInRect( ). . . . If you want to do simple movement, you will use a TTimer with the Interval set at around 55 milliseconds and then change the position about 3 pixels in the Timer Event, , , some code -

    { Private declarations }
    ClickRect1, ClickRect2: TRect;

procedure TForm1.FormCreate(Sender: TObject);
ClickRect1 := Rect(8,8,38, 28);
ClickRect2 := Rect(8,38,38, 58);

procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
if PtInRect(ClickRect1, Point(X,Y)) then
Timer2.Enabled := True;
if PtInRect(ClickRect2, Point(X,Y)) then
ShowMessage('Click Rect Two');

procedure TForm1.Timer2Timer(Sender: TObject);
if Image1.Left < 51 then
  Timer2.Enabled := False;
{kill timer when new position is reached}
Image1.Left := Image1.Left-3;

 - - - - - - - - - - - - - - - - - - - - - - - - -
I can't help with your program running problem, all the info that I know about that problem is - that it used to run and now it does not.
LVL 20

Expert Comment

by:Mark Brady
ID: 8187638
I had a similar problem recently.  When I went to run my project, it wouldn't compile, but if I ran the exe from outside of Delphi, I found windows was still using it.  So delete or rename the exe then try again.  Else reboot.


Expert Comment

ID: 9316637
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
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…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 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