Fórum Relogio em Pascal #287029

05/07/2005

0

Estou tentando fazer um relogio em pascal mas nao posso utilizar uses alguem tem uma sugestao de codigo para eu utilizar.


Programadory

Programadory

Responder

Posts

06/07/2005

Khundalini

Fala mais sobre como vc quer fazer esse relógio em Pascal?

[]s
Rubem Rocha
Manaus, AM


Responder

Gostei + 0

06/07/2005

Programadory

Ele deve mostrar as horas da seguinte forma hora e minuto deve ficar embaixo na tela tipo o do menu iniciar do windows. So que nao posso fazer referencia a uses.

Ex:Uses crt;

Ele deve funcionar so no codigo.


Responder

Gostei + 0

06/07/2005

Khundalini

Então vc ñ vai conseguir fazer isso em Pascal é nunca! Vc precisa escrever isso em Delphi!

[]s
Rubem Rocha
Manaus, AM


Responder

Gostei + 0

06/07/2005

Programadory

Eu ja vi este projeto mas nao consegui copilar, eu so quero um relogio parecido com o do windows (que exibe horas e minutos).

Olha o codigo todo.


uses aRmouse,crt,dos;

const
push = true;
release = false;
Esc = #27;
Enter = 13;
main = 1;
pressed = 2;
nopressed = 3;
BlackAndWhite : boolean = false;
NoArrow : boolean = false;
color : array [false..true,main..nopressed] of integer=(
(Lightcyan,LightGray,LightCyan),(LightGray,White,LightGray));
BackGround : integer = Blue;

var ch : char;
i : integer;
x,y : byte;
who : EventStatus;
s : string;
CurrentArrow : ImageArrowName;

{$i Demo.inc} { <-Service Rutine : Time, SetCursor, NormalCursor,
Atr, HiddenCursor}


procedure Button( n : integer; status : boolean);
{-Draw Button n=1 - left; n=2 - centr; n=3 - right status=push/release}

procedure WriteXY(s:string;x,y:integer);
begin
Gotoxy(x,y);
Write(s);
end;

var
x : integer;
begin
if NumberOfButtons=3 then x:=28+(n-1)*6
else if n=1 then x:=30 else x:=38;
if Status=Release then
begin
Atr(color[BlackAndWhite,NoPressed],BackGround);
writeXY(´ÚÄÄÄ¿´,x,6);
writeXY(´³ÛÛÛ³´,x,7);
writeXY(´³ÛÛÛ³´,x,8);
writeXY(´³ÛÛÛ³´,x,9);
writeXY(´ÀÄÄÄÙ´,x,10);
end
else
begin
Atr(color[BlackAndWhite,Pressed],BackGround);
writeXY(´ÜÜÜÜÜ´,x,6);
writeXY(´ÝÜÜÜÞ´,x,7);
writeXY(´ÝÛÛÛÞ´,x,8);
writeXY(´ÝßßßÞ´,x,9);
writeXY(´ßßßßß´,x,10);
end;
Atr(color[BlackAndWhite,Main],BackGround);
end;

Procedure PushButton(status : EventStatus);
{-Draw Pushed Button}
begin
if ord(Status) and 1 = 1 then Button(1,Push);
if ord(Status) and 2 = 2 then Button(3,Push);
if ord(Status) and 4 = 4 then Button(2,Push);
end;

Procedure ReleaseButtons;
{-Draw all release Button}
var I : integer;
begin
if MouseReady then for i :=1 to 3 do Button(i,Release);
end;


Procedure DemoImageArrow;
begin
if (WhereArrowy>4)and(WhereArrowy<6) then
if WhereArrowx>73 then SelectNotPressedImage(DragArrowR) else
if WhereArrowx>69 then SelectNotPressedImage(DragArrowL) else
if WhereArrowx>65 then SelectNotPressedImage(ClockArrow) else
if WhereArrowx>61 then SelectNotPressedImage(HandArrow) else
if WhereArrowx>57 then SelectNotPressedImage(Hand1Arrow) else
if WhereArrowx>53 then SelectNotPressedImage(Hand3Arrow) else
if WhereArrowx>49 then SelectNotPressedImage(NormalArrow);
if (WhereArrowy>6)and(WhereArrowy<9) then
if WhereArrowx>73 then SelectNotPressedImage(Clock2Arrow) else
if WhereArrowx>69 then SelectNotPressedImage(DragArrow) else
if WhereArrowx>65 then SelectNotPressedImage(PencilArrow) else
if WhereArrowx>61 then SelectNotPressedImage(FootArrow) else
if WhereArrowx>57 then SelectNotPressedImage(Big2Arrow) else
if WhereArrowx>53 then SelectNotPressedImage(SightArrow) else
if WhereArrowx>49 then SelectNotPressedImage(PlusArrow);
end;

Procedure SetImageArrow;
begin
if (WhereArrowy>4)and(WhereArrowy<6) then
if WhereArrowx>73 then CurrentArrow:=DragArrowR else
if WhereArrowx>69 then CurrentArrow:=DragArrowL else
if WhereArrowx>65 then CurrentArrow:=ClockArrow else
if WhereArrowx>61 then CurrentArrow:=HandArrow else
if WhereArrowx>57 then CurrentArrow:=Hand1Arrow else
if WhereArrowx>53 then CurrentArrow:=Hand3Arrow else
if WhereArrowx>49 then CurrentArrow:=NormalArrow;
if (WhereArrowy>6)and(WhereArrowy<9) then
if WhereArrowx>73 then CurrentArrow:=Clock2Arrow else
if WhereArrowx>69 then CurrentArrow:=DragArrow else
if WhereArrowx>65 then CurrentArrow:=PencilArrow else
if WhereArrowx>61 then CurrentArrow:=FootArrow else
if WhereArrowx>57 then CurrentArrow:=Big2Arrow else
if WhereArrowx>53 then CurrentArrow:=SightArrow else
if WhereArrowx>49 then CurrentArrow:=PlusArrow;
end;


procedure DemoImage;
{-This procidure demo arrow image }
begin
if (WhereArrowx>49)and(WhereArrowx<77)and(WhereArrowy>4)and(WhereArrowy<9) then DemoImageArrow
else SelectNotPressedImage(CurrentArrow);
end;


procedure SelectImage;
{-This procidure select new arrow image }
begin
if (WhereArrowx>49)and(WhereArrowx<77)and(WhereArrowy>4)and(WhereArrowy<9) then SetImageArrow;
end;

{$F+}
Procedure ShowTime;
{-This procidure work into procedure GetEvent until
mouse button released}
begin
textcolor(color[BlackAndWhite,NoPressed]);
Time;
PushButton(CurrentStatus);
end;
{$F-}

{$F+}
procedure ShowTimeAndSwitchImage;
{-This procidure work into procedure GetEvent while not
mouse button released}
begin
textcolor(color[BlackAndWhite,Pressed]);
Time;
textcolor(color[BlackAndWhite,Main]);
DemoImage;
end;
{$F-}

Procedure DrawScreen;
{-Draw Screen Image}
begin
gotoxy(1,2);
Atr(color[BlackAndWhite,Main],BackGround);
writeln(´ DEMO of available mouse functions The C O L L E C T I O N of arrows. Press´);
writeln(´ ÉÊ» double click of left button for select.´);
writeln(´ Ì͹ ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ´);
writeln(´ ÉÍÍÍÍÍÍÍÍÊÍÊÍÍÍÍÍÍÍÍ» Û Û Û Û Û Û Û Û ´);
writeln(´ º º ÛÜÜÜÛÜÜÜÛÜÜÜÛÜÜÜÛÜÜÜÛÜÜÜÛÜÜÜÛ ´);
writeln(´ º º ÛßßßÛßßßÛßßßÛßßßÛßßßÛßßßÛßßßÛ ´);
writeln(´ º º Û Û Û Û Û Û Û Û ´);
writeln(´ º º ßßßßßßßßßßßßßßßßßßßßßßßßßßßßß ´);
writeln(´ Double click = ENTERÄ>º º<ÄÄÄÄÄ One click = ESC´);
If not MouseReady then
writeln(´ ºMOUSE NOT INSTALLEDº Double click = #127´)
else
writeln(´ º º Double click = 127´);
if (NumberOfButtons=2)or(NumberOfButtons=0) then
begin
writeln(´ º º´);
writeln(´ º º´);
writeln(´ º º´);
writeln(´ º º´);
end
else
begin
writeln(´ º ^ º´);
writeln(´ º ³ º´);
writeln(´ ºDouble click = 255º´);
writeln(´ º for center button º´);
end;
If not AMouse then
writeln(´ º NO GRAPHIC EFFECT º´)
else
writeln(´ º º´);
writeln(´ ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ´);
writeln(´ Press any key or mouse button´);
writeln;
writeln(´ Pressing of Button results in character under cursor and X,Y positions´);
writeln(´ Pressing of any KBD key results in Mouse to be sleeping until move´);
writeln(´ Press KBD Key <Esc> for EXIT´);
Atr(color[BlackAndWhite,Main],BackGround);
ReleaseButtons;
end;

{°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°}
{°°°°ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°°°}
{°°°°Û MAIN PROGRAMM for DEMO ARMOUSE UNIT Û°°°°}
{°°°°ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°°°}
{°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°}

begin { Unit ArMouse initiate Arrow before }
for i:=1 to paramcount do
begin
if paramstr(i) = ´/b´ then begin
BlackAndWhite:=true;
BackGround:=Black;
end
else if paramstr(i) = ´/n´ then begin
NoArrow:=true;
AMouse:=false;
end
else if paramstr(i) = ´/e´ then begin
DoneArrowMouse;
SwitchToEGA:=true;
ReInitArrowMouse;
if NoArrow then AMouse:=False;
end
else begin
writeln(´Syntax : demo [/b] [/n] [/e]´);
halt;
end;
end;
CurrentArrow:=NormalArrow; { Select image for demo }
Atr(color[BlackAndWhite,Main],BackGround);
{ Set Attribute }
Window(1,1,80,24);
ClrScr;
Window(1,1,80,25); { Prepare Screen }
HiddenCursor; { Set Key Board cursor invisible }
DrawScreen; { Draw MOUSE and text }
repeat { Main Cycle }

who:=GetEvent(ch, x, y, ShowTimeAndSwitchImage, ShowTime);

{ While not Event work 2 procedures }
{ 1) ShowTimeAndSwitchImage }
{ (until button not pressed) }
{ 2) ShowTime }
{ (while all button not released)}
case who of
Left_Button : s:= ´LeftButtonPressed ´;
Right_Button : s:= ´RightButtonPressed ´;
Both_Button : s:= ´BothButtonsPressed ´;
Center_Button : s:= ´CenterButtonPressed ´;
Left_Center_Button : s:= ´LeftAndCenterButtonsPressed ´;
Right_Center_Button : s:= ´RightAndCenterButtonsPressed´;
All3_Button : s:= ´All3ButtonsPressed ´;
KBD_Key : s:= ´KBDKeyPressed ´;
KBD_Special_Key : s:= ´KBDSpecialKeyPressed ´;
end; { Who pressed for write }
ReleaseButtons; { Draw Released Buttons }
if (ch=Enter) and (Who=Left_Button) then SelectImage;
{ Select image arrow if double click}
GoToXY(1,23);
Atr(color[BlackAndWhite,Main],BackGround);
if (ch=Enter)or(ch=#255) then write(´ ´,s,´ Character under cursor/KBD=[´,ord(ch),´] x=´,x,´ y=´,y,´ ´)
else Write(´ ´,s,´ Character under cursor/KBD=[´,ch,´] x=´,x,´ y=´,y,´ ´);
{ Write result to last line }
until (ch=Esc)and(who=KBD_Key);{ End Main Cycle}
DoneArrowMouse; { Disable Event Handler at all..}
NormalCursor; { Set cursor visible }
end.

Mas mesmo assim valeu a ajuda Khundalini.


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar