FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Problemas cuando elimino un componente en RunTime
Saludos amigos:
Estoy realizando un panel de control en Delphi 10.3 para conocer la conectividad de los servidores del data center, basado en Ping. Este es el aspecto de la pantalla principal: Asumiremos que solo hay 2 servidores en la BD: 192.168.1.10 y 192.168.1.11. Al Iniciar el programa el Ping de ambos servidores funcionan bien y se listan en el panel de la izquierda. Luego de un tiempo el servidor 192.168.1.11 cae, al presionar el botón Actualizar ahora tenemos a 192.168.1.10 en el panel izquierdo (activos) y a 192.168.1.11 en el panel derecho (inactivos). Luego de un tiempo mas el server 11 vuelve a tener ping, ahí ocurre el error: al presionar el botón actualizar. Dejo la unidad completa para documentación:
Por ultimo la estructura de la tabla de SQL Server:
|
#2
|
||||
|
||||
Cita:
Hay bastantes cosas a comentar sobre el código, pero si nos centramos en el error, deberías dar más información. Por otro lado, ¿lo has ejecutado paso a paso? ¿dónde se produce? Si saber más, de todas formas te puedo decir algo que te va a dar problemas. Estás definiendo variables globales (panx, lblTitulo1,...) y luego estás usando las mismas variables para crear varios paneles. La segunda vez que las uses estará perdiendo las referencias. Eso además de pérdidas de memoria seguramente te va a generar problemas (accesss violations) a la hora de destruir esos componentes. También están las listas L1, L2, que he visto que se crean, pero no veo dónde se destruyen. Eso sumado a que este procedimiento se llama continuamente, se van a convertir en problemas graves. Otra sugerencia, es que uses Frames. Define un Frame que contenga toda la información de 1 servidor, y crear y destruyes ese frame con 1 línea. Eso te evita el crear y destruir un montón de componentes. Más sencillo, simple y seguro.
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#3
|
|||
|
|||
En primer lugar agradecer la atención estimado Neftalí, si, lo sé, como te puedes dar cuenta, este código adolece de muchas deficiencias, y en parte se debe a que nunca trabaje antes con creación dinámica de componentes, de modo que no conozco la lógica de creación y destrucción de los mismos, voy a dejar el código de este proyecto al completo, así cualquier aporte será bienvenido.
En este proyecto se están usando las siguientes librerías de terceros: - DevExpress 23.1.4. - TMS Component Pack 9.0.2.0. Enlace al Proyecto: Aqui Video del error: Aqui Agradecería si hubiera una forma sencilla de corregir el código ya existente, pero bien escrito, jeje Atte Américo Cita:
Última edición por darkamerico fecha: 30-01-2024 a las 14:32:27. |
#4
|
||||
|
||||
El error que aparece al destruir componentes (por lo que he visto).
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#5
|
|||
|
|||
Eso es correcto amigo. Debido a mi poca expertice en el manejo de objetos en Runtime, no puedo tener la idea clara de como arreglar este inconveniente.
|
#6
|
||||
|
||||
Este seguramente, porque en la parte del ELSE añades a la lista esto:
En lugar de esto:
Eso provoca el "Accesss Violatoin" al destruir los componentes.
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#7
|
|||
|
|||
Estimado Darkamerico...creo que sería una buena opción que utilizara TFrame...Simplificaría creo, el problema.
Como estoy de vacaciones y un poquito aburrido, le envío un ejemplo a ver si le ayuda en su problema...De lo contrario lo arroja al tacho de la basura... ServerFrame_Sample_Cloayza Saludos cordiales |
#8
|
|||
|
|||
Muchas gracias bro,
lo voy a revisar Un Abrazo Cita:
|
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Problemas con C++Builder, Word automatizacion, y Build with runtime packages | aguml | C++ Builder | 4 | 01-06-2013 21:28:48 |
Evento cuando se crea un componente sobre el mio | delphiladero | OOP | 1 | 17-06-2008 12:51:10 |
Cuando van habilitar seccion componente | leodelca23 | La Taberna | 1 | 20-09-2006 14:26:22 |
Mostrar las propiedades de un componente en runtime | Neftali [Germán.Estévez] | Trucos | 0 | 08-06-2006 12:52:10 |
Compilar un componente Active X cuando interese | akilar | Varios | 0 | 23-04-2006 17:33:38 |
|