tag:blogger.com,1999:blog-18833389407753244282024-02-19T06:17:08.520+01:00Gambas-BásicoComenzar con GambasShellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-1883338940775324428.post-52048669183179910022017-02-07T10:34:00.000+01:002017-02-07T10:34:24.219+01:00Gambas y tu.Buenos días.<br />
<br />
La idea de este post es preguntaros a vosotros, en lo que empleáis Gambas<br />
y o que aplicación o tipo de aplicación os gustaría crear con el lenguaje<br />
Gambas. Los comentarios deben ser constructivos.<br />
Contestar a las que más os agrade o consideres más importante.<br />
<br />
<ul>
<li> ¿ Eres estudiante ?. ¿ Estudias Gambas en tu escuela ?.</li>
<li> Si la respuesta fue positiva. ¿ Te gusta estudiar Gambas ?.</li>
<li>¿ Crees que es un lenguaje difícil o fácil de aprender ?. </li>
<li>¿ Cómo mejorarías su enseñanza o aprendizaje ?.</li>
<li>¿ Estudias la programación por hobby o por profesión ?.</li>
<li>¿ Usas Gambas en tu trabajo ? </li>
<li>¿ Qué opinas de Gambas ?.</li>
<li>¿ Qué te gustaría añadirle ?.</li>
<li>¿ Qué aplicación te gustaría crear ?.</li>
<li>¿ Qué tipo de aplicaciones te gustan más ?.</li>
<li>¿ Cuáles te gustan menos ?. </li>
</ul>
<br />
Pues estas son algunas preguntas. :-D<br />
Ahora sois vosotros los que tenéis que responder.<br />
<br />
Saludos<br />
<br />
Shell<br />
<br />
<br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-35885230636215500452016-05-22T10:32:00.001+02:002016-05-22T10:32:31.887+02:00Saludos a todos/as
<style type="text/css">p { margin-bottom: 0.25cm; line-height: 120%; }a:link { }</style>
<br />
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Buenos días!.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Deciros que nunca me
fui, estuve de vez de en cuando revisando el blog. Aunque lo tengo
muy abandonado por motivos de falta de tiempo, no se puede llevar
todo por delante.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Mi idea de cuando
hice el blog es la de hacer los ejemplos lo más sencillos posibles
para que cualquiera pueda entenderlos. </div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br /></div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
No es un blog en el que
pretendo demostrar dotes de diseño.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Siempre me ha
gustado mas mostrar la información sin florituras.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Siempre que tengáis
un problema o duda, comentar. A veces no puedo responder rápidamente. En el ultimo mensaje
he respondido con un mes de atraso. Llevaba un mes que fue imposible contestar. Si sabéis
lo que son las obras, lo entenderéis, por eso no pude contestar al
comentario del post sobre
ListBox.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Sigo practicando
Gambas, es un gran lenguaje con el que podréis hacer la gran mayoría de los proyectos de
programación que se os ocurra.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Deciros y
recomendaros que visitéis la comunidad Gambas-es. Allí estamos
todos los usuarios de muchos lugares
del mundo.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<a href="http://www.gambas-es.org/" target="_blank">www.gambas-es.org</a></div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Un gran saludo.</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="line-height: 100%; margin-bottom: 0cm; text-align: justify;">
Shell</div>
Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com2tag:blogger.com,1999:blog-1883338940775324428.post-8006224297672533452012-08-25T10:22:00.001+02:002022-07-11T20:56:12.133+02:00Control Timer
<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div style="text-align: justify;">
Algunas veces necesitamos en una parte de nuestra aplicación añadir
un retardo.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Un evento cada cierto tiempo. Ya sea para la creación de un archivo.
Comprobar</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
la existencia de este archivo,la ejecución de un proceso cada x
segundos.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Este control tiene propiedades importantes como son:</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<ul style="text-align: justify;">
<li><div style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Delay</div>
</li>
<li><div style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Enabled</div>
</li>
</ul>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Delay es la cantidad de tiempo o el retardo que se produce cada x
milisegundos
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
antes de ejecutar un grupo de instrucciones incluidas dentro del
código del Timer.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
El valor de la propiedad esta por defecto en 1000 mS, un segundo. :-)</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
¿ Como hacemos para activar nuestro Timer ?.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Lo podemos hacer de dos formas.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer.Enabled = True</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Activa el Timer. O de una manera mas sencilla.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer.Start</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Y nos ahorramos algo de código.
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Para parar nuestro timer hacemos:</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer.Enabled = false</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Ó</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer.Stop</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Nuestro código se encuentra en el procedimiento del Timer tal que
así:</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
PUBLIC SUB Timer1_Timer()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
END</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
En el podemos añadir nuestro código o también llamadas a otros
procedimientos.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
A continuación os muestro varios ejemplos con este componente:</div>
<br />
<br />
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Imitación de una barra de progreso con el componente Label y Timer.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBl_2RnlBJZaW94ItFYoc7WhhmbZxIUqQzBn4RB_XcL6YHFtWHllREWEU5QETt6-tYhEiII1xRf0G5OupR4Iz6XaqknUtnHIkeWX2JLR_OzsSssq3bydAt5XXIVFx0MEBwVsFg3EEeFPY/s1600/Simula+barra+de+progreso.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="119" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBl_2RnlBJZaW94ItFYoc7WhhmbZxIUqQzBn4RB_XcL6YHFtWHllREWEU5QETt6-tYhEiII1xRf0G5OupR4Iz6XaqknUtnHIkeWX2JLR_OzsSssq3bydAt5XXIVFx0MEBwVsFg3EEeFPY/s320/Simula+barra+de+progreso.png" width="320" /></a></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Timer1_Timer()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
lblBarra.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
< <span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">335</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lblBarra.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
lblBarra.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">+</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">5</span></span></span>
<span style="color: teal;"><i><span style="font-weight: normal;">'Aumentamos
el ancho de la barra en 5,10,20...</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Else</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Stop</span></span></span>
<span style="color: teal;"><i><span style="font-weight: normal;">'Se
para el Timer1</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Endif</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Form_Open()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Inicializamos
los valores </span></i></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Simula
barra de progreso"</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Center</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Podemos
asignar estos valores en las propiedades de los componentes</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lblBarra.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lblBarra.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Background</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Color.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Blue</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Delay</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">50</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Start</span></span></span>
<span style="color: teal;"><i><span style="font-weight: normal;">'Iniciamos
el Timer1</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Un reloj:</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEie8lGyIqFjngDNAfl9HczZQYxe73g1zf6PJjKdg8NJQsR2w3kp8VIFeBpfp6VG6hXAZbuX1RapqUeHxpvdy7No37JTz26Y6aAJ4SKVlHXFa6gFvmmpK5bA1LGoJEWTlx9hjxacDa6pLVM/s1600/Reloj.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEie8lGyIqFjngDNAfl9HczZQYxe73g1zf6PJjKdg8NJQsR2w3kp8VIFeBpfp6VG6hXAZbuX1RapqUeHxpvdy7No37JTz26Y6aAJ4SKVlHXFa6gFvmmpK5bA1LGoJEWTlx9hjxacDa6pLVM/s1600/Reloj.png" /></a></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
_new()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Form_Open()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"RELOJ"</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Timer1_Timer()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
tiempo <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Date</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
tiempo <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Time</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lblreloj.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Text</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Format</span></span></span>$(tiempo,
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"hh:nn:ss"</span></span></span>)</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
cmdIniciar_Click()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Start</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
cmdDetener_Click()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Stop</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Un temporizador:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsRckRyOysjppc07nli4PacZhw0OBil4PK0uDz4jDCgrroaaPsVBeHZJHyM0cZ2VUJgPllRQq_Kt52qlv_lMwdiNVk0AEV177jhpljFnjOciYa5_HYzMGER3W2yhBLzxLsbFtn1Y18Bx0/s1600/Temporizador.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsRckRyOysjppc07nli4PacZhw0OBil4PK0uDz4jDCgrroaaPsVBeHZJHyM0cZ2VUJgPllRQq_Kt52qlv_lMwdiNVk0AEV177jhpljFnjOciYa5_HYzMGER3W2yhBLzxLsbFtn1Y18Bx0/s1600/Temporizador.png" /></a></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Private</span></span></span>
inicio <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Date</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
_new()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Form_Open()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"TEMPORIZADOR"</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Timer1_Timer()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
tiempo <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Date</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
tiempo <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Time</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">-</span></span></span>
inicio</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lbltempo.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Text</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Format</span></span></span>$(tiempo,
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"hh:nn:ss"</span></span></span>)</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
cmdIniciar_Click()
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
inicio <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Time</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Start</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
cmdDetener_Click()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Stop</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Con pocas instrucciones hemos creados dos aplicaciones que pueden ser
útiles.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Hemos visto la instrucción Format. Nos muestra en la etiqueta el
contenido de la</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
variable tiempo con el formato horas,minutos,segundos con dos dígitos
cada una.</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<a href="http://gambasdoc.org/help/cat/userformat?es">Función Format</a><br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Un ejemplo más:</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">' Gambas
class file</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PRIVATE</span></span></span>
estado <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">AS</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Boolean</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PRIVATE</span></span></span>
alerta <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">AS</span></span></span>
Sound</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PRIVATE</span></span></span>
canal1 <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">AS</span></span></span>
Channel</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'La
aplicación usara la pantalla completa,usar Alt-Tabulador para
cambiar</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'entre
aplicaciones y usar stop del editor.Esto hay que cambiarlo</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PUBLIC</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">SUB</span></span></span>
_new()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PUBLIC</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">SUB</span></span></span>
Form_Open()
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Ajustamos
el tamaño del formulario </span></i></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">ME</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Desktop</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Height</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Desktop</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Height</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">FullScreen</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">TRUE</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Ajustamos
propiedades de la etiqueta</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
lbMensaje</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Alignment</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Align.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Center</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Cambiar
el divisor por un valor más grande si no entra todo el texto en
vuestra pantalla.</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'En
este equipo uso 1680x1050</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Font</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Size</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
lbMensaje.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Height</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">/</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1.2</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Font</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Bold</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">TRUE</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Cambiamos
o creamos las propiedades para el sonido</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Channels.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Count</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
canal1 <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Channels[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0</span></span></span>]</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
canal1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Volume</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0.4</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
alerta <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">NEW</span></span></span>
Sound[<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Alert.wav"</span></span></span>]
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Timer1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Start</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PUBLIC</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">SUB</span></span></span>
Timer1_Timer()</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
canal1.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Play</span></span></span>(alerta)
<span style="color: teal;"><i><span style="font-weight: normal;">'Hacemos
sonar el sonido que contiene la variable alerta</span></i></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Cada
segundo cambia el contenido del texto de la etiqueta </span></i></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">IF</span></span></span>
estado <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">FALSE</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">THEN</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
lbMensaje</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Background</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Color.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Yellow</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Foreground</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Color.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Red</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Text</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"ALERTA"</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">WITH</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">ELSE</span></span></span>
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
lbMensaje.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Text</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"INTRUSO"</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
ENDIF
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
estado <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #804040;"><span style="font-style: normal;"><span style="font-weight: normal;">NOT</span></span></span>
estado</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">END</span></span></span></div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<a href="https://drive.google.com/file/d/12Cc7tEH9xeM-sSnjZlQfXdEG3hX-ymXX/view?usp=sharing">Los tres primeros ejemplos</a><br />
</div><div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-align: justify; text-decoration: none;">
<br />
</div>
<div style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com4tag:blogger.com,1999:blog-1883338940775324428.post-13059811860517235572012-07-24T01:34:00.000+02:002012-07-24T01:35:13.583+02:00Números aleatorios.Ejemplo 2Aquí tenemos otro ejemplo con dados de poker. :-)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjWBhGrmlShO0wGXFJtQUH4DYMPqe6xqSwmsmqnZ7vnS5qT9af5ZJ8_Xoy9Pge4Qai9akV0Po11w3MMLdrDYUBGOes9zlpMORjhyphenhyphenR458v8azVpyLzJew8HOZfI_sfuwwgY02x4q-2O0Po/s1600/DADOS+DE+POKER.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjWBhGrmlShO0wGXFJtQUH4DYMPqe6xqSwmsmqnZ7vnS5qT9af5ZJ8_Xoy9Pge4Qai9akV0Po11w3MMLdrDYUBGOes9zlpMORjhyphenhyphenR458v8azVpyLzJew8HOZfI_sfuwwgY02x4q-2O0Po/s320/DADOS+DE+POKER.png" width="320" /></a></div>
<br />
<br />
Con los números aleatorios podemos crear simulaciones.<br />
Serán fundamentales en nuestras aplicaciones.<br />
<br />
<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: teal;"><i><span style="font-weight: normal;">'
Gambas class file</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Private</span></span></span>
carasdadosalida <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">New</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span>[]</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Private</span></span></span>
odadopoker <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
PictureBox</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Form_Open()</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Center</span></span></span>()</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Me</span></span></span>.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"DADOS
DE POKER"</span></span></span>
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Function</span></span></span>
mostrardados() <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
contador <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span>
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
cara <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">For</span></span></span>
contador <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">To</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">6</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
cara <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Int</span></span></span>(<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Rnd</span></span></span>(<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">7</span></span></span>,
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">13</span></span></span>))
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
odadopoker.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Picture</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Picture[cara <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">&</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">".gif"</span></span></span>]
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Para
que veamos una repetición de las caras</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Wait <span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0.1</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Next</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
carasdadosalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Add</span></span></span>(cara)<span style="font-size: x-small;">
</span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Añadimos
la ultima cara que ha salido al array</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Return</span></span></span>
cara</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
tobDados_Click()</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
objeto <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Object</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
x <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
coincidencias <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
temporal <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">New</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span>[]</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">""</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Limpiamos
la etiqueta que nos dice la jugada que se ha hecho</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">For</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Each</span></span></span>
objeto In HBox2.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Children</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
objeto <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Is</span></span></span>
PictureBox <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
objeto.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">delete</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Borramos
todos los objetos si hubiera algunos. Para limpiar el contenedor</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Next</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
carasdadosalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Clear</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Limpiamos
el array que contendrá los valores de los dados en este array</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
creadadospoker() <span style="font-size: x-small;">
</span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Creamos
5 dados</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
carasdadosalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Sort</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Clasificamos
el array donde están los valores de los dados para identificar mejor
la jugada</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Do</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">While</span></span></span>
x <<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
carasdadosalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Count</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">-</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">2</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Mientras
x sea menor que el número de dados en el array</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
carasdadosalida[x] <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
carasdadosalida[x <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">+</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>]
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span> </div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Si
el primero coincide con el segundo,el segundo con el tercero....etc.</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Siempre
sin salirnos del numero máximo de elementos del array
carasdadosalida</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
temporal.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Add</span></span></span>(carasdadosalida[x
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">+</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>])
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Añadimos
al array temporal la cara del dado que se repite</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">+</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Aumentamos
el número de coincidencias</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
x <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">+=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Loop</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Según
el número de coincidencias que existan,decimos la jugada que se ha
hecho</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span>
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Pareja"</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Una
sola coincidencia</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">2</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0</span></span></span>]
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>]
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span>
<span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Dos
coincidencias</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Trio"</span></span></span><span style="font-size: x-small;">
</span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Ejemplo
777XX</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Else</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Doble
Pareja"</span></span></span> <span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Ejemplo
7788X</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">3</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
(temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0</span></span></span>]
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>])
<span style="color: #804040;"><span style="font-style: normal;"><span style="font-weight: normal;">And</span></span></span>
(temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">0</span></span></span>]
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
temporal[<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">2</span></span></span>])
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span>
<span style="font-size: x-small;"> </span><span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Ejemplo
8888X</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Poker!"</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Else</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Full"</span></span></span>
<span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Ejemplo
88899</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">If</span></span></span>
coincidencias <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">4</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Then</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
LblSalida.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Caption</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">"Repoker!!"</span></span></span>
<span style="color: teal;"><i><span style="font-weight: normal;">'Si
hay 5 números iguales</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
Endif</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
creadadospoker() <span style="color: teal; font-size: x-small;"><i><span style="font-weight: normal;">'Para
crear los 5 dados con su imagen</span></i></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
contador <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"> For</span></span></span>
contador <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">To</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">5</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
odadopoker <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">New</span></span></span>
PictureBox(HBox2)
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">With</span></span></span>
odadopoker</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Width</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">64</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Height</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">64</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Stretch</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">True</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
.<span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;">Picture</span></span></span>
<span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
Picture[mostrardados() <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">&</span></span></span>
<span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;">".gif"</span></span></span>]
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">With</span></span></span>
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Next</span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div align="JUSTIFY" style="background-color: white; color: black; margin-bottom: 0cm;">
<span style="font-style: normal;"><span style="font-weight: normal;"><br /></span></span></div>
<div align="JUSTIFY" style="background-color: white; color: black; margin-bottom: 0cm;">
<span style="font-style: normal;"><span style="font-weight: normal;">Podéis bajar el código aquí:</span></span></div>
<div align="JUSTIFY" style="background-color: white; color: black; margin-bottom: 0cm;">
<span style="font-style: normal;"><span style="font-weight: normal;"><br /></span></span></div>
<div align="JUSTIFY" style="background-color: white; color: black; margin-bottom: 0cm;">
<span style="font-style: normal;"><span style="font-weight: normal;"><a href="http://www.freedrive.com/file/1647004">Ejemplo con dados de poker</a></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="background-color: white;"></span></span></span></span></div>
<div align="JUSTIFY" style="background-color: #cccccc; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="background-color: white;"></span></span></span></span></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-33615404053157434832012-07-23T13:13:00.001+02:002012-07-23T13:22:57.155+02:00Números aleatorios<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Dependiendo de nuestra aplicación usaremos los números aleatorios.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Números al azar, para los juegos, para una aplicación de
calculo,estadística</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Los llamamos números aleatorios, pero no existen como tales en
Gambas,</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
el nombre mas adecuado es pseudo-aleatorio. Llega un momento que</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
se pueden repetir, entonces dejan de ser tan aleatorios.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Tenemos dos funciones principales para el manejo de estos números.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<ul>
<li><div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Randomize</div>
</li>
<li><div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Rnd</div>
</li>
</ul>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<u><b>Randomize:</b></u></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Randomize inicia el generador de números pseudo-aleatorios.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Podemos darles un número a esta función.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Randomize Numero Entero</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Con lo que generación de los números siempre serian iguales. Se
repetirían</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
O dejarlo sin el valor, lo que lo hace diferente en cada generación.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Randomize</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Solemos usar la función Randomize solamente una vez en la
aplicación.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Al inicio en Form_Open() por ejemplo.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<u><b>Rnd:</b></u></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
De por si sola, la función nos devuelve un número decimal 0 y 1.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Ejemplo:</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Public</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Sub</span></span></span>
Form_Open()</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Dim</span></span></span>
x <span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">As</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">Integer</span></span></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Randomize</span></span></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: teal;"><i><span style="font-weight: normal;">'Generar
5 números decimales entre 0 y 1</span></i></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">For</span></span></span>
x <span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;">=</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">To</span></span></span>
<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">5</span></span></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Print</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">Rnd</span></span></span>
</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">Next</span></span></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">End</span></span></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Si nosotros hubiésemos asignado el resultado de la función RND a un
número entero.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Estaríamos diciendo que la salida va ser del tipo entero. Estamos
creando</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
unas propiedades para la variable de salida y lo más normal que su</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
valor hubiera sido siempre 0.Al decir que el tipo es entero.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Ahora bien, la función RND permite la generación de un número
dentro de un intervalo.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
RND(mínimo,máximo)</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Cuando decimos
</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PRINT</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">RND</span></span></span>(<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>,<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">10</span></span></span>)
<span style="color: teal;"><i><span style="font-weight: normal;">'Entre 1
y 9</span></i></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
--código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Le decimos realmente que el número generado es entre 1 y 9. Así que
si queremos</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
que el número generado este realmente entre 1 y 10 debemos usar</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;">PRINT</span></span></span>
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;">RND</span></span></span>(<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">1</span></span></span>,<span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;">11</span></span></span>)
<span style="color: teal;"><i><span style="font-weight: normal;">'Entre 1
y 10</span></i></span></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
--código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Para la generación de números enteros debemos hacer uso de la
función INT.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
Comprobar la diferencia a no usar la función INT a usarla.</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="JUSTIFY" style="font-weight: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">PRINT</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">RND</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">1</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">,</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">11</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">) </span></span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Número
decimal</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">PRINT</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">INT</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
(</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">RND</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">1</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">,</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">11</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">)) </span></span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Número
entero</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">---código---</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">El
caso más típico de la generación de un dado de 6 caras.</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">---código---</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Public</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Sub</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
Form_Open()</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Dim</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
x </span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">As</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Integer</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;"> </span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;"> Randomize</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">For</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
x </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">1</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">To</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">6</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Print</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Int</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Rnd</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">1</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">,
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">7</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">))
</span></span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Next</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">---código---</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">Ejemplo
de la tirada de un dado con imágenes</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLHxTBrTbbe-uN95CuNDlgX83MXrOMxxxd3G9pCOeVIZx_brbk_zuLV3p13_yYmF7g9antblQJpNYvexXhiJiPT5LEh0dMS7WRKzTK8A5SiFnfJnYDK1PTAq_6mO65T1aotWzvDryI7Sg/s1600/Dado.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLHxTBrTbbe-uN95CuNDlgX83MXrOMxxxd3G9pCOeVIZx_brbk_zuLV3p13_yYmF7g9antblQJpNYvexXhiJiPT5LEh0dMS7WRKzTK8A5SiFnfJnYDK1PTAq_6mO65T1aotWzvDryI7Sg/s1600/Dado.png" /></a></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">---código---</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'
Gambas class file</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Private</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
dado </span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">As</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
PictureBox </span></span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Definimos
un objeto del tipo PictureBox</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Public</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Sub</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
_new()</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Public</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Sub</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
Form_Open()</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Me</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Title</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">"DADO"</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Me</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Center</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Public</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Sub</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
BtnDado_Click()</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">dado </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">New</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
PictureBox(</span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Me</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">)
</span></span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Creamos
el objeto picturebox que contendrá la imagen del dado</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Damos
propiedades al objeto dado</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">With</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
dado</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">x</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">56</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">y</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">24</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Height</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">64</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Width</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">64</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Stretch</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">True</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Border</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
Border.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Sunken</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Picture</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
Picture[muestradados() </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">&</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">".gif"</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">]</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">With</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Public</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Function</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
muestradados() </span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">As</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Integer</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Dim</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
i </span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">As</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Integer</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Dim</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
cara </span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">As</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Integer</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Estamos
generando 6 veces el dado. Para que el dado cambie su imagen</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Si
este número se repite no percibimos el cambio de cara</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
</span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">For</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
i </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">1</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">To</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">6</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">cara </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Int</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Rnd</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">(</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">0</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">,
</span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">6</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">))
</span></span>
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">dado.</span></span><span style="color: blue;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Picture</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">=</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
Picture[cara </span></span><span style="color: green;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">&</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: grey;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">".gif"</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">]</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;">
<span style="font-weight: normal;">Wait </span></span><span style="color: red;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">0.3</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
</span></span><span style="color: teal;"><i><span style="font-weight: normal;"><span style="text-decoration: none;">'Añadimos
un retardo para percibir ese cambio de cara del dado</span></span></i></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Next</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"></span><span style="color: #ff8000;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">Return</span></span></span></span><span style="text-decoration: none;"><span style="font-weight: normal;">
cara</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="font-style: normal;"><span style="font-weight: normal;"><span style="text-decoration: none;">End</span></span></span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<span style="text-decoration: none;"><span style="font-weight: normal;">---código---</span></span></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<a href="http://www.freedrive.com/file/1646904">Enlace al ejemplo dado</a></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Mas información en:</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<a href="http://gambasdoc.org/help/cat/random?es&v3">Enlace en Gambasdoc</a></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-16158083140179017072012-07-19T12:47:00.001+02:002012-07-19T12:47:33.136+02:00TreeView.Continentes y Países<div style="text-align: justify;">
En estos ejemplos continuamos con el componente TreeView.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
En el primero vamos a crear en un Treeview una lista alfabética</div>
<div style="text-align: justify;">
en el que iremos añadiendo los países contenidos en un archivo de texto.</div>
<div style="text-align: justify;">
Según la letra por la que comience el país se añadirá a la letra que le</div>
<div style="text-align: justify;">
corresponda.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgZ3EYvcVyQvSSYviZIPfADcWfCaaR2s4Ah8kH2-6z3zdqs-gy-gbKlcxTdpj9aK6w1qsZROdkMcq6dIOmBl7HUnOU-U3OZd2RzigEcncTOuFtruYosvEQigCpZgYT6yCVOV6JUPuUAAo/s1600/Paises.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgZ3EYvcVyQvSSYviZIPfADcWfCaaR2s4Ah8kH2-6z3zdqs-gy-gbKlcxTdpj9aK6w1qsZROdkMcq6dIOmBl7HUnOU-U3OZd2RzigEcncTOuFtruYosvEQigCpZgYT6yCVOV6JUPuUAAo/s320/Paises.png" width="219" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
---código---</div>
<div style="text-align: justify;">
<span style="font-size: x-small;">Private apaises As String[]<br /><br />Public Sub Form_Open()<br /> Me.Center 'Centramos nuestro formulario<br /> Me.Title = "Paises"<br /> CreaNodos<br /> LeeArchivoPaises<br /> apaises.Sort 'Ordenamos el array para cuando clasifique,estén los países por orden en sus nodos padres.Probar a comentar esta instrucción<br /> Clasificar<br /> tvListaPaises["Paises"].Expanded = True 'Mostramos expandido el nodo raiz "Paises"<br />End<br /><br />Public Sub CreaNodos()<br /> Dim x As Integer<br /> <br /> tvListaPaises.Add("Paises", "Paises") 'Creamos nuestro nodo raíz<br /> For x = 65 To 90<br /> tvListaPaises.Add(Chr(x), Chr(x),, "Paises") 'Con el rango de código ascii que representa una letra, creamos los nodos padres<br /> Next<br />End<br /><br />Public Sub LeeArchivoPaises()<br /> Dim spais As String<br /> <br /> spais = File.Load("paises2.txt") 'Añado todo el contenido del archivo paises2.txt a la variable de cadena spais<br /> apaises = Split(spais, "\n") 'Utilizamos como separador el salto de linea<br /> apaises.Remove(apaises.Count - 1) 'Eliminamos el ultimo elemento del array por que es un espacio en blanco<br /><br />End<br /><br />Public Sub Clasificar()<br /> Dim spais As String<br /> <br /> For Each spais In apaises<br /> tvListaPaises.Add(spais, spais,, Left(spais, 1)) 'Añadimos a cada nodo padre cada país que comienza con la letra del nodo<br /> Next<br /><br />End<br /><br />Public Sub tlbSalir_Click()<br /> Me.Close<br />End</span></div>
<div style="text-align: justify;">
---código---</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
En este otro ejemplo.Vamos a usar instrucciones para</div>
<div style="text-align: justify;">
trabajar con archivos de texto.Aunque no he tratado el tema aun en el</div>
<div style="text-align: justify;">
blog.(Queda pendiente).En este ejemplo tendremos los nombres</div>
<div style="text-align: justify;">
de los continentes y añadiremos los países a su continente correspondiente.</div>
<div style="text-align: justify;">
La estructura del archivo de texto nos ayuda mucho.Es importante.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GaTEcIPbtrqe1gJSXwjEE0kkeNraXC8P0G_eW6wq9b0q_ddmabtxCs959YVMRTu6-09DebX36ZjGrJ85bu2eaO8ccc1rSxFSggJXXzWDN0uCQQ356bIGe7090g_Aqq5h84H5NJAmTUA/s1600/Continentes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GaTEcIPbtrqe1gJSXwjEE0kkeNraXC8P0G_eW6wq9b0q_ddmabtxCs959YVMRTu6-09DebX36ZjGrJ85bu2eaO8ccc1rSxFSggJXXzWDN0uCQQ356bIGe7090g_Aqq5h84H5NJAmTUA/s320/Continentes.png" width="246" /></a></div>
<br />
---código---<br />
<span style="font-size: x-small;">'Es importante conocer la estructura del archivo de texto para poder leerlo<br />'y distribuir sus datos según nos convenga<br />'Esto es una manera de hacerlo, naturalmente, podrá haber más. ;-)<br /><br />'En otro ejemplo, hablaremos del manejo de los archivos de texto<br /><br /><br />Public Sub Form_Open()<br /><br /><br /><br />End<br /><br /><br />Public Sub btnSalir_Click()<br /> Me.Close<br />End<br /><br />Public Sub btnMostrar_Click()<br /> Dim archivo As File 'Definimos archivo como el tipo archivo o fichero<br /> Dim linea As String 'Cada linea que leemos del archivo se almacena en linea<br /> Dim nomcontinente As String 'El nombre del continente<br /> Dim pais As String 'El nombre del país<br /> <br /> tvContinentes.Clear 'Borramos el contenido del TreeView por si hacemos click más de una vez en Mostrar<br /> <br /> archivo = Open "paises.txt" For Input 'Abrimos nuestro archivo para lectura.Input,entrada<br /> <br /> tvContinentes.Add("Continentes", "Continentes") 'Creamos el nodo raiz Continentes<br /> Line Input #archivo, linea 'Leemos una linea del arhivo paises.txt.No incluye nada.Podia haber sido borrada en el archivo de texto<br /> Do While Not Eof(archivo) 'Entramos en una secuencia repetitiva que se ejecuta "mientras no llegue al final del archivo" Eof.End of File<br /> Line Input #archivo, linea<br /> nomcontinente = Trim(linea) 'La linea leída contiene texto,eliminamos sus espacios en ambos lados y asignamos a nomcontinente<br /> tvContinentes.Add(nomcontinente, nomcontinente,, "Continentes") 'Creo un nodo padre en el nodo raiz<br /><br /> Line Input #archivo, linea 'Una linea vacía, en blanco<br /> Line Input #archivo, linea<br /> Do While linea <> "" And Not Eof(archivo) 'Si la linea contiene texto y no hemos llegado al final del archivo.Ejecutar el bucle<br /> pais = Trim(linea)<br /> tvContinentes.Add(pais, pais,, nomcontinente) 'Agrego un nodo hijo a cada nodo padre<br /> Line Input #archivo, linea 'Leemos la siguiente linea del archivo<br /> Loop<br /> Loop<br /> Close archivo 'Cuando llegamos al final y terminamos de leer el archivo,lo cerramos.<br /> <br /> 'Cuestión. ¿ Por que hemos usado bucle While y no un For ?. ;-)<br /> <br />End</span><br />---código---<br />
<br />
Como los comentarios son largos se deforman en la pagina.<br />
Aquí tenéis los códigos para poder verlo mejor.<br />
<br />
<a href="http://www.freedrive.com/file/1645640">Ejemplo 2</a><br />
<br />
<a href="http://www.freedrive.com/file/1645641">Ejemplo 3</a><br />
<br />
<br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-79349459188865039172012-07-17T12:55:00.000+02:002012-07-17T12:55:20.708+02:00Componente TreeView.Ejemplo 1<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Este componente es
parecido a ListView, cada elemento tiene su clave y añade</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
la vista en árbol de los
elementos. Añade texto y una imagen si queremos,los cuales</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
podemos seleccionar.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Con la clave, sabremos a
que rama en cuestión pertenece el elemento.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Volvemos a usar
propiedades como “Item” y “Current”. Estas propiedades</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
son muy comunes en estos
componentes semejantes a listas. Repasar ListView.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
En este ejemplo,
seleccionamos una opción si es una amistad, cliente o proveedor
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
y se añade a su rama
concreta con el botón. También podemos eliminarlo del TreeView.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIoPNohfMRg8RZC0uihaFGUtCupV1LPYYD0yfBeyAmgD08XX33_OQJVaswgdun8mo8EhyFAZsFY4Nf3CXQJVRUZr2N2-e6t4fPiI6lzT9DX7peqem5Nb5Th-fX7TIGbibExVPCC-B3Rxw/s1600/Ejemplo1_TreeView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIoPNohfMRg8RZC0uihaFGUtCupV1LPYYD0yfBeyAmgD08XX33_OQJVaswgdun8mo8EhyFAZsFY4Nf3CXQJVRUZr2N2-e6t4fPiI6lzT9DX7peqem5Nb5Th-fX7TIGbibExVPCC-B3Rxw/s320/Ejemplo1_TreeView.png" width="320" /></a></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
---código---</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Private numpersona As
Integer</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Private
opcionseleccionada As Integer</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Private imagen1 As
Picture</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Private imagen2 As
Picture</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub _new()</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub Form_Open()</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Me.Title
= "Ejemplo con TreeView"</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Me.Center</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
imagen1
= Picture["Alegre.png"]</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
imagen2
= Picture["Serio.png"]</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Contactos",
"Contactos") 'Nodo Raíz</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Amistades",
"Amistades",, "Contactos") 'Nodo Padre</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Clientes",
"Clientes",, "Contactos") 'Nodo Padre</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Proveedores",
"Proveedores",, "Contactos") 'Nodo Padre</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos["Contactos"].Expanded
= True 'Presentamos el nodo raíz abierto o
expandido</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
numpersona
= 1 'Iniciamos el
contador de personas en 1</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub
btnBorrar_Click()</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
'No queremos borrar el nodo raíz ni tampoco sus nodos padres
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
If
tvContactos.Key <> "Contactos" And tvContactos.Key <>
"Amistades" And tvContactos.Key <> "Clientes"
And tvContactos.Key <> "Proveedores" Then</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Remove(tvContactos.Key)</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Else</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Message.Info("No se puede eliminar el nodo raíz o padre")</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Endif</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub
Contactos_Click()
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
opcionseleccionada =
Last.tag
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub
btnSalir_Click()</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Me.Close</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Public Sub btnAdd_Click()</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
'Según seleccionamos nuestra opción, añadimos un nodo hijo al nodo
padre
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Select Case opcionseleccionada</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Case 0
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Persona-" & numpersona, "Persona-"
& numpersona, imagen1, "Amistades")</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Case 1
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Persona-" & numpersona, "Persona-"
& numpersona, imagen2, "Clientes")</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
Case 2
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
tvContactos.Add("Persona-" & numpersona, "Persona-"
& numpersona, imagen2, "Proveedores")</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
End Select</div>
<div align="JUSTIFY" style="margin-bottom: 0cm; margin-left: 1.25cm;">
numpersona += 1 'Aumentamos el número de personas</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
End</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
---código---</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Nuestra raíz principal,
tiene la key o clave “Contactos” con el nombre “Contactos”.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Añadimos el nodo
“Amistades”, con nombre “Amistades” a la rama principal
“Contactos”.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Hemos usado.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
tvContactos.Add("Amistades",
"Amistades",, "Contactos") 'Nodo padre</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Como no añadimos una
imagen, dejamos esa opción vacía en el método .Add.
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Y repetimos la misma
operación para los nodos “Cliente” y “Proveedores” que son
nodos padres. Las opciones de los
contactos están formadas por una matriz de controles. Acordaros del ejemplo de la
calculadora. Los números formaban parte de un grupo, con un código
común para todos los números
evitando la repetición del mismo código por cada número.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
En este caso, guardamos
el valor de “last.tag” en una variable común a todo
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
el formulario para saber
que opción fue seleccionada, (el índice del grupo). </div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Para que nuestro botón de añadir,
sepa que tipo de contacto debe añadir.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Mas información en:</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<a href="http://gambasdoc.org/help/comp/gb.qt4/treeview?es&v3">Gambasdoc</a></div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
Aquí tenéis el código
del ejemplo 1.</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<br />
</div>
<div align="JUSTIFY" style="margin-bottom: 0cm;">
<a href="http://www.freedrive.com/file/1644748">Ejemplo1 de TreeView</a><br />
</div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-37721562130785609262012-07-16T01:08:00.000+02:002012-07-16T01:13:21.443+02:00Otro ejemplo de ListViewEn este ejemplo no he utilizado imágenes.<br />
<br />
- Veremos como se hace una búsqueda en un array, con el método .Find<br />
Aprovechando para mostrar y borrar un registro o<br />
elemento del ListView.<br />
- Como hacemos un grupo de instrucciones sobre una variable.<br />
- Como eliminar y añadir elementos a un ListView <br />
<br />
En esta aplicación de ejemplo tenemos los datos de identidad,nombre y apellidos de un ciudadano.<br />
<br />
En la lista se añade su numero de identidad.Si lo seleccionamos podemos ver<br />
en las cajas de texto los datos.También pueden ser eliminados de la lista.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrnR_GJr7Zv0pRgDzLAnuMxceZ9aJm0i3iJgjddWGkXjwGDpMbzR_ycD4kVEVweVb5VZUGOchSKpGs-j_5pQ06v5Qxej_cbwK9N_ppq5CdXKl-Y6QBpilWNyrrhIxOgt3LVsdHW1VsaM/s1600/Ejemplo2_ListView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrnR_GJr7Zv0pRgDzLAnuMxceZ9aJm0i3iJgjddWGkXjwGDpMbzR_ycD4kVEVweVb5VZUGOchSKpGs-j_5pQ06v5Qxej_cbwK9N_ppq5CdXKl-Y6QBpilWNyrrhIxOgt3LVsdHW1VsaM/s320/Ejemplo2_ListView.png" width="320" /></a></div>
<br />
<br />
El código esta documentado ,no lo he añadido aquí ya que los comentarios<br />
deforman un poco la presentación al ser largos.<br />
<br />
Podéis bajar el código aquí:<br />
<br />
<div style="font-family: inherit;">
<span style="font-size: small;"> <a href="http://www.freedrive.com/file/1644290">Ejemplo2 con ListView</a></span></div>
<br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-53455156334508424432012-07-15T14:55:00.002+02:002021-02-17T11:09:37.920+01:00Componente ListView<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm;">
Este componente es muy parecido a
ListBox con la posibilidad de poder añadir</div>
<div style="margin-bottom: 0cm;">
un icono al texto de cada elemento.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Cada elemento que añadimos consta de
una clave “key” que es única por cada elemento</div>
<div style="margin-bottom: 0cm;">
de la lista, no se repite.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Para la selección de componente en vez
de la propiedad “Index”.Usamos
</div>
<div style="margin-bottom: 0cm;">
“Item”.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Con Item podemos averiguar su texto y
su imagen.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Hay que practicar para conocer este
componente si estamos acostumbrado a ListBox. No entraña mucha dificultad y si
mejoras.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
He creado este ejemplo, con banderas
marítimas internacionales para señales.</div>
<div style="margin-bottom: 0cm;">
Donde podéis ver como se añade la
clave, su nombre y si queremos una imagen.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVmaM__fL8KwAJBvzz8nPLRUa3dcOtYMddgXhbkLY3uc2lWM6ypzgCSV3SBOoqTx5Cb3wMcZ2xjZUccWFe8nnBHM1ghox9OaRtAyEE5fsHezEryHU9Qm_jeTJST5Y6b6OVqHbnA4_wvSc/s1600/CapturaListView.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVmaM__fL8KwAJBvzz8nPLRUa3dcOtYMddgXhbkLY3uc2lWM6ypzgCSV3SBOoqTx5Cb3wMcZ2xjZUccWFe8nnBHM1ghox9OaRtAyEE5fsHezEryHU9Qm_jeTJST5Y6b6OVqHbnA4_wvSc/s400/CapturaListView.png" width="400" /></a></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<script src="https://pastebin.com/embed_js/mYc9F8Vs"></script>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Aquí podéis bajar el ejemplo.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<a href="https://drive.google.com/file/d/0B8HDf7ZGWKwjVTlOZmZlN0FObnM/view">Señales marítimas internacionales</a></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Y aquí encontrareis mas información.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<a href="http://gambaswiki.org/wiki/comp/gb.qt4/listview?l=es">ListView en GambasWiki</a></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-45626142083292252942012-07-15T14:05:00.001+02:002016-05-22T10:04:32.954+02:00Componente ListBox<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm;">
Este componente presenta una lista de
elementos seleccionables.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Al hacer click en uno de los elementos
su índice es almacenado en la
</div>
<div style="margin-bottom: 0cm;">
propiedad .Index.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
La propiedad .Current nos ofrece la
posibilidad de conocer del</div>
<div style="margin-bottom: 0cm;">
elemento actual seleccionado,su texto o
si ha sido seleccionado un</div>
<div style="margin-bottom: 0cm;">
elemento en concreto.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Lista.Current.Text</div>
<div style="margin-bottom: 0cm;">
Lista.Current.Selected</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Listbox es igual que un array de
elementos.</div>
<div style="margin-bottom: 0cm;">
Posee propiedades para conocer cuantos
elementos tiene la lista, como la</div>
<div style="margin-bottom: 0cm;">
propiedad .Count.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
No debemos olvidar nunca que siempre el
primer elemento en un array es 0.</div>
<div style="margin-bottom: 0cm;">
Así que la propiedad .Count puede
decirnos que tenemos un elemento, pero</div>
<div style="margin-bottom: 0cm;">
su propiedad .Index al seleccionar este
elemento es 0.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Al igual que teníamos un array:</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
aAmigos[1]</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Con la propiedad Lista.List[1] hacemos
la misma función con</div>
<div style="margin-bottom: 0cm;">
nuestro componente ListBox.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Cuando no hemos seleccionado ningún
elemento de la lista la propiedad</div>
<div style="margin-bottom: 0cm;">
Index es -1</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Tenemos métodos para ordenar nuestra
Lista y de hacer búsquedas en ella.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Usamos siempre el método .Add para
añadir elementos a nuestra lista.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Aquí tenéis un ejemplo para ver el funcionamiento básico</div>
<div style="margin-bottom: 0cm;">
de este componente.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiCVy9I86SddTRrGAc4IsJXETLhj-uoV3fgZzjGgj4W6r7U5ZQVu80VYnnZLruDYOceNawoV3bSBjw0-7SQn7qxQe6rRslZB3MsG2OtIuTTJrWWe4VpNKd8gXcAniCLGDLMHqSBdOBIwE/s1600/CaputraListBox.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiCVy9I86SddTRrGAc4IsJXETLhj-uoV3fgZzjGgj4W6r7U5ZQVu80VYnnZLruDYOceNawoV3bSBjw0-7SQn7qxQe6rRslZB3MsG2OtIuTTJrWWe4VpNKd8gXcAniCLGDLMHqSBdOBIwE/s1600/CaputraListBox.png" /></a></div>
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
He utilizado el recurso que nos ofrece
el componente de alineación Vbox, para
</div>
<div style="margin-bottom: 0cm;">
que tanto la caja de texto y los
botones queden alineados.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
El código es simple. ;-)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
----código---</div>
<div style="margin-bottom: 0cm;">
' Gambas class file</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub _new()</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub Form_Open()</div>
<div style="margin-bottom: 0cm;">
Me.Title = "Ejemplo con ListBox"</div>
<div style="margin-bottom: 0cm;">
Me.Center()</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnInsertar_Click()</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
If txtEntrada.Text = ""
Then 'Si no escribimos nada nos lo dice</div>
<div style="margin-bottom: 0cm;">
Message.Info("Debes escribir
algo")
</div>
<div style="margin-bottom: 0cm;">
Else
</div>
<div style="margin-bottom: 0cm;">
lstLista.Add(txtEntrada.text)
'Añadimos el contenido de la caja de texto a la
lista</div>
<div style="margin-bottom: 0cm;">
lblSalida.Text = (txtEntrada.Text &
" fue añadido a la lista")</div>
<div style="margin-bottom: 0cm;">
txtEntrada.text = ""
</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
txtEntrada.SetFocus</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnLimpiarLista_Click()</div>
<div style="margin-bottom: 0cm;">
lstLista.Clear</div>
<div style="margin-bottom: 0cm;">
lblSalida.Text = "La lista fue
borrada"</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnEliminar_Click()</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
If lstLista.Index >= 0 Then
'Si se ha seleccionado algún elemento.</div>
<div style="margin-bottom: 0cm;">
lblSalida.Text =
lstLista.Current.Text & " fue eliminado"</div>
<div style="margin-bottom: 0cm;">
lstLista.Remove(lstLista.Index)</div>
<div style="margin-bottom: 0cm;">
Else</div>
<div style="margin-bottom: 0cm;">
If lstLista.Index = -1 Then</div>
<div style="margin-bottom: 0cm;">
Message.Warning("Debe
seleccionar algún elemento de la lista")</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub lstLista_Select()
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
If lstLista.Index <> -1 Then
'Si se ha seleccionado algún elemento.Otra manera de
hacerlo.</div>
<div style="margin-bottom: 0cm;">
lblSalida.Text =
Trim(lstLista.Current.Text) & " fue seleccionado"</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnSalir_Click()
</div>
<div style="margin-bottom: 0cm;">
Me.Close</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnInsertar_Enter()</div>
<div style="margin-bottom: 0cm;">
btnInsertar.Font.bold = True
'Cuando el cursor este dentro del botón cambia el estilo de su
fuente a negrita</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Public Sub btnInsertar_Leave()</div>
<div style="margin-bottom: 0cm;">
btnInsertar.Font.Bold = False
'Cuando el cursor este fuera del botón cambia el estilo de su fuente
a normal</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Si os fijáis en los botones debajo de
algunas letras existe un guión bajo. Este guión permite el uso de un acceso rápido al botón
en cuestión.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Usamos la combinación de las teclas
Alt + la letra para hacer lo<br />
mismo que si hiciéramos click con el ratón en el botón.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
¿ Cómo podemos hacer esto con
nuestros botones de comando ?.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Vamos a la propiedad texto del botón
y cerca de la letra que queremos</div>
<div style="margin-bottom: 0cm;">
usar, añadirnos el carácter “&”,
que conocemos como Ampersand.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
No debemos repetir los mismos
caracteres para usar los botones desde teclado</div>
<div style="margin-bottom: 0cm;">
por que puede que el programa no
responda como quisiéramos.<br />
<br />
Aquí tenéis el ejemplo con su código.<br />
<br />
<a href="https://drive.google.com/file/d/0B8HDf7ZGWKwjZG9ldE42R1dZSWs/view?usp=sharing">Ejemplo de Listbox</a><br />
<br />
Podéis encontrar mas información en:<br />
<br />
<a href="http://gambasdoc.org/help/comp/gb.qt/listbox?es&v2">En GambasDoc</a></div>
Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com4tag:blogger.com,1999:blog-1883338940775324428.post-33357654370067180252012-07-10T10:21:00.003+02:002012-07-10T10:27:11.345+02:00Paso de parámetros por valor o por referencia.<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm; text-align: justify;">
Cuando queremos pasar un parámetro a
un procedimiento,podemos hacerlo de dos maneras. La manera habitual
de saber como se pasan los parámetros es fijarnos en el
procedimiento o función que recibe el parámetro</div>
<div style="margin-bottom: 0cm; text-align: justify;">
<br /></div>
<div style="margin-bottom: 0cm; text-align: justify;">
Imaginar una rejilla, en la que hay
celdas que contienen nuestras variables.</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Cada celda es una dirección en la
memoria de nuestro ordenador, con</div>
<div style="margin-bottom: 0cm; text-align: justify;">
un contenido con valor o vacío</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<b>Por valor:</b></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Cuando pasamos por valor una variable a
un procedimiento,no pasamos la</div>
<div style="margin-bottom: 0cm;">
variable original,pasamos una copia de
esta.(No sería la celda original).</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
La ventaja es que si dentro del
procedimiento se cambiase el valor de la variable,al salir del procedimiento, nuestra
variable contendrá su valor inicial.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
En Gambas1 y Gambas2 solo era posible
pasar parámetros por valor.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
----código----</div>
<div style="margin-bottom: 0cm;">
PUBLIC SUB Form_Open()</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Dim sNombre AS String</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
sNombre=”Jose Luis”</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Llamamos al procedimiento, pasándole
como parámetro la variable sNombre</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
VerNombre(sNombre)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Al salir del procedimiento ,mostramos
el valor de la variable sNombre,</div>
<div style="margin-bottom: 0cm;">
'comprobando que no ha cambiado.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info(“El valor del nombre
es: “ & sNombre)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
PUBLIC SUB VerNombre(sNom AS STRING)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Vemos su valor original.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info( “El valor original del
parámetro es: “ & sNom)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Cambiamos su valor y lo mostramos.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
sNom=”Jose María”</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info(“El valor del parámetro
se cambia a: “ & SNom)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
END</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
No olvidéis cambiar el tipo de
comillas al pegarlo en el editor de Gambas. ;-)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<b>Por referencia:</b></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Cuando pasamos un
parámetro por referencia,estamos pasando el contenido</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
de la celda de
memoria donde se encuentra el valor de nuestra variable.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Así que el
procedimiento no manejara una copia de nuestra variable,</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
sino la variable
original.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
En la versión de
Gambas3 podemos usar el paso de parámetros por referencia.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Para ello, debemos
usar en la llamada al procedimiento la palabra ByRef</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Y también debemos
incluirla dentro de los parámetros del procedimiento</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
al que llamamos.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
PUBLIC SUB Form_Open()</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Dim sNombre AS String</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
sNombre=”Jose Luis”</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Llamamos al procedimiento, pasándole
como parámetro la variable sNombre</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
VerNombre(ByRef sNombre)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Al salir del procedimiento ,mostramos
el valor de la variable sNombre,</div>
<div style="margin-bottom: 0cm;">
'comprobando que ha cambiado.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info(“El valor del nombre
es: “ & sNombre)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
PUBLIC SUB VerNombre(ByRef sNom AS
STRING)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Vemos su valor original.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info( “El valor original del
parámetro es: “ & sNom)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
'Cambiamos su valor y lo mostramos.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
sNom=”Jose María”</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Message.info(“El valor del parámetro
se cambia a: “ & SNom)</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
END</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
---código---</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Otro ejemplo
usando paso de parámetro por referencia.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
No dividir por
cero o dará error. ;-)</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
---código---</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
'Algoritmo que
calcula el cociente y el resto de la división haciendo que estos
resultados</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
'sean devueltos al
algoritmo principal</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Public Sub
Form_Open()</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Dim dividendo,
divisor, cociente, resto As Integer</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
dividendo =
InputBox("Ingrese el valor del dividendo")</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
divisor =
InputBox("Ingrese el valor del divisor")</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
division(dividendo,
divisor, ByRef cociente, ByRef resto)</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Message.Info("Cociente:
" & cociente & "\n" & "Resto: "
& resto)</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
End</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
'Cabecera:
division(Entrada divi,Entrada d,Salida c,Salida r)
</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
'Precondición:
dividendo >= divisor y ambos son mayores que 0</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
'Postcondición:
devuelve a través de los parámetros de salida c y r, el cociente y
el resto.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Public Sub
division(divi As Integer, d As Integer, ByRef c As Integer, ByRef r
As Integer) As Integer
</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
c = divi Div d</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
r = divi Mod d</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
End</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-weight: normal; margin-bottom: 0cm;">
---código---</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Como veis en la función división, tenemos paso por valor y referencia.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
Espero que les sea útil.</div>
<div style="font-weight: normal; margin-bottom: 0cm;">
<br /></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com1tag:blogger.com,1999:blog-1883338940775324428.post-58627083979381140592012-07-07T11:49:00.000+02:002012-07-07T11:49:28.041+02:00Antigua presentación de Gambas en 2006<br />
Podéis ver el pdf adjunto que era la idea principal de<br />
este proyecto de presentación.<br />
<br />
Esta en inglés.<br />
<br />
<a href="http://www.freedrive.com/file/1641362">Presentación de Gambas en 2006</a>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-38325477157373222852012-06-28T10:14:00.000+02:002012-06-28T10:15:04.563+02:00Diapositivas sobre GambasHola!.<br />
<br />
Encontré estas diapositivas sobre Gambas.<br />
<br />
Aunque son para versiones algo más antiguas, explican información<br />
que puede ser interesante para todos sobre nuestro entorno favorito<br />
de programación.<br />
<br />
<a href="http://administradores.educarex.es/wiki/images/0/0e/Diapositivasgambas1.sxi">Diapositivas 1</a><br />
<br />
<a href="http://administradores.educarex.es/wiki/images/8/85/Diapositivasgambas2.sxi">Diapositivas 2</a><br />
<br />
<a href="http://administradores.educarex.es/wiki/images/1/12/Diapositivasgambas3.sxi">Diapositivas 3</a><br />
<br />
Referencia:<br />
<br />
<a href="http://www.educarex.es/">Portal educativo Extremeño</a><br />
<br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com2tag:blogger.com,1999:blog-1883338940775324428.post-16356978241841665552012-06-19T13:43:00.000+02:002012-06-20T10:39:32.438+02:00Cómo funcionan los controles de alineaciónEn este ejemplo veréis como funcionan los controles de alineación:<br />
<br />
<ul>
<li>Hbox</li>
<li>Vbox</li>
<li>HPanel</li>
<li>VPanel</li>
</ul>
<br />
Estos controles son contenedores y permiten alinear sus objetos<br />
o componentes que están dentro de el. Ya sea verticalmente<br />
u horizontalmente.<br />
<br />
Tenemos propiedades como Padding que le dice cuanto es la separación<br />
en pixels entre componentes (hijos) de su contenedor (el control de alineación).<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCWAyDu7iADSuyyWlA8AeEaz720iQEFyNA7Gv7fllJPVLrlTApIKmrsuVj0kqx52CLGdxHfER8udgFCnqy5YDVg6SZD-KrM1Yh32ok4644xDzp1K5LANfdIX7HfB111dJ6tdmsXb_88eM/s1600/ControlesAlineacion" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCWAyDu7iADSuyyWlA8AeEaz720iQEFyNA7Gv7fllJPVLrlTApIKmrsuVj0kqx52CLGdxHfER8udgFCnqy5YDVg6SZD-KrM1Yh32ok4644xDzp1K5LANfdIX7HfB111dJ6tdmsXb_88eM/s320/ControlesAlineacion" width="320" /></a></div>
<br />
<br />
En el ejemplo debemos seleccionar uno de los 4 tipos y luego<br />
seleccionar las imágenes, que irán llenando "de una forma"<br />
típica de cada control de alineación.Podréis llenar<br />
cada contenedor hasta un máximo que os avisara.<br />
<br />
<a href="http://www.freedrive.com/file/1635758">EjemploControlesAlineación</a><br />
<br />
<br />
<br />
Buscar estos componentes en:<br />
<br />
<a href="http://gambasdoc.org/help/?es&v3">GambasDoc</a><br />
<br />
También encontrareis información en el manual de Gambas:<br />
<br />
Alineación de controles en la pagina 114<br />
<br />
<br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-67030365368720502422012-06-16T14:44:00.000+02:002012-06-16T14:44:01.497+02:00Como hacer una calculadora<style type="text/css">
<!--
@<span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">page</span> { <span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">margin</span>: 2cm }
P { <span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">margin</span>-<span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">bottom</span>: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm;">
Vamos a crear una aplicación muy
conocida cuando empezamos con</div>
<div style="margin-bottom: 0cm;">
un entorno visual. Una calculadora.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
La imagen final sera así:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54ca0URbO8YSH4xk2O88o-UwWhYzAqGthNbNM2qNHl6xtwY7AgVVdTJu6PNlmD0NrqumwxGXumwGvI7Ma936xovRr6aCGboFqQ2VZnKjlD3mF0N34-2_dnEadtVep_zlJX5hAHBVNVE0/s1600/Calculadora.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54ca0URbO8YSH4xk2O88o-UwWhYzAqGthNbNM2qNHl6xtwY7AgVVdTJu6PNlmD0NrqumwxGXumwGvI7Ma936xovRr6aCGboFqQ2VZnKjlD3mF0N34-2_dnEadtVep_zlJX5hAHBVNVE0/s1600/Calculadora.png" /></a></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Con esta calculadora podrás hacer las
operaciones básicas.</div>
<div style="margin-bottom: 0cm;">
La pantalla se borrara cada vez que
hagamos una operación</div>
<div style="margin-bottom: 0cm;">
para mostrar el resultado.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Empezamos por un formulario:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Esta formulario tiene:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Propiedad Height (Altura) del
formulario: 272</div>
<div style="margin-bottom: 0cm;">
Propiedad Width (Ancho) del formulario:
232</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Como no queremos que la imagen se
agrande, cambiaremos</div>
<div style="margin-bottom: 0cm;">
la propiedad Resizable a False.
Desaparecerá el icono de maximizar.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm;">
Necesitaremos para comenzar
una etiqueta que sera nuestra pantalla LCD.</div>
<div align="LEFT" style="margin-bottom: 0cm;">
Dentro de un formulario
tenemos unas coordenadas X e Y. Fijaros en las propiedades de este. Luego,vamos a la
caja de herramientas, que tenemos todos nuestros componentes y seleccionamos label.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Situamos la etiqueta en:</div>
<div style="margin-bottom: 0cm;">
X =11 e Y =15</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Si no podéis colocarlo con el cursor
el componente.</div>
<div style="margin-bottom: 0cm;">
Usar sus propiedades X e Y. ;-)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Le damos un alto y un ancho.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Height: 32 y Width: 208</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Ahora fijaros. La etiqueta debería dar
la sensación de que tiene profundidad.</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Así que cambiaremos su propiedad
Border a Sunken.(Hundida).</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Probar a ver que pasa si cambiareis a
otros modos.</div>
<div style="margin-bottom: 0cm; text-align: justify;">
<br />
</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Para que los números comiencen por su
derecha, debemos cambiar su alineación. Así que en la propiedad Align
cambiaremos a RIGHT (derecha).</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a la propiedad nombre y la
cambiamos a Pantalla</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ya tenemos nuestro LCD.
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ahora vamos a crear una botonera.
Tendremos:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<ul>
<li><div style="margin-bottom: 0cm;">
Los números.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Las operaciones.</div>
</li>
<li><div style="margin-bottom: 0cm;">
El signo igual</div>
</li>
<li><div style="margin-bottom: 0cm;">
La coma o punto decimal.</div>
</li>
</ul>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Con esto, podemos darnos cuentas de
que tenemos unos grupos de botones divididos según función</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Estos grupos de controles son los
conocidos como “Matriz de controles”.</div>
<div style="margin-bottom: 0cm;">
Ganamos en claridad de código y usamos
un mismo código para cada </div>
<div style="margin-bottom: 0cm;">
grupo de botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a crear el primer botón
para los números.</div>
<div style="margin-bottom: 0cm;">
Necesitaremos 10 botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Comenzaremos por el 0.
</div>
<div style="margin-bottom: 0cm;">
Vamos a nuestra caja de herramientas o
componentes y pulsamos en el
</div>
<div style="margin-bottom: 0cm;">
botón que tiene ok en su interior.
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Hacemos doble clic sobre el.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Grande,¿ verdad ?.Con este botón
vamos a crear todo el resto de botones</div>
<div style="margin-bottom: 0cm;">
de los números.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a cambiar su alto y ancho:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Height : 42 y su Width: 49</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a cambiar su nombre:
</div>
<div style="margin-bottom: 0cm;">
Name: Boton0</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Y vamos a cambiar su propiedad de
texto.</div>
<div style="margin-bottom: 0cm;">
Text: 0</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Como es un conjunto de botones o grupo.
Todos estos botones tienen</div>
<div style="margin-bottom: 0cm;">
su índice, que lo identifica en su
grupo, con la propiedad “Tag”</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
En la que iremos añadiendo un índice.
Como boton0 es el primero de todos.</div>
<div style="margin-bottom: 0cm;">
cambiaremos la propiedad Tag a 0 y así
iremos haciéndolo con cada grupo</div>
<div style="margin-bottom: 0cm;">
de botones. El boton0 es 0, el boton1
es 1, el boton3</div>
<div style="margin-bottom: 0cm;">
es 3, etc.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
¿ Estas contento con ese tamaño de
letra para tu botón ?.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Puedes cambiarlo en la propiedad Font
del botón.</div>
<div style="margin-bottom: 0cm;">
Yo lo deje a 11.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Parece que ya de principio nuestro
número esta alineado.</div>
<div style="margin-bottom: 0cm;">
Vamos a desplazar el botón.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Seleccionamos nuestro botón.Nos valemos del lateral de la etiqueta</div>
<div style="margin-bottom: 0cm;">
y lo llevamos hasta abajo.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Podemos colocarlo en:</div>
<div style="margin-bottom: 0cm;">
X: 8</div>
<div style="margin-bottom: 0cm;">
Y: 216</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Nos vamos a la propiedad Group del
botón</div>
<div style="margin-bottom: 0cm;">
Y escribiremos: Números</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ahora viene lo interesante. Tenemos
seleccionado nuestro botón 0 y </div>
<div style="margin-bottom: 0cm;">
con el botón derecho del ratón, mostramos el “menú
emergente” y seleccionamos “Copiar”.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Nuestro botón se ha copiado a la
memoria y ahora queremos tener otro igual sobre el formulario. Usamos de nuevo el “menú
emergente” con el botón derecho y “Pegamos”.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Tenemos nuestra copia de botón arriba.
Lo bajamos y lo colocamos encima del primer botón.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Fijaros ahora en las propiedades Name y
Group, automáticamente su nombre ha cambiado a boton1 y se ha incluido en el grupo
Numeros. Tenemos que cambiar la propiedad “Tag”,manualmente.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Como aun tenemos en memoria el primer
botón. Volvemos a usar “Pegar” del menú emergente (Botón Derecho). Una vez mas
hasta tener una fila de tres botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Veremos algo así:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLfx2_gC9BVZIQADfKKbTCDew1H4i924j66ywyk8zM26s49-ZzPzk1-3Sj_qcGP6QlnjJcrLXu0y-Rq1_Ori_G-l_gn3UO1zpxtSqtDhy3UHlGtZUPzEwEhr4bTLGGFEFPr5Kl1a_it6E/s1600/Botones1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLfx2_gC9BVZIQADfKKbTCDew1H4i924j66ywyk8zM26s49-ZzPzk1-3Sj_qcGP6QlnjJcrLXu0y-Rq1_Ori_G-l_gn3UO1zpxtSqtDhy3UHlGtZUPzEwEhr4bTLGGFEFPr5Kl1a_it6E/s1600/Botones1.png" /></a></div>
<br /><div style="margin-bottom: 0cm;">
Ahora seleccionaremos los tres botones
de la misma fila. Iremos desde el primero al tercero. Dejaremos pulsado el botón
izquierdo y seleccionamos los tres botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Cuando los tengamos seleccionados,
usaremos el menús emergente y usamos “Copiar”.</div>
<div style="margin-bottom: 0cm;">
Tendremos tres botones en memoria. Que
vamos a Pegar ahora dos veces, para completar los diez botones de la calculadora.Las tres filas. :-)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Fijaros que al pegar los botones están
seleccionados, vamos a ellos con el botón izquierdo y los ponemos encima de la primera fila
de tres botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Una vez mas. “Menú emergente” y
“Pegar”.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ya tenemos nuestro grupo de botones
“Números”.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ahora hay que cambiar el contenido del
texto de cada botón</div>
<div style="margin-bottom: 0cm;">
y observar también como han ido
cambiando sus nombres según</div>
<div style="margin-bottom: 0cm;">
hemos ido pegando estos,sobre el
formulario.No olvidar cambiar </div>
<div style="margin-bottom: 0cm;">
su propiedad Tag.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Cambiamos el contenido del texto y
queda así:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTi9ZvlHBNC9awNun8DE0KV0S3XZzm2mW60-Mce0HrjYL0V03sokNXC1xYyZC6qHyob1weEjIdWJZ4resh9JwZzNP919kg0jQ1rnV4GW-c2EVu90PA_7MFijzHodrqlTnOUpUdJ9ANfnE/s1600/BotonesNumeros.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTi9ZvlHBNC9awNun8DE0KV0S3XZzm2mW60-Mce0HrjYL0V03sokNXC1xYyZC6qHyob1weEjIdWJZ4resh9JwZzNP919kg0jQ1rnV4GW-c2EVu90PA_7MFijzHodrqlTnOUpUdJ9ANfnE/s1600/BotonesNumeros.png" /></a></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a crear ahora nuestros botones
para las operaciones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Seleccionamos un botón de los números
,lo copiamos,pegamos y lo situamos</div>
<div style="margin-bottom: 0cm;">
a la derecha del 9.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Tenemos que cambiar sus propiedades de
nombre,grupo,texto y tag.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
A su nombre: BotonDiv</div>
<div style="margin-bottom: 0cm;">
Grupo: Operaciones</div>
<div style="margin-bottom: 0cm;">
Text: /</div>
<div style="margin-bottom: 0cm;">
Tag: 0</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ahora que tenemos seleccionado el botón
de dividir. Copiamos y Pegamos,</div>
<div style="margin-bottom: 0cm;">
debajo del botón dividir. Hasta tres
botones más.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Cambiamos de estos tres, sus
propiedades nombre,texto y tag.</div>
<div style="margin-bottom: 0cm;">
Nombrándolos y poniendo su signo de
operación.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
BotonPor</div>
<div style="margin-bottom: 0cm;">
BotonMenos</div>
<div style="margin-bottom: 0cm;">
BotonMas</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Y tendremos una imagen así:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8aKHU-3hnPgGuomDXTkJihZSaLcKa4ErklppYgHob7f4ANMDHVGuq_m6KTMVrX7hn1wyNLDO7twGUYhkQ_WmfDpTW52IAbmtllX53-3gwJt2WAMwWb4wFd6P2m4VUgs6mPugtl5eD2Vg/s1600/BotonesOpera.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8aKHU-3hnPgGuomDXTkJihZSaLcKa4ErklppYgHob7f4ANMDHVGuq_m6KTMVrX7hn1wyNLDO7twGUYhkQ_WmfDpTW52IAbmtllX53-3gwJt2WAMwWb4wFd6P2m4VUgs6mPugtl5eD2Vg/s1600/BotonesOpera.png" /></a></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Para la coma o punto y el signo igual
usaremos botones que no van en un grupo.</div>
<div style="margin-bottom: 0cm;">
Son dos botones independientes.</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
Así que seleccionamos un botón
cualquiera,copiamos y pegamos.</div>
<div style="margin-bottom: 0cm;">
Y lo colocamos debajo del 2, el botón
para el punto o coma y hacemos</div>
<div style="margin-bottom: 0cm;">
de nuevo la misma operación y
colocamos nuestro igual.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a los dos botones y cambiamos
para “el punto decimal”.Usaremos un punto.</div>
<div style="margin-bottom: 0cm;">
Su nombre: BotonComa</div>
<div style="margin-bottom: 0cm;">
Borramos su grupo y su tag (índice).</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Y hacemos lo mismo con el botón de
igual.</div>
<div style="margin-bottom: 0cm;">
Nombre: BotonIgual</div>
<div style="margin-bottom: 0cm;">
Borramos su grupo y su tag</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Tenemos todos los botones de nuestra
calculadora.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54ca0URbO8YSH4xk2O88o-UwWhYzAqGthNbNM2qNHl6xtwY7AgVVdTJu6PNlmD0NrqumwxGXumwGvI7Ma936xovRr6aCGboFqQ2VZnKjlD3mF0N34-2_dnEadtVep_zlJX5hAHBVNVE0/s1600/Calculadora.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54ca0URbO8YSH4xk2O88o-UwWhYzAqGthNbNM2qNHl6xtwY7AgVVdTJu6PNlmD0NrqumwxGXumwGvI7Ma936xovRr6aCGboFqQ2VZnKjlD3mF0N34-2_dnEadtVep_zlJX5hAHBVNVE0/s1600/Calculadora.png" /></a></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Es muy importante que para el futuro
sepáis crear vuestros grupos de controles.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Comencemos con el código.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a definir unas variables que son
comunes a todo el formulario.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
Private operando1 As Float</div>
<div style="margin-bottom: 0cm;">
Private operando2 As Float</div>
<div style="margin-bottom: 0cm;">
Private operador As String</div>
<div style="margin-bottom: 0cm;">
Private Borrapantalla As Boolean</div>
<div style="margin-bottom: 0cm;">
Private resultado As Float</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Pasamos al formulario y ahora pulsa
sobre cualquier botón de los números.</div>
<div style="margin-bottom: 0cm;">
Fíjate que ha salido como nombre del
evento Click , el grupo que pertenece.</div>
<div style="margin-bottom: 0cm;">
Con esto, tenemos el mismo código
común para todos esos botones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Vamos a programar su respuesta.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Fijaros en la variable Borrapantalla.</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
Public Sub Números_Clic()</div>
<div style="margin-bottom: 0cm;">
If Borrapantalla Then</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = ""</div>
<div style="margin-bottom: 0cm;">
Borrapantalla = False</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = Pantalla.Text &
Last.Text</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Es una variable Booleana. No se esta
comparando, pero se esta</div>
<div style="margin-bottom: 0cm;">
comprobando su valor.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Como la variable Booleana por defecto
vale “False” al comienzo.
</div>
<div style="margin-bottom: 0cm;">
IF comprueba si es True para saber si estamos con el primer operando</div>
<div style="margin-bottom: 0cm;">
o con el segundo.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Cada vez pulsemos una
tecla de los números su</div>
<div style="margin-bottom: 0cm;">
contenido de texto se añade al
contenido de texto de la etiqueta.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = Pantalla.Text &
Last.Text</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Al comienzo Pantalla.Text esta vacío</div>
<div style="margin-bottom: 0cm;">
Last.Text nos dice, que de su propiedad
texto de cualquier botón del </div>
<div style="margin-bottom: 0cm;">
grupo Números (el ultimo pulsado), se añadirá a la pantalla y
se </div>
<div style="margin-bottom: 0cm;">
mostrara en esta.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Así se van añadiendo números.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Veamos el código de las operaciones.</div>
<div style="margin-bottom: 0cm;">
Vamos a usar una instrucción
“condicional selectiva múltiple”</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
Public Sub Operacion_Clic()</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Select Case Last.tag</div>
<div style="margin-bottom: 0cm;">
Case 0</div>
<div style="margin-bottom: 0cm;">
operando1 = CFloat(Pantalla.Text)</div>
<div style="margin-bottom: 0cm;">
operador = "+"</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = ""</div>
<div style="margin-bottom: 0cm;">
Case 1</div>
<div style="margin-bottom: 0cm;">
operando1 = CFloat(Pantalla.Text)</div>
<div style="margin-bottom: 0cm;">
operador = "-"</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = ""</div>
<div style="margin-bottom: 0cm;">
Case 2</div>
<div style="margin-bottom: 0cm;">
operando1 = CFloat(Pantalla.Text)</div>
<div style="margin-bottom: 0cm;">
operador = "*"</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = ""</div>
<div style="margin-bottom: 0cm;">
Case 3</div>
<div style="margin-bottom: 0cm;">
operando1 = CFloat(Pantalla.Text)</div>
<div style="margin-bottom: 0cm;">
operador = "/"</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = ""</div>
<div style="margin-bottom: 0cm;">
End Select</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
---código----</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
La propiedad Tag de Last nos devuelve
su índice</div>
<div style="margin-bottom: 0cm;">
“Cada botón de operación tiene que
tener en su propiedad</div>
<div style="margin-bottom: 0cm;">
Tag un valor, de 0 a 3 en este caso”,
que son el número de</div>
<div style="margin-bottom: 0cm;">
operaciones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Cuando es 0, convierte el contenido de
la pantalla al tipo Real</div>
<div style="margin-bottom: 0cm;">
su operador es “+” y limpia la
pantalla.</div>
<div style="margin-bottom: 0cm;">
Habremos almacenado el primer operando
y su operador.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Podríamos haber usado el propio
contenido del botón para saber</div>
<div style="margin-bottom: 0cm;">
su operador, ya que este se encuentra
en la propiedad de texto</div>
<div style="margin-bottom: 0cm;">
del botón del grupo operaciones.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Y así sucesivamente según su índice
realizara una operación u otra.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
El botón de punto o coma.....</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
Public Sub BotonComa_Clic()</div>
<div style="margin-bottom: 0cm;">
If InStr(Pantalla.Text, ".")
= False Then</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = Pantalla.Text &
"."</div>
<div style="margin-bottom: 0cm;">
Endif</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Este grupo de instrucciones lo que hace
es buscar la coma dentro</div>
<div style="margin-bottom: 0cm;">
del texto contenido en la etiqueta que
es la pantalla. Si existe la coma</div>
<div style="margin-bottom: 0cm;">
no volverá a escribirse en la
pantalla, otra coma.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Y por ultimo nuestro botón igual:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
Public Sub BotonIgual_Clic()</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
operando2 = CFloat(Pantalla.Text)</div>
<div style="margin-bottom: 0cm;">
If operador = "+" Then
resultado = operando1 + operando2</div>
<div style="margin-bottom: 0cm;">
If operador = "-" Then
resultado = operando1 - operando2</div>
<div style="margin-bottom: 0cm;">
If operador = "*" Then
resultado = operando1 * operando2</div>
<div style="margin-bottom: 0cm;">
If operador = "/" And
operando2 <> 0 Then resultado = operando1 / operando2</div>
<div style="margin-bottom: 0cm;">
Pantalla.Text = resultado</div>
<div style="margin-bottom: 0cm;">
End</div>
<div style="margin-bottom: 0cm;">
---código----</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
En este grupo de instrucciones,
almacenamos el segundo operando</div>
<div style="margin-bottom: 0cm;">
y comprobamos cual es la operación que
quiere que hagamos.</div>
<div style="margin-bottom: 0cm;">
También comprueba que si la operación
es dividir,que su operando2 no sea 0</div>
<div style="margin-bottom: 0cm;">
para que no de error.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Hemos hecho
nuestra primera aplicación.</div>
<div style="margin-bottom: 0cm;">
Hay muchas funciones que se le pueden
añadir .Que el contenido de la</div>
<div style="margin-bottom: 0cm;">
pantalla no pase de una cantidad de
números. Etc</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Recordar que al pegar las comillas del blog al editor de gambas, hay que cambiarlas.No son el mismo tipo de comillas.Gambas no la interpreta igual.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ah, para el icono de nuestra calculadora.Ir a propiedades del formulario y usar</div>
<div style="margin-bottom: 0cm;">
la propiedad Icon. ;-)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-37707569209644371092012-06-14T10:07:00.000+02:002012-06-14T10:07:27.210+02:00Ejemplo.Otros dibujos 2<div style="text-align: left;">
Aquí tenéis otro generador de formas y dibujos.</div>
<div style="text-align: left;">
<br />La aplicación contiene dos controles sliders. Debes usar los dos sliders </div>
<div style="text-align: left;">
para generar el dibujo. Tienen un valor mínimo de tres y máximo de cien.</div>
<br />
Use una sentencia condicional para asegurarme de que cada slider tuviera<br />
un valor y que no fuera 0 en uno de los dos.<br />
<br />
Ejemplo: Usar primero un poco el de forma y luego el de repetición.<br />
<br />
Os muestro algunas de las imágenes que genera:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF94XJMKAaPnjRU0dM-lj10eeSLG17aDnPN7O59AnjMft3Tw0NW-BZjwztR-qx2u4R9DJT9tKrXsx3uEDH3LgGcAGs0I5TCuwSvp3qEeh-UbVoDhogQytxKhR9LtKV8IJQS7SS8dJSdOE/s1600/Figura3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF94XJMKAaPnjRU0dM-lj10eeSLG17aDnPN7O59AnjMft3Tw0NW-BZjwztR-qx2u4R9DJT9tKrXsx3uEDH3LgGcAGs0I5TCuwSvp3qEeh-UbVoDhogQytxKhR9LtKV8IJQS7SS8dJSdOE/s320/Figura3.png" width="282" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBSigRieTlIDHu4yg7GSP6lbDen3r-DToHi-KNdvqlBc7DSTGx9aIIz6Ub7fAamdpfjuLWDNfbIEcqLxqbCEr9iHIJYI1S7X5QN6EX7f91ctu2Jxg59TD8YzVdSJ7iyG8ZTagn9_qk_UQ/s1600/Figura4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBSigRieTlIDHu4yg7GSP6lbDen3r-DToHi-KNdvqlBc7DSTGx9aIIz6Ub7fAamdpfjuLWDNfbIEcqLxqbCEr9iHIJYI1S7X5QN6EX7f91ctu2Jxg59TD8YzVdSJ7iyG8ZTagn9_qk_UQ/s320/Figura4.png" width="282" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfIbN17q1x992f00qlRDdGWH4b9gYE39Ic3CKC_qWu68Rp22XwM-v1XSOdeVzGPjMRmsSm9f03lQ2IGen8PpkglsGYJzvEJ-I0slbK8ols_7RCEHML6JDJtdJGGBg51cmZ_ijqWXMEG2M/s1600/Figuras2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfIbN17q1x992f00qlRDdGWH4b9gYE39Ic3CKC_qWu68Rp22XwM-v1XSOdeVzGPjMRmsSm9f03lQ2IGen8PpkglsGYJzvEJ-I0slbK8ols_7RCEHML6JDJtdJGGBg51cmZ_ijqWXMEG2M/s320/Figuras2.png" width="282" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBpBzTXRN24dKOrjaaF8ZrGcHNoim4jJGCpTFevjaYwLg24dbcS2_MslnINGY1SHUx0tDzVgE5Gsy0cLI8x-e9DRvhjAIZBrwqny9dK5_YW0z_aDegTVNq_CHIWOwZwdnrEXjXxHTpoAg/s1600/Dibujo1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBpBzTXRN24dKOrjaaF8ZrGcHNoim4jJGCpTFevjaYwLg24dbcS2_MslnINGY1SHUx0tDzVgE5Gsy0cLI8x-e9DRvhjAIZBrwqny9dK5_YW0z_aDegTVNq_CHIWOwZwdnrEXjXxHTpoAg/s320/Dibujo1.png" width="282" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfp4LH2ZWLWyknGbqF7e86bfjCbjUjMk35xkMq1AChwdf_UhHrBY2sj0bEYNouZi30sY_HSlm78g_nSyM48PFj-O8M-fcHfprOYKRSDzuod6_U-n_4rsopodhno2vaa02kWNJ9jmNzPHs/s1600/Figura3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<a href="http://www.freedrive.com/file/1633855">GeneraDibujos2</a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghK3ZXxur9PfxOv-JPi0bqOlj4jnhyRMF3EX8cX2BMmfwc2VQhDn1LRkgozgbrNMhssW3ph8caY0bqQ0xIh_eOuKeZB4cREF-AppMrm8CSGNoJeaXc3gt57Udk9QduzEejyv8LeM83fvY/s1600/Figuras2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiECRvfno6DqyTw3VuylbchN75qsGuu_EYRyJJp1nX5594l2BCAwbjAtSB9ITlTV-l8ovZ2sH-Yrel6Bo-bY7Q3g09YHef-mqmh-ledu6lDylv-z_EfCAhl3SVjF5yGv_9_sR3q095ABFg/s1600/Figuras4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-63819944036385203802012-06-12T13:09:00.000+02:002012-06-12T13:09:51.961+02:00Lanzador para Fuse.Emulador de SpectrumEsta es una mini-aplicación para usar junto con el emulador de Spectrum.Fuse.<br />
Permite escoger el directorio donde están las cintas ya sean en formato .TAP<br />
o .TZX, seleccionar y lanzar el emulador para probarlas.<br />
<br />
He añadido "por ahora" la opción de usar dos modelos:<br />
- 48K<br />
- 128k Plus 2A<br />
<br />
Además de poder seleccionar si quieres que la carga sea lenta.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYcW7_95Vhlwad8xtSk2Bb6es4m13tAmTtsO3GmctC4DYGTSM_cQRtL68j_ayIyhrLa3jtA0fm8Og2RxI9Yw7KsamIvEX5CH3N5RxfGF60rCRHxkuS1mz9eWFgrJ75wizt8rUxHpWJLfw/s1600/Lanzador+para+Fuse.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="189" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYcW7_95Vhlwad8xtSk2Bb6es4m13tAmTtsO3GmctC4DYGTSM_cQRtL68j_ayIyhrLa3jtA0fm8Og2RxI9Yw7KsamIvEX5CH3N5RxfGF60rCRHxkuS1mz9eWFgrJ75wizt8rUxHpWJLfw/s320/Lanzador+para+Fuse.png" width="320" /></a></div>
<br />
La mayoría de estos lanzadores se le conocen como Front-End.<br />
<br />
<a href="http://www.freedrive.com/file/1633307">Lanzador para Fuse</a><br />
<br />
Mas información sobre Fuse en:<br />
<br />
<a href="http://fuse-emulator.sourceforge.net/">Pagina de Free Unix Emulator Spectrum.(FUSE)</a>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-86045079616762651492012-06-12T12:43:00.000+02:002012-06-12T13:10:18.185+02:00Ejemplo.Texto a VozEste es un pequeño ejemplo de como convertir un texto a voz,<br />
usando la utilidad del sintetizador de voz "espeak" que nos proporciona<br />
el centro de software que incorpora nuestra distro.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgpkzyh5biGp6qeJg2Zo2Es-oFCOpa0BIR0kt_SCXiJW0dBH1HLkFXvlQfUsWXqiZCzRT1ojVnr6R3jlslYGWNnnxz6KwoNjnn_XD2xFBqhMvyVpvGvfGUwObdL8OcYk3WbUHJdbG5_2I/s1600/TextoAVoz.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="84" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgpkzyh5biGp6qeJg2Zo2Es-oFCOpa0BIR0kt_SCXiJW0dBH1HLkFXvlQfUsWXqiZCzRT1ojVnr6R3jlslYGWNnnxz6KwoNjnn_XD2xFBqhMvyVpvGvfGUwObdL8OcYk3WbUHJdbG5_2I/s320/TextoAVoz.png" width="320" /></a></div>
<br />
<br />
Recordar que hace falta tener instalado espeak para que funcione.<br />
<br />
<a href="http://www.freedrive.com/file/1633310">Texto a voz</a>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-25393009429528378362012-06-11T13:11:00.000+02:002012-06-11T13:11:34.870+02:00Función de cadena Split<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm;">
<u>Como dividir una variable de cadena
en un array o matriz de cadena.</u></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Olvide esta función cuando tratamos el
tema del manejo de cadenas.</div>
<div style="margin-bottom: 0cm;">
Y es una función muy importante.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Permite que una frase, un texto,
podamos dividirla en palabras y
</div>
<div style="margin-bottom: 0cm;">
almacenarlas en un array, teniendo en
cuenta el uso de un “separador”.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
El separador puede ser cualquier
carácter, símbolo, espacio,etc.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Una sintaxis básica puede ser esta:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Matriz o array de cadena=Split
(cadena,separador)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
DIM atexto AS STRING[]</div>
<div style="margin-bottom: 0cm;">
DIM sfrase AS STRING</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
sfrase=”En un lugar de la Mancha, de
cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un
hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y
galgo corredor.”</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
atexto=Split(sfrase,” “)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
El separador seria el espacio y cada
palabra seria almacenada en el array o matriz con
</div>
<div style="margin-bottom: 0cm;">
un índice diferente. De esta manera
seria muy fácil hacer un contador de palabras.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Para averiguar el numero de elementos
de un array usamos la propiedad “count”.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
El primer índice del array es cero.
Así si el numero de palabras es 2.</div>
<div style="margin-bottom: 0cm;">
El índice cero seria una y el índice
1 seria la segunda.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Count nos devolvería 2. Contando con
el cero.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Solo tenemos que añadir al final del
código:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
PRINT atexto.count</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Como veis he utilizado el prefijo ”a”
delante de texto</div>
<div style="margin-bottom: 0cm;">
y “s” delante de frase. “A” de
array y “s” de string.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Es una manera fácil de deducir
rápidamente que tipo de variables</div>
<div style="margin-bottom: 0cm;">
es cuando estés viendo el código y la
encuentres en cualquier</div>
<div style="margin-bottom: 0cm;">
parte. </div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Mas información en el manual de Gambas
en la pagina 59.</div>
<div style="margin-bottom: 0cm;">
O también en:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<a href="http://gambasdoc.org/help/lang/split?es&view">Función Split en GambasDoc</a></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-1730177554343471042012-06-10T14:39:00.000+02:002012-06-10T15:05:24.026+02:00Circulos.Partes.Polígonos regularesEn este ejemplo encontré dos maneras de dividir el circulo en n partes.<br />
Como también gracias al segundo ejemplo, encontré la forma de hacer<br />
un polígono regular de n lados.<br />
<br />
Quizás el primer modo no salga bien a veces cuando el número de partes<br />
es impar.<br />
<br />
Con la segunda manera encuentro los puntos sobre la circunferencia.<br />
Tales como la x y la y.Así que fue cuestión de crear un array<br />
de estos puntos y luego pasarlos a la función.<br />
<br />
Draw.Poligon<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj71XD-5U4PZRvcKQkdxjh6MxLHcN5v5LCpNqPwzmHPnf3C3Y4V_ZTgnE99h4b3hVCF833yx9hQDKCvU8ZmgGY6AhPlOwHY65NqDohw56v52dM1iIfSZYkQg3nR_1LuYd2M8GkaRaGvEH8/s1600/CirculoNPartes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj71XD-5U4PZRvcKQkdxjh6MxLHcN5v5LCpNqPwzmHPnf3C3Y4V_ZTgnE99h4b3hVCF833yx9hQDKCvU8ZmgGY6AhPlOwHY65NqDohw56v52dM1iIfSZYkQg3nR_1LuYd2M8GkaRaGvEH8/s320/CirculoNPartes.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMnYxavHI8re6CRlxOlximw4nD6ky5bmGYvMi0YruOBqLgEZIuClGs0_AvCMBnHp2cQBCSLMw4nsk2K0nI0NH2W6OSCVc10sIxSGgEtCpY369u1oyjxZyEJV0mz3OL08AIeIubZpFnB48/s1600/PoligonoRegular.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMnYxavHI8re6CRlxOlximw4nD6ky5bmGYvMi0YruOBqLgEZIuClGs0_AvCMBnHp2cQBCSLMw4nsk2K0nI0NH2W6OSCVc10sIxSGgEtCpY369u1oyjxZyEJV0mz3OL08AIeIubZpFnB48/s320/PoligonoRegular.png" width="320" /></a></div>
<br />
<br />
<br />
<a href="http://www.freedrive.com/file/1632620">Círculos y Polígonos</a><br />
<br />
Mas información en:<br />
<br />
<a href="http://gambasdoc.org/help/comp/gb.qt/draw/polygon?es">Función Draw.Poligon</a>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-75003635970438824212012-06-09T02:16:00.000+02:002012-06-09T02:24:35.739+02:00Ejemplo.Busca clones de M.A.M.EEsta aplicación fue la primera que hice aprovechando brevemente<br />
los recursos que ofrece Gambas para manejar cadenas.<br />
<br />
Para poder usarla,necesitáis tener instalado en el sistema<br />
M.A.M.E. El multi arcade emulador. Sin este, no funcionara.<br />
<br />
La aplicación aprovecha la posibilidad de búsqueda de clones y<br />
la muestra en un componente Gridview.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmyhbClruwRADZLzwGsw3ibkx6wwQCUwCGpZF2blozoS86l4gxrf-phTmj1fKg5ZF9xTflV3XE4ZQVFiJJWlriUTmnb5MXAPgNAsKd5CdVO4wqZNilaEhyphenhyphenE0uqvCSH2yk8hSOMAMRb7Xo/s1600/Buscador+de+Clones+para+M.A.M.E.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmyhbClruwRADZLzwGsw3ibkx6wwQCUwCGpZF2blozoS86l4gxrf-phTmj1fKg5ZF9xTflV3XE4ZQVFiJJWlriUTmnb5MXAPgNAsKd5CdVO4wqZNilaEhyphenhyphenE0uqvCSH2yk8hSOMAMRb7Xo/s1600/Buscador+de+Clones+para+M.A.M.E.png" /></a></div>
<br />
<br />
Esta aplicación no baja ningún archivo.Solo trabaja con una lista que ofrece<br />
el emulador. ;-)<br />
<br />
Cuando el nombre no lo reconoce, mostrara un mensaje.La aplicación<br />
es un ejemplo de como podemos aprovechar Gambas para algo que nos<br />
gusta.Tu proyecto, llevado a Gambas.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihmAJ9N1au7j1jN22Gy5KNcvZPzQLHL-LURNGta3eN0OUYgaTGSB2bOuucz9MVoUS4nmH0Cu_Tc_TFC0xrW6t49ZTMSRgqKjjxrSN9rLZUHTExaj41sHUSBt7E5SZeuSrtISW1B9wkGOI/s1600/Pantallazo-Buscador+de+Clones+para+M.A.M.E_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihmAJ9N1au7j1jN22Gy5KNcvZPzQLHL-LURNGta3eN0OUYgaTGSB2bOuucz9MVoUS4nmH0Cu_Tc_TFC0xrW6t49ZTMSRgqKjjxrSN9rLZUHTExaj41sHUSBt7E5SZeuSrtISW1B9wkGOI/s1600/Pantallazo-Buscador+de+Clones+para+M.A.M.E_2.png" /></a></div>
<br />
Aquí tenéis el código:<br />
<br />
<a href="http://www.freedrive.com/file/1632251">BuscaClonesM.A.M.E</a> <br />
<br />
Mas información sobre M.A.M.E<br />
<br />
<a href="http://mamedev.org/">Enlace a la web de MameDev</a><br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-32512690736711655682012-06-08T12:48:00.000+02:002012-06-08T12:59:53.134+02:00Manejo de cadenas.Continuación<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
Continuamos donde lo dejamos. Sigamos
con las muchas de las operaciones
<br />
<div style="margin-bottom: 0cm;">
que podemos hacer con el manejo de
cadenas.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<u>Los espacios en una cadena.</u></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Hay veces que nos interesa eliminar los
espacios contenidos en una variable de cadena.</div>
<div style="margin-bottom: 0cm;">
Ya sea por el comienzo, por el final o
en ambos lados.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Para eliminar por la izquierda usamos:</div>
<div style="margin-bottom: 0cm;">
Ltrim$(cadena)
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Imaginar que nuestro usuario entra una
palabra y ha añadido, espacios al principio </div>
<div style="margin-bottom: 0cm;">
que no tienen utilidad.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
En el caso de un nombre.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
DIM nombre AS STRING</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
nombre=” Luisa”</div>
<div style="margin-bottom: 0cm;">
PRINT nombre</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
nombre= LTrim$(nombre)</div>
<div style="margin-bottom: 0cm;">
PRINT nombre</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Por la derecha lo haríamos con la función RTrim$</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
DIM nombre AS STRING</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
nombre=”Luisa ”</div>
<div style="margin-bottom: 0cm;">
PRINT nombre</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
nombre= RTrim$(nombre)</div>
<div style="margin-bottom: 0cm;">
PRINT nombre</div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Observar los puntos en la salida de
consola.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Ahora usemos Trim$. Con esta función
eliminaremos los espacios</div>
<div style="margin-bottom: 0cm;">
contenidos en la variable de cadena,
tanto al comienzo como al final.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
DIM frase AS STRING</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
frase=” En un lugar de la Mancha
”</div>
<div style="margin-bottom: 0cm;">
PRINT frase</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
frase= RTrim$(frase)</div>
<div style="margin-bottom: 0cm;">
PRINT frase</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
Es interesante como podemos manejar la
entrada de información y adaptarla</div>
<div style="margin-bottom: 0cm;">
para que nuestro programa nos muestre
el resultado que queremos.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<u>Substituir una palabra,una letra
dentro de una variable de cadena.</u></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Si queremos
realizar esta función debemos usar:</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Replace$(Cadena,patrón,remplazo)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-align: justify; text-decoration: none;">
Hay situaciones
que no necesitamos una asignación de una variable,simplemente</div>
<div style="margin-bottom: 0cm; text-align: justify; text-decoration: none;">
usamos la
función para que nos muestre un resultado y no almacenamos</div>
<div style="margin-bottom: 0cm; text-align: justify; text-decoration: none;">
la operación en
una variable. Esto es según os convenga hacer.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
En este caso no
usaremos una variable, solo una cadena de texto</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
que está dentro
de las “”</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<a href="http://www.blogger.com/blogger.g?blogID=1883338940775324428" name="__DdeLink__381_921834838"></a>
PRINT Replace$(“como poco coco como poco coco compro”,”o”,”e”)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
OJO - Cuidado al
copiar y pegar en el editor con las comillas. :-)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<u>Fijaros que
no son</u> “” lo que sale a veces al pegar en el editor</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Retocar si hace
falta en el editor de Gambas.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<u>Cambiar de mayúsculas a minúsculas
o viceversa.</u></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
A veces
necesitamos convertir el contenido de la variable de cadena a
mayúsculas</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
o minúsculas.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
DIM palabra as
STRING</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
palabra=”Aplicación
en Basic”</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT palabra</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT 'Dejamos
un espacio</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
palabra=UCase$(palabra)
'Convertimos a mayúsculas</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT palabra</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT 'Dejamos
un espacio</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
'Ahora
convertimos a minúsculas</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
palabra=LCase$(palabra)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT palabra</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm;">
---código---</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<u>Para una búsqueda de una palabra y
nos indique su lugar.</u></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Hay veces que
nos interesa saber si en el contenido de una variable de cadena,</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
existe una
palabra determinada, un carácter,etc. O también su lugar de
comienzo.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Usaremos la
función:</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
InStr(cadena,subcadena,posición
de comienzo de búsqueda)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
No siempre
tenemos que especificar desde donde buscar,</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
en otros caso,
si. Por si la palabra se repite y no te interesa</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
ese lugar de
comienzo.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
---código----</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
PRINT
InStr(“basic basico”,”bas”)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Nos mostrara el
lugar de la primera coincidencia donde se encuentra la palabra “bas”</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Pero y si
queremos que nos muestre otro lugar. Debemos especificar en la</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
instrucción una
posición.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Existe también
otra función que en vez de comenzar la búsqueda por la izquierda</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
la realiza por
la derecha.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
RinStr(cadena,subcadena,inicio)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Ambas funciones
se complementan con el uso de bucles y las</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
funciones
Left$,Right$ y MID$.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm;">
<u>Para añadir espacios</u></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Con esta función
obtendremos un número de espacios en una cadena.</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
variable_de_cadena=Space$(n)</div>
<div style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm; text-decoration: none;">
Donde n es el
número de espacios que queremos.</div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-14620666403269901762012-06-07T11:34:00.000+02:002012-06-07T11:34:39.478+02:00Manejo de cadenas<style type="text/css">
<!--
@<span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">page</span> { <span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">margin</span>: 2cm }
P { <span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">margin</span>-<span style="background: none repeat scroll 0% 0% yellow;" class="goog-spellcheck-word">bottom</span>: 0.21cm }
-->
</style>
<br />
<div style="margin-bottom: 0cm;">
El manejo de las cadenas es fundamental
en nuestros programas.</div>
<div style="margin-bottom: 0cm;">
Ya sea para la búsqueda,la
presentación,operaciones,etc.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Gambas nos da muchas posibilidades para
trabajar con ellas.</div>
<div style="margin-bottom: 0cm;">
Tenemos funciones que el propio
lenguaje nos facilita.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Algunas funciones que podemos
encontrar:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<ul>
<li><div style="margin-bottom: 0cm;">
Saber la longitud de una cadena.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Presentar un texto desde el
comienzo,de izquierda a derecha, derecha a izquierda.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Eliminar los espacios,ya sea por
la izquierda o la derecha,todos los espacios.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Para dividir una cadena en un
array de cadena.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Para cambiar una palabra por otra.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Para cambiar de mayúsculas a
minúsculas o viceversa.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Para buscar una palabra y que nos
diga en que lugar se encuentra. O que existe.</div>
</li>
<li><div style="margin-bottom: 0cm;">
Para añadir espacios.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
</li>
</ul>
<div style="margin-bottom: 0cm;">
Hay muchas más.<br />
</div>
<div style="margin-bottom: 0cm;">
Gambas nos da muchas posibilidades con
las funciones propias que incluye.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<u>Longitud de una cadena. Función LEN</u></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Tiene
mucho uso. Acompañado de un bucle FOR – NEXT</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
encontraremos
muchas posibilidades para nuestro programa.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Averiguaremos
la longitud con la función LEN(variable de cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”candelabro”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
LEN(cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm;">
<u>Presentar un texto.
Funciones LEFT$,RIGHT$,MID$</u></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Una
manera de darnos cuenta de que un comando o función trabaja con
cadenas</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
es
que en la propia instrucción suele incluir el carácter “$”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm;">
<u>Función LEFT$.</u></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Esta
funcione nos mostrara los caracteres de una cadena comenzando por</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
su
izquierda.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”candelabro”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
LEFT$(cadena,3)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Nos
mostrara desde la izquierda, 3 caracteres que contienen la variable
cadena</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Con
la aplicación de los bucles ganamos mucho trabajando con estas
funciones.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm;">
<u>Función RIGHT$</u></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Es a
la inversa de la anterior.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”candelabro”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
RIGHT$(cadena,3)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Nos
mostrara desde la derecha, 3 caracteres que contienen la variable
cadena</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Y la
que creo que es la más potente.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm;">
<u>Función MID$</u></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Es
una función capaz de comenzar desde un lugar de la cadena en
concreto</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
y
decirle cuantos caracteres queremos que nos muestre.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”candelabro”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
MID$(cadena,3,1)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Con
esto logramos decirle que queremos que nos muestre desde el comienzo
de la cadena</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
por
la izquierda, se situé en el carácter que ocupa el “lugar” 3 y
nos muestre una cantidad</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
de
caracteres. En este caso 1.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Ahora
imaginar lo que podríamos hacer con bucles.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Ejemplo
con LEFT$</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM x
as INTEGER</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”escalera”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
FOR
x=1 TO LEN(cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
LEFT$(cadena,x)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
NEXT</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Ejemplo
con RIGHT$</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM x
as INTEGER</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”escalera”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
FOR
x=1 TO LEN(cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
RIGHTS(cadena,x)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
NEXT</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Probar
a hacer el bucle FOR a que vaya de mayor a menor usando
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
estas
dos funciones. ;-)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Y
ahora MID$.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM x
as INTEGER</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”escalera”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
FOR
x=1 TO LEN(cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
MID$(cadena,x,1)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
NEXT</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Ahora
viene lo peculiar. Como veis hemos mostrado una letra de una en una.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Y si
quisiéramos mostrar una a una con una pausa como si escribiéramos</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
con
una maquina de escribir. :-)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Tendremos
que usar la instrucción WAIT para crear una pausa de x's
milisegundos.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
WAIT
0.1 'Añade 100 milisegundos de retraso</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
WAIT
0.5 'Añade 500 milisegundos de retraso.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Bien.
En el caso de una instrucción PRINT , muestra algo por la consola.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Podemos mostrarla como si fuera una lista o detrás de otro con la ayuda</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
de
“;”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
“José ”;</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
“Luis”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
También
podemos hacer:</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
“José ”;”Luis”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Naturalmente
queda mas presentable en un componente TextArea</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Vamos
al ejemplo. ;-)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM
cadena AS STRING</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
DIM x
as INTEGER</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
cadena=”Esto
es un mensaje letra por letra.”</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
FOR
x=1 TO LEN(cadena)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
PRINT
MID$(cadena,x,1);</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
WAIT
0.2 '</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
NEXT</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
---código---</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Probar
a cambiar el tiempo en wait. :-)</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br />
</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Continuara....</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Os añado una aplicación para que veais ejemplos.</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIqdZm8Y5xrAMbAqg6UoOMmIflKX8V-GK7oTub9i-GHutPZau5jz9X8TQtgVFYyU4nNBEOSm4nq21shZPg4uSER25MWEKRfkCeeS3SZKcbN3DHkFZXVuUbBiKXX39DscSVP1RtfvkQjpw/s1600/FuncionesDeCadena.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="279" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIqdZm8Y5xrAMbAqg6UoOMmIflKX8V-GK7oTub9i-GHutPZau5jz9X8TQtgVFYyU4nNBEOSm4nq21shZPg4uSER25MWEKRfkCeeS3SZKcbN3DHkFZXVuUbBiKXX39DscSVP1RtfvkQjpw/s320/FuncionesDeCadena.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-CMAssmbwMSReBVHloddomgs56_9vD6m4o2L8lvZ6Rsiplh-sWMPuKQ0Sm1vCg9gz1ksK_wElEe0nMRcY6xSmjG3bXUQz0ycwMY-obPln0R-VCBcm5xPGNQQJvmzrOwv-BW_ozlKPPwI/s1600/ConversionesDeTipo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="279" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-CMAssmbwMSReBVHloddomgs56_9vD6m4o2L8lvZ6Rsiplh-sWMPuKQ0Sm1vCg9gz1ksK_wElEe0nMRcY6xSmjG3bXUQz0ycwMY-obPln0R-VCBcm5xPGNQQJvmzrOwv-BW_ozlKPPwI/s320/ConversionesDeTipo.png" width="320" /></a></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Ejemplo:</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<a href="http://www.freedrive.com/file/1631352">Funciones de Cadenas</a></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
Mas información en:</div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<a href="http://gambasdoc.org/help/cat/string?es">Instrucciones para las funciones de cadena</a></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div align="LEFT" style="margin-bottom: 0cm; text-decoration: none;">
<a href="http://gambasdoc.org/help/lang/wait?es">La instrucción Wait</a></div>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-1506423607243812322012-06-06T13:46:00.000+02:002012-06-06T14:43:29.950+02:00PSeIntEste programa permite el estudio de la programación a nivel de pseudocódigo.<br />
Es lo mas parecido al lenguaje humano. No se necesita ningún lenguaje<br />
en concreto.Solo este programa.<br />
<br />
Entendiendo el pseudocódigo, seremos capaces de llevar nuestro "algoritmo"<br />
a cualquier lenguaje que pretendamos aprender.<br />
<br />
<a href="http://pseint.sourceforge.net/index.php?page=portada.php">PSeInt</a><br />
<br />
En la propia web, dispones del programa para diferentes sistemas operativos.<br />
Vídeos explicativos y disponéis también de imágenes del programa.<br />
<br />
Este programa tiene su propio "interprete" con lo que veremos la salida<br />
de nuestro programa en una consola.<br />
<br />
Además permite la creación del "diagrama de flujo" de nuestro "algoritmo".<br />
<br />
Ejemplos:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgscTYNKUi8936XoedjHYJCTWP_FZa4xAGCVArdL6j8SlToEU7rQ14fwo_GQCwFg5VMjnUYUD3xE4PXoQ9mMi7LnAIAh-y3aUnlMkiD37-mqlkf8oc7eYbswdQ3k2JGKiQe9H3z_8VeoVo/s1600/codigo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgscTYNKUi8936XoedjHYJCTWP_FZa4xAGCVArdL6j8SlToEU7rQ14fwo_GQCwFg5VMjnUYUD3xE4PXoQ9mMi7LnAIAh-y3aUnlMkiD37-mqlkf8oc7eYbswdQ3k2JGKiQe9H3z_8VeoVo/s320/codigo.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBq7-rTrpnQM6m80WUSEyILT4rz1RkOskBrHn10JK6m8MZ4k5w9PSglQOY7pbaA-ZV_RAiC_m9B39uqZxBCqSuvhuSQq835tZm0sWTmC6COCKMOyLsdOvqBVUXwvOjxx_g9tjgE5gAU1s/s1600/Diagrama.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBq7-rTrpnQM6m80WUSEyILT4rz1RkOskBrHn10JK6m8MZ4k5w9PSglQOY7pbaA-ZV_RAiC_m9B39uqZxBCqSuvhuSQq835tZm0sWTmC6COCKMOyLsdOvqBVUXwvOjxx_g9tjgE5gAU1s/s320/Diagrama.png" width="164" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoL0m-G5U6fhzak3hJlNiako3fUvcwA4YA3XvgnoEahviPhXgQnikq7aWRb5TvgL4k7JUEvPeqz3rZwzatsS2I6CgCzWWNsUSommBiFPsM8ph4cU77GXFmN5OCZicnoYiTMMKtIkaNnHQ/s1600/Ejecucion.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoL0m-G5U6fhzak3hJlNiako3fUvcwA4YA3XvgnoEahviPhXgQnikq7aWRb5TvgL4k7JUEvPeqz3rZwzatsS2I6CgCzWWNsUSommBiFPsM8ph4cU77GXFmN5OCZicnoYiTMMKtIkaNnHQ/s320/Ejecucion.png" width="320" /></a></div>
<br />
Es ideal para aprender y dar los primeros pasos.<br />
En Youtube tenemos vídeos explicativos de aficionados que han hecho sus<br />
programas y los han publicados en el.<br />
<br />
<br />
Mas información en:<br />
<br />
<a href="http://es.wikipedia.org/wiki/Algoritmo">Algoritmo</a><br />
<br />
<a href="http://es.wikipedia.org/wiki/Pseudoc%C3%B3digo">Pseudocódigo</a><br />
<br />Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com0tag:blogger.com,1999:blog-1883338940775324428.post-38758722211563526722012-06-06T09:25:00.001+02:002021-01-31T22:04:49.884+01:00Bucles Anidados<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
</style>
<br />
Un bucle anidado es un bucle dentro de
otro bucle. Así podemos tener varios
<div style="margin-bottom: 0cm;">
bucles anidados según lo que queramos
hacer en nuestro programa.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Ejemplo: el caso de que quisiéramos
crear todas las tablas de multiplicar del 1 al 10.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Tendríamos que hacer
</div>
<div style="margin-bottom: 0cm;">
1 x 1,1 x 2,1 x 3...1 x 10</div>
<div style="margin-bottom: 0cm;">
2 x 1,2 x 2, 2 x 3...2 x 10</div>
<div style="margin-bottom: 0cm;">
.</div>
<div style="margin-bottom: 0cm;">
.</div>
<div style="margin-bottom: 0cm;">
10 x 1,10 x 2,10 x 3.....10 x 10</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
El primer factor podría ser una
variable que iría cambiando 1 al 10</div>
<div style="margin-bottom: 0cm;">
y el segundo seria otra variable que
iría cambiando del 1 al 10.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Con eso sabemos que tenemos las
variables: factor1,factor2.
</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Con estas dos variables tenemos las
suficientes para nuestro programa.</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Podíamos tener una tercera para el
resultado, pero no es realmente necesaria.</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Usaremos el tipo de bucle que
queramos,conociendo como es.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Definimos las variables:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Tipo entero: factor1,factor2</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Para factor1 repetir de 1 hasta 10</div>
<div style="margin-bottom: 0cm;">
Para factor2 repetir de 1 hasta 10</div>
<div style="margin-bottom: 0cm;">
Mostrar factor1 & “ * “ &
factor2 & “ = “ & (factor1 * factor2)</div>
<div style="margin-bottom: 0cm;">
Fin Para</div>
<div style="margin-bottom: 0cm;">
Fin Para</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm; text-align: justify;">
Un ejemplo típico de uso de los bucles
anidados es con el uso de un array de varias</div>
<div style="margin-bottom: 0cm; text-align: justify;">
dimensiones. Si tuviéramos una pizarra
en la que vamos a dibujar un punto, necesitaríamos</div>
<div style="margin-bottom: 0cm; text-align: justify;">
saber dos coordenadas. La x y la y. Si
tuviéramos almacenados en un array estas coordenadas</div>
<div style="margin-bottom: 0cm; text-align: justify;">
tal que así:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
coordenadas(x,y)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Para leer todas los datos del array
coordenadas lo mas aconsejable es usar dos bucles.</div>
<div style="margin-bottom: 0cm;">
Uno dentro del otro. Anidados</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Así iríamos leyendo:</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
coordenadas(0,0),coordenadas(0,1),coordenadas(0,2)....</div>
<div style="margin-bottom: 0cm;">
coordenadas(1,0),coordenadas(1,1),coordenadas(1,2)...</div>
<div style="margin-bottom: 0cm;">
.</div>
<div style="margin-bottom: 0cm;">
.</div>
<div style="margin-bottom: 0cm;">
coordenadas(x,y)</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Hasta llegar al ultimo valor almacenado
en el array.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Podemos crear una rejilla. Para el uso
de gráficas es fundamental.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
Bien. Cuando queremos comentar algo en
un programa Gambas usamos el símbolo “ ' “</div>
<div style="margin-bottom: 0cm;">
Así una linea de comentario tendría
una aspecto como esto.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
' Esto es un ejemplo de comentario</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
En este código fuente que os pongo
ahora. Veréis que en FORM_OPEN()</div>
<div style="margin-bottom: 0cm;">
existen lineas comentadas. Cada linea
llama a un procedimiento que ejecuta</div>
<div style="margin-bottom: 0cm;">
un tipo distinto de bucle anidado. Como
me interesa ver el resultado de uno</div>
<div style="margin-bottom: 0cm;">
de ellos. Comento el resto y dejo solo
uno para que se ejecute.</div>
<br />
<script src="https://pastebin.com/embed_js/mmq5UE0H"></script>
<div style="margin-bottom: 0cm;"><br /></div><div style="margin-bottom: 0cm;"><br /></div><div style="margin-bottom: 0cm;"><br /></div>
<div style="margin-bottom: 0cm;">
Aquí tenéis un ejemplo de la creación de una rejilla. </div>
<div style="margin-bottom: 0cm;">
Puedes hacer click en las celdas que la forman.</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik9SDCg8n-RVQoJXThz0mVGVbG3tRaLney-tFIFhoQKFVn9DWxk6h7j01b8lzqrFb_izSbcdzFV_1_JX5o0pwtGTg-1e2dSFnY6EMqdgSRc59CYcoetSeS_r__5gF3PuFy3apy8xMezro/s1600/Rejilla1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik9SDCg8n-RVQoJXThz0mVGVbG3tRaLney-tFIFhoQKFVn9DWxk6h7j01b8lzqrFb_izSbcdzFV_1_JX5o0pwtGTg-1e2dSFnY6EMqdgSRc59CYcoetSeS_r__5gF3PuFy3apy8xMezro/s320/Rejilla1.png" width="291" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifPL24df8NgXqXedTe18XynP6oW3-Pl8Zw1mAt1lYsfrd26GHgqP6mZYXjlazukXOBYP_dEwJiz9FDjZbIguiZ5IywWgWcQP_saHnKgNxcLoFuA9f0gG-thszsHtCsbyj7jJG8KHUEHAk/s1600/Rejilla2.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifPL24df8NgXqXedTe18XynP6oW3-Pl8Zw1mAt1lYsfrd26GHgqP6mZYXjlazukXOBYP_dEwJiz9FDjZbIguiZ5IywWgWcQP_saHnKgNxcLoFuA9f0gG-thszsHtCsbyj7jJG8KHUEHAk/s320/Rejilla2.png" width="291" /></a></div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<div style="margin-bottom: 0cm;">
<br />
</div>
<a href="http://www.freedrive.com/file/1630911">Ejemplo de rejilla</a>Shellhttp://www.blogger.com/profile/02585160758949643123noreply@blogger.com3