Re: MenĂº en Consola

Alexis Araya <[email protected]> Tue, 30 Aug 2011 11:55:29 -0400
Newsgroups gmane.comp.gnome.mono.hispano
Message-ID <CAGwkk==O_R3yOgh3Srx=yzv_PLCb+DZU8HiQCk3NUVPp-r=9Mg@mail.gmail.com>
--===============0641677657259646426==
Content-Type: multipart/alternative; boundary=000e0cd4d38e7c729104abbb0a2b

--000e0cd4d38e7c729104abbb0a2b
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

tal vez te sirva usar Monocurses

http://www.mono-project.com/MonoCurses

hechale un vistaso.

sldos desde Chile


2011/8/30 Luis <[email protected]>

> Hola colegas,
>
> Un buen d=EDa para todos.
>
> Hace tiempo que estoy compartiendo con Ud. pero en 'silencio'. Ya el
> silencio se acab=F3  :) .
>
> Resulta que estoy metido hasta el cuello con C# en Debian pero no me va
> muy bien. Estoy tratando de hacer un men=FA en la consola pero cuando tra=
to
> de compilar me da errores con los m=E9todos SetCursorPosition() y
> CursorVisible(). Me estoy guiando por un ejemplo hecho en windows. Sin
> embargo, en la consola interactiva si pinchan esos m=E9todos.
>
> Les pongo el c=F3digo, y el error, para que vean:
>
> using System;
>
> namespace Ventana
> {
>        public class Ventana
>        {
>                public string bordeSuperior =3D "-";
>                public string bordeInferior =3D "-";
>                public string bordeIzquierdo =3D "|";
>                public string bordeDerecho =3D "|";
>
>                bool mostrarCursor =3D true;
>
>                public Ventana(string bordesuperior, string bordeinferior,
> string
> bordeizquierdo, string bordederecho)
>                {
>                        bordeSuperior =3D bordesuperior;
>                        bordeInferior =3D bordeinferior;
>                        bordeIzquierdo =3D bordeizquierdo;
>                        bordeDerecho =3D bordederecho;
>                }
>
>                public void DibujarVentana(int x1, int y1, int largo, int
> alto)
>                {
>                        //ocultamos el cursor
>                        System.Console.CursorVisible =3D false;
>
>                        //linea superior
>                        for(int i=3D0; i<largo; i++)
>                        {
>                                Console.SetCursorPosition(x1+i,y1);
>                                Console.Write(bordeSuperior);
>                        }
>
>                        //linea izquierda
>        //                      for(i=3D2;i<40;i++)
>        //                      {
>
>        //                      }
>
>                        //linea derecha
>        //                      for(i=3D2;i<40;i++)
>        //                      {
>
>        //                      }
>
>                        //linea inferior
>                        for(int i=3D0; i<largo; i++)
>                        {
>                                Console.SetCursorPosition(x1+i,y2);
>                                Console.Write(bordeInferior);
>                        }
>
>                        //mostramos el cursor
>                        Console.CursorVisible =3D true;
>
>
>                }
>
>                public static void Main(string[] args)
>                {
>                        Ventana v =3D new Ventana("-", "-", "|", "|");
>                        v.DibujarVentana(2, 2, 140, 40);
>
>
>
>
>                }
>
>        }
> }
>
> Tambi=E9n quiero saber c=F3mo obtengo las coordenadas m=E1xima de la pant=
alla.
> Si alguien puede, aceptar=EDa alg=FAn buen ejemplo de c=F3mo implementar =
men=FA en
> consola.
>
> Error:
>
> ventanita.cs(43,40): error CS0117: `System.Console' does not contain a
> definition for `CursorVisible'
> /usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previou=
s
> error)
> ventanita.cs(48,41): error CS0117: `System.Console' does not contain a
> definition for `SetCursorPosition'
> /usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previou=
s
> error)
> ventanita.cs(67,41): error CS0117: `System.Console' does not contain a
> definition for `SetCursorPosition'
> /usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previou=
s
> error)
> ventanita.cs(72,33): error CS0117: `System.Console' does not contain a
> definition for `CursorVisible'
> /usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previou=
s
> error)
> Compilation failed: 4 error(s), 0 warnings
>
> Ahora, si hago esto:
>
> mcs -r:System.Console ventanita.cs
>
> error CS0006: cannot find metadata file `System.Console'
> Compilation failed: 1 error(s), 0 warnings
>
> Qu=E9 me est=E1 pasando?, please...
>
> --
> Saludos,
>
> Luis Esteban
> Linuxero por cuenta propia
> Cuba
>
> If Debian GNU/Linux can do it, you can do it too...
>
> --
>
> Este mensaje le ha llegado mediante el servicio de correo electronico que
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema
> Nacional de Salud. La persona que envia este correo asume el compromiso d=
e
> usar el servicio a tales fines y cumplir con las regulaciones establecida=
s
>
> Infomed: http://www.sld.cu/
> _______________________________________________
> Mono-hispano mailing list
> [email protected]
> https://listas.hispalinux.es/mailman/listinfo/mono-hispano
>



--=20
Alexis Araya S.
http://aarayas.blogspot.com
/* La Amistad se Pierde, Cuando la Envidia Crece */

--000e0cd4d38e7c729104abbb0a2b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

tal vez te sirva usar Monocurses<br><br><a href=3D"http://www.mono-project.=
com/MonoCurses">http://www.mono-project.com/MonoCurses</a><br><br>hechale u=
n vistaso.<br><br>sldos desde Chile<br><br><br><div class=3D"gmail_quote">2=
011/8/30 Luis <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected].=
sld.cu">[email protected]</a>&gt;</span><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;">Hola colegas,<br>
<br>
Un buen d=EDa para todos.<br>
<br>
Hace tiempo que estoy compartiendo con Ud. pero en &#39;silencio&#39;. Ya e=
l<br>
silencio se acab=F3 =A0:) .<br>
<br>
Resulta que estoy metido hasta el cuello con C# en Debian pero no me va<br>
muy bien. Estoy tratando de hacer un men=FA en la consola pero cuando trato=
<br>
de compilar me da errores con los m=E9todos SetCursorPosition() y<br>
CursorVisible(). Me estoy guiando por un ejemplo hecho en windows. Sin<br>
embargo, en la consola interactiva si pinchan esos m=E9todos.<br>
<br>
Les pongo el c=F3digo, y el error, para que vean:<br>
<br>
using System;<br>
<br>
namespace Ventana<br>
{<br>
 =A0 =A0 =A0 =A0public class Ventana<br>
 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public string bordeSuperior =3D &quot;-&quo=
t;;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public string bordeInferior =3D &quot;-&quo=
t;;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public string bordeIzquierdo =3D &quot;|&qu=
ot;;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public string bordeDerecho =3D &quot;|&quot=
;;<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bool mostrarCursor =3D true;<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public Ventana(string bordesuperior, string=
 bordeinferior, string<br>
bordeizquierdo, string bordederecho)<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bordeSuperior =3D bordesupe=
rior;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bordeInferior =3D bordeinfe=
rior;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bordeIzquierdo =3D bordeizq=
uierdo;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bordeDerecho =3D bordederec=
ho;<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public void DibujarVentana(int x1, int y1, =
int largo, int alto)<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//ocultamos el cursor<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.Console.CursorVisibl=
e =3D false;<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//linea superior<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(int i=3D0; i&lt;largo; =
i++)<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Console.Set=
CursorPosition(x1+i,y1);<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Console.Wri=
te(bordeSuperior);<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//linea izquierda<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(i=3D2;i&l=
t;40;i++)<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//linea derecha<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(i=3D2;i&l=
t;40;i++)<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
<br>
 =A0 =A0 =A0 =A0// =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//linea inferior<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for(int i=3D0; i&lt;largo; =
i++)<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Console.Set=
CursorPosition(x1+i,y2);<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Console.Wri=
te(bordeInferior);<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//mostramos el cursor<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Console.CursorVisible =3D t=
rue;<br>
<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public static void Main(string[] args)<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Ventana v =3D new Ventana(&=
quot;-&quot;, &quot;-&quot;, &quot;|&quot;, &quot;|&quot;);<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0v.DibujarVentana(2, 2, 140,=
 40);<br>
<br>
<br>
<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
<br>
 =A0 =A0 =A0 =A0}<br>
}<br>
<br>
Tambi=E9n quiero saber c=F3mo obtengo las coordenadas m=E1xima de la pantal=
la.<br>
Si alguien puede, aceptar=EDa alg=FAn buen ejemplo de c=F3mo implementar me=
n=FA en<br>
consola.<br>
<br>
Error:<br>
<br>
ventanita.cs(43,40): error CS0117: `System.Console&#39; does not contain a<=
br>
definition for `CursorVisible&#39;<br>
/usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previous<=
br>
error)<br>
ventanita.cs(48,41): error CS0117: `System.Console&#39; does not contain a<=
br>
definition for `SetCursorPosition&#39;<br>
/usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previous<=
br>
error)<br>
ventanita.cs(67,41): error CS0117: `System.Console&#39; does not contain a<=
br>
definition for `SetCursorPosition&#39;<br>
/usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previous<=
br>
error)<br>
ventanita.cs(72,33): error CS0117: `System.Console&#39; does not contain a<=
br>
definition for `CursorVisible&#39;<br>
/usr/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previous<=
br>
error)<br>
Compilation failed: 4 error(s), 0 warnings<br>
<br>
Ahora, si hago esto:<br>
<br>
mcs -r:System.Console ventanita.cs<br>
<br>
error CS0006: cannot find metadata file `System.Console&#39;<br>
Compilation failed: 1 error(s), 0 warnings<br>
<br>
Qu=E9 me est=E1 pasando?, please...<br>
<br>
--<br>
Saludos,<br>
<br>
Luis Esteban<br>
Linuxero por cuenta propia<br>
Cuba<br>
<br>
If Debian GNU/Linux can do it, you can do it too...<br>
<br>
--<br>
<br>
Este mensaje le ha llegado mediante el servicio de correo electronico que o=
frece Infomed para respaldar el cumplimiento de las misiones del Sistema Na=
cional de Salud. La persona que envia este correo asume el compromiso de us=
ar el servicio a tales fines y cumplir con las regulaciones establecidas<br=
>

<br>
Infomed: <a href=3D"http://www.sld.cu/" target=3D"_blank">http://www.sld.cu=
/</a><br>
_______________________________________________<br>
Mono-hispano mailing list<br>
<a href=3D"mailto:[email protected]">Mono-hispano@listas=
.mono-hispano.org</a><br>
<a href=3D"https://listas.hispalinux.es/mailman/listinfo/mono-hispano" targ=
et=3D"_blank">https://listas.hispalinux.es/mailman/listinfo/mono-hispano</a=
><br>
</blockquote></div><br><br clear=3D"all"><br>-- <br>Alexis Araya S.<br><a h=
ref=3D"http://aarayas.blogspot.com">http://aarayas.blogspot.com</a><br>/* L=
a Amistad se Pierde, Cuando la Envidia Crece */<br>

--000e0cd4d38e7c729104abbb0a2b--

--===============0641677657259646426==
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

_______________________________________________
Mono-hispano mailing list
[email protected]
https://listas.hispalinux.es/mailman/listinfo/mono-hispano
--===============0641677657259646426==--