FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
Cerrar Pantallas hijas en delphi 7.0
hola para todos los que me puedan ayudar tengo un programa que esta restringuido con acceso a él, le explico el problema un pequeño programa que necesita un login y una clave de acceso para entrar, pero no es el caso la cuestion es cuando un usuario desea cerra la sesión y el no ha cerrado todas las pantallas entonces cuando venga el nuevo usuario del sistema que accesa a él encontrará todas esas pàntallas abierta entonces yo quiciera saber como detectar cuales pantallas estan abierta para cerrarla así evitar que el nuevo usuario las encuentre abierta
|
#2
|
|||
|
|||
Cerrar ventanas hijas
Código:
procedure TFrmMain.ActCloseAllExecute(Sender: TObject); var I: Integer; begin for I := 0 to MDIChildCount - 1 do MDIChildren [i].Close; end; |
#3
|
||||
|
||||
La propuesta de Sudamericano es válida en caso que tuvieras una aplicación MDI, cosa que no se ha aclarado.
Una solución mas genérica es basarse en el objeto global Screen, que guarda una lista a todas las formas creadas en su propiedad Forms:
Hasta luego.
__________________
Juan Antonio Castillo Hernández (jachguate) Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate |
#4
|
|||
|
|||
Gracias por la ayuda
hola jachguate, utilize tu codigo por que tambien tengo tfrm en estilo normal y abierta con shomodal y necesitab algo general y funciona bien gracias....
otra cosa igualmente servirá este codigo para detectar las que estan abierta y reabrirla; (es decir si alguna tiene en sus campos edit,datos cuando valla abrirla no pierda la información)verda o hay algo mejor.Que me sirva |
#5
|
||||
|
||||
Cita:
Saludos.
__________________
Juan Antonio Castillo Hernández (jachguate) Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate |
#6
|
|||
|
|||
Mira que facil
En la forma principal, recuerda que hablamno de MDI padre puedes ponerte un boton generar que sirva para cerrar todos
y este código lo pones en el if frmprincipal.MDIChildCount>=1 then ActiveMDIChild.Close else Close; end; eso implica que si hay algun MDIChild activo lo cierra pero si es el formulario principal el activo entonces sales del sistema. Puedes ponerlo o arregarlo a tu gusto. |
#7
|
|||
|
|||
Como Cerrar Una Ventana Hija
Hola a todos es mi primera vez aqui en el foro y me gustaria saber como cerrar una ventana hija.
esta la creo con este codigo Vventa := TVenta.Create(self); Vventa.FormStyle := fsMDIChild; Vventa.Left :=0; Vventa.Top :=0; Vventa.Width:=Screen.Width-15; Vventa.Height:= Screen.Height-50; Vventa.Parent := self; Vventa.Name := 'Ventas'; Vventa.Show; pero al ponerle que la cierra no se cierra no hace nada, ya e tratado con mdicount, screenform y cosas asi pero todas me marcan error de memoria, tambien e tratado con destroy, close, free y pues nada, espero ustedes me ayuden. ya que tengo el form principal y de ahi abro la pantalla de ventas y quiero que se pueda cerrar y volver a abrir luego, ya que realize un menu con un panel e imagenes, y si no creo el child seponen arriva del menu y si creo las childs no se suben arriva del menu, el unico problema que no puedo cerrarlas. espero pronta respuesta gracias. |
#8
|
||||
|
||||
Cuando quieras cerrar la ventana hijas usas lo siguiente:
y en el evento OnFormClose de la ventana hija colocas
Saludos. |
#9
|
||||
|
||||
__________________
|
#10
|
|||
|
|||
No Puedo Cerrar Ventanas
ya he tratado de cerrarla de esta manera
procedure TfrmVentanaHija.FormClose(Sender: TObject; var Action: TCloseAction); begin frmVentanaHija:=nil; Action := caFree; end; me marca el sig error, project QSoft.exe raised exception class EAccessViolation with message 'Access violation at address 000000000. Read of adress 000000000'. Process stopped. use step or run to continue. si lo cierra, pero al intentarla abrir de nuevo me marca error que ya existe, pero si la abre, no se si esto es normal o deba hacer algo mas. gracias |
#11
|
||||
|
||||
Proba hacerlo de la siguiente forma
pero tambien dependera de como crees la ventana si estas haciendo algo asi:
te marcara error de Access violation en el FormClose, debido a que el objeto frmVentanaHija no ha sido creado. Normalmente yo creo y llamo a las formas hijas de la siguiente manera:
En este caso, si la ventana hija ya ha sido creada, solamente la muestra. Saludos. |
#12
|
|||
|
|||
Aun marca error de memoria
aun me marca el mismo error, aqui esta el codigo que utilizo en las formas
aun asi no funciona cambiando el action a la parte de abajo. espero que me puedan ayudar. Última edición por roman fecha: 02-05-2008 a las 03:36:53. Razón: Añadir etiqueta [delphi] |
#13
|
||||
|
||||
petitrad: Por favor utiliza la etiqueta [delphi] para publicar código. Por esta vez te la he puesto yo para que veas la diferencia. Entra a editar tu mensaje para que veas cómo se usa.
// Saludos |
#14
|
||||
|
||||
Podrias colocar los mensajes exactos que te marca?
El mensaje de Access violation en que momento ocurre? Eso servira para identificar mejor tu problema. |
#15
|
|||
|
|||
Errores
Ok, gracias moderador.
Los errores son los siguientes project QSoft.exe raised exception class EAccessViolation with message 'Access violation at address 000000000. Read of adress 000000000'. Process stopped. use step or run to continue. este error me marca al intentar reabrir la ventana y en onclose del form hija donde pongo el action := cafree y el ventana := nil, pero me marca otro erro al salir del programa que es: Exception EAccessViolation in module vcl60.bpl at 0003fd57 Access violation at adress 005dfd57 in module 'vcl60.bpl'. read of adress 00000254. espero que me puedan ayudar. |
#16
|
|||
|
|||
Cerrar pantallas hijas
ya encontre el error, el detalle esta aqui, que si le pongo:
Ventana.parent := self, lo hace como yo quiero pero me marca error al cerrarla, si no le pongo eso si lo hace y se cierra y se puede abrir de nuevo, pero como podria utilizar esta propiedad y cuando lo cierre quitarsela, intente ponerle en nil pero al parecer me manda a nil el principal tambien bueno espero me puedan ayudar ya que es un proyecto importante para la escuela. hasta pronto. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Busco un consejo (muchas ventanas hijas y muchos menús) | ixMike | Varios | 9 | 14-09-2006 11:23:34 |
Recorrido de ventanas hijas | sur-se | OOP | 3 | 23-08-2004 11:43:10 |
La señora y sus hijas | roman | Humor | 24 | 28-05-2004 19:46:20 |
Ventanas MDI Hijas | LucianoRey | OOP | 4 | 25-02-2004 01:28:32 |
Problemas con formas Hijas (MDI Child) | D.M | Varios | 1 | 10-09-2003 22:56:30 |
|