Pascal/Turbo Pascal - Duda ¿Cómo crear una interfaz GUI para mi programa?

 
Vista:

Duda ¿Cómo crear una interfaz GUI para mi programa?

Publicado por wind (26 intervenciones) el 14/03/2014 17:42:45
Saludos.

Deseo crear una interfaz GUI, con este sencillo programa. ¿Me puedes ayudar? si es posible explicando, si es muy complejo, sugiero usar imágenes.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
program Temperature;
var
F,C,R,K:real;
begin
(*Presentación del programa*)
writeln('Convertidor de temperatura');
writeln('Programa creado por Benjamin C.');
(*Captura de datos*)
write('Escribe la temperatura en grados celcius:');
readln(C);
F:=1.8*C+32;
R:=F+459.67;
K:=C+273.15;
writeln('La temperatura en grados Fahrenheit es:',F:2:2);
writeln('La temperatura en grados Rankine es:',R:2:2);
writeln('La temperatura en grados Kelvin es:',K:2:2);
readln;
end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Duda ¿Cómo crear una interfaz GUI para mi programa?

Publicado por ramon (2158 intervenciones) el 22/03/2014 13:57:47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{ Mira a ver si es algo parecido a esto }
 
program interfaz_GUI;
 uses
   crt, graph;
 
 var
   drive, mode : integer;
   F,C,R,K:real;
   ten, OrigMode: Integer;
 
 
  procedure iniciograficos;
  begin
      OrigMode := LastMode;
      drive := detect;
      initgraph(drive,mode,'c:\tp\bgi'); {modifica esto si no lo tienes así a tu configuración pascal}
      if graphresult <> 0 then
      halt(1)
    else
       begin
          outtextxy((getmaxx div 2) - (26 * 8),1,'Convertidor de temperatura Programa creado por Benjamin C.');
       end;
  end;
 
 procedure borrado(x, y : integer);
 var
   d, h : integer;
 begin
    for d := x to x + 8 do
     for h := y to y + 9 do
     begin
        putpixel(d,h,0);
     end;
 end;
 
 procedure temperatura;
 var
   Fahrenheit,Rankine,Kelvin : string[16];
   erro, t : integer;
   valorreal : string[16];
   tecl : char;
 begin
    t := 1;
    outtextxy(10,10,'Escribe la temperatura en grados celcius : ');
   repeat
       tecl := readkey;
       if tecl in[#48..#57,#46,#44] then
       begin
          if tecl = #44 then
          tecl := #46;
          valorreal[t] := tecl;
          valorreal[0] := chr(t);
          outtextxy((43 * 8) + t * 8,10,valorreal[t]);
          t := t + 1;
          if t > 16 then
          t := 16;
       end;
   if tecl = #8 then
   begin
      t := t - 1;
      if t < 1 then
      t := 1;
      valorreal[t] := ' ';
      valorreal[0] := chr(t);
      borrado((43 * 8) + t * 8,10);
   end;
   until tecl = #13;
    val(valorreal,f,erro);
    if erro > 0 then
    begin
       delete(valorreal,erro,1);
       val(valorreal,f,erro);
    end;
    ten := round(f);
    F := 1.8 * C + 32;
    R := F + 459.67;
    K := C + 273.15;
    str(f:2:2,Fahrenheit);
    str(r:2:2,Rankine);
    str(k:2:2,Kelvin);
    rectangle(4,27,450,40);
    outtextxy(10,30,'La temperatura en grados Fahrenheit es : ' + Fahrenheit);
    rectangle(4,47,450,60);
    outtextxy(10,50,'La temperatura en grados Rankine es : ' + Rankine);
    rectangle(4,67,450,80);
    outtextxy(10,70,'La temperatura en grados Kelvin es : ' + Kelvin);
   end;
 
  procedure termometro(tempe : real);
  var
    des, i : integer;
  begin
     rectangle(320,90,393,440);
     outtextxy(330,98,'§C');
     outtextxy(369,98,'§F');
     outtextxy(325,350,'40');
     outtextxy(325,330,'30');
     outtextxy(325,310,'20');
     outtextxy(325,290,'10');
     outtextxy(325,270,' 0');
     outtextxy(325,250,'10');
     outtextxy(325,230,'20');
     outtextxy(325,210,'30');
     outtextxy(325,190,'40');
     outtextxy(325,170,'50');
     outtextxy(364,350,'40');
     outtextxy(364,325,'20');
     outtextxy(364,305,' 0');
     outtextxy(364,285,'20');
     outtextxy(364,260,'40');
     outtextxy(364,240,'60');
     outtextxy(364,220,'80');
     outtextxy(364,195,'100');
     outtextxy(364,170,'120');
     circle(354,402,20);
     rectangle(349,382,359,100);
     for i := 0 to 8 do
     putpixel(350 + i,382,0);
     setcolor(13);
 
 
     for i := 1 to 19 do
     circle(354,402,i);
     setcolor(15);
  end;
 
 begin
     iniciograficos;
     temperatura;
     termometro(2.8);
     readkey;
     closegraph;
     TextMode(OrigMode);
 end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar