Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how can I manage an image with an edit box

Posted on 1998-04-30
5
Medium Priority
?
188 Views
Last Modified: 2010-04-06
Hi
1.-  I have I figure, like a circle with numbers from 0 to 360 degrees ( like a clock ).
2.-  Edit box will display the value choosed in the part 1.
so the question is how Can I do a figure that moving with the mouse I can select a number and after
number is displayed in an edit box.  
Any help for this,
Thanks
Guerra
0
Comment
Question by:guerra
[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
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
peter_vc earned 40 total points
ID: 1339812
The trick here is to use the OnMouseMove event.
Using the centre point of the image and simple trig, you can determine the angle of the imaginary line that connects the centre of the image to the current mouse position.  In the OnClick event, you set the contents of the edit box to the calculated angle.
0
 

Author Comment

by:guerra
ID: 1339813
Hi Peter-vc
I droped an image I don't know  what to do next,
if you've got some examples, can I have a look?
Thanks
Guerra
0
 
LVL 1

Expert Comment

by:peter_vc
ID: 1339814
Here is 15 points worth of examples.


unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Edit1: TEdit;
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1DblClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Y_Coord : Integer;
  X_Coord : Integer;
  Image_Centre_X : Double;
  Image_Centre_Y : Double;

implementation

{$R *.DFM}

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
     X_Coord := X;
     Y_Coord := Y;
end;

procedure TForm1.Image1DblClick(Sender: TObject);
var
   TheAngle : Double;
begin
     { Calculate angle here using X & Y_Coord, Image_Centre_X & Y }
     { For now just show Y_Coord }

     TheAngle := Y_Coord;

     { display it }
     Edit1.Text := FloatToStr(TheAngle);

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     Image_Centre_X := Image1.Width;
     Image_Centre_X := Image_Centre_X / 2;

     Image_Centre_Y := Image1.Height ;
     Image_Centre_Y := Image_Centre_Y / 2;
end;

end.

0
 

Author Comment

by:guerra
ID: 1339815
hi Peter
Thanks for the help, it is working, but could tell me how can i define the centre of the image, because the image takes the values from 0 at the top, the same for the width.
Thanks
guerra
0
 
LVL 1

Expert Comment

by:peter_vc
ID: 1339816
Look at the code (FormCreate event).  The centre is half the width and half the height.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

610 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