Hi,

First time here, and no good at all with trig, I am using a Clipsal c-bus touch screen that on a page I have created a clock with hr min and sec hands, so most of the clock is there I'd just like to add the arrows to the ends of each hand.

The code below is from the logic engine, it uses a form of Pascal for programming.

I have added code to show the hr min and sec in circles at the ends of the hands but would prefer arrows on them.

Any ideas or help is appreciated.

regards

Trevor

{Enter Constant definitions here}

ssTimeOutTimer = 1;

ssPageTimer = 2;

countdown = 1;

time1 = 1;

time2 = 1;

AfterHoursTimer = 1;

AfterHoursControlGroup = 16;

SaveAndOffGroup = 17;

WorkHoursGroup = 254;

dcCentreX = 320;

dcCentreY = 240;

dcClockRadius = 200;

dcCentreXa = 320;

dcCentreYa = 240;

dcClockRadiusa = 200;

dcCentreXb = 320;

dcCentreYb = 240;

dcClockRadiusb = 200;

{ Draw a line segment.

Angle is 0 to 59 (as in the seconds on the clock)

Length1 = distance line starts from centre

Length2 = distance line ends from centre }

procedure DrawSegment(Length1, Length2, Angle : integer);

var

ActualAngle : real;

X1, X2, Y1, Y2 : integer;

begin

ActualAngle := (angle - 15)/30 * Pi;

if Length1 = 0 then

begin

X1 := dcCentreX;

Y1 := dcCentreY;

end

else

begin

X1 := dcCentreX + round(cos(ActualAngle) * Length1);

Y1 := dcCentreY + round(sin(ActualAngle) * Length1);

end;

X2 := dcCentreX + round(cos(ActualAngle) * Length2);

Y2 := dcCentreY + round(sin(ActualAngle) * Length2);

MoveTo(X1, Y1);

LineTo(X2, Y2);

TextPos(X2-60, Y2-11);

end;

AND

if ShowingPage("CLOCK") then

begin

ClearScreen;

{ draw time markers }

{Ellipse(Left, Top, Bottom, Right);}

SetBrushStyle(1);

SetPenWidth(5);

SetPenStyle(0);

SetPenColor(clwhite);

Ellipse(85, 10, 555, 470);

SetPenColor(clblack);

SetPenWidth(3);

for dcCount := 0 to 11 do

DrawSegment(dcClockRadius +15, dcClockRadius + 28, dcCount * 5);

SetBrushColor(clwhite);

SetPenColor(clwhite);

{center circle}

Ellipse(dcCentreX - 5, dcCentreY - 5, dcCentreX + 5, dcCentreY + 5);

SetPenColor(clRed);

DrawSegment(0, dcClockRadius, Minute);

SetPenColor(clRed);

SetPenWidth(5);

DrawSegment(0, dcClockRadius div 2, Hour * 5 + Minute div 12);

SetPenColor(clblue);

SetPenWidth(1);

DrawSegment(0, dcClockRadius-40, Second);

SetFontSize(16);

SetPenWidth(30);

SetPenColor(clwhite);

DrawSegment(160, dcClockRadius-40, Second);

DrawText(Second);

DrawSegment(200, dcClockRadius, Minute);

DrawText(Minute);

DrawSegment(100, dcClockRadius div 2, Hour * 5 + Minute div 12);

DrawText(Hour);

end;