?
Solved

Sliding an image and running problems!

Posted on 2003-03-22
7
Medium Priority
?
165 Views
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!

0
Comment
Question by:99jfender
[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
7 Comments
 
LVL 3

Accepted Solution

by:
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;
0
 
LVL 3

Expert Comment

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

Assisted Solution

by:Slick812
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
    { Private declarations }
    ClickRect1, ClickRect2: TRect;

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

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

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


 - - - - - - - - - - - - - - - - - - - - - - - - -
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.
0
 
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.

Mark
0
 

Expert Comment

by:CleanupPing
ID: 9316637
99jfender:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

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