Compartir a través de


Closable (Propiedad)

Especifica si puede cerrarse el formulario al hacer doble clic en el icono del menú desplegable de la ventana, al elegir Cerrar en el menú desplegable de la ventana o al hacer clic el botón Cerrar. Está disponible en tiempo de diseño y en tiempo de ejecución.

Object.Closable[ = lExpr]

Valores de la propiedad

  • lExpr
    Las configuraciones posibles de la propiedad Closable son:
    Valor Descripción
    Verdadero (.T.) (Valor predeterminado) Se agrega el elemento Cerrar al menú desplegable de la ventana.
    Falso (.F.) No se puede cerrar el formulario mediante doble clic en el icono del menú desplegable de la ventana y se quita el elemento Cerrar del menú desplegable de la ventana.

Ejemplo

El ejemplo siguiente demuestra cómo se establece la propiedad Closable para impedir que se cierre un formulario si utiliza el menú desplegable de la ventana o el botón Cerrar. La propiedad Closable del formulario se establece en el valor falso (.F.), lo que impide que se cierre el formulario mediante el menú Control. Si la propiedad Closable del formulario se establece en el valor verdadero (.T.) y el formulario se cierra al usar el menú desplegable de la ventana, deberá ejecutar CLEAR EVENTS para detener el procesamiento de eventos y salir del programa.

frmMyForm = CREATEOBJECT('Form')  && Create a Form
frmMyForm.Closable = .F.  && Disable the window pop-up menu
                          && and Close button

frmMyForm.AddObject('shpLine','Line')  && Add a Line control to the form
frmMyForm.AddObject('cmdCmndBtn1','cmdMyCmndBtn1')  && Up Cmnd button
frmMyForm.AddObject('cmdCmndBtn2','cmdMyCmndBtn2')  && Down Cmnd button
frmMyForm.AddObject('cmdCmndBtn3','cmdMyCmndBtn3')  && Quit Cmnd button

frmMyForm.shpLine.Visible = .T.  && Make Line control visible
frmMyForm.shpLine.Top = 20  && Specify Line control row
frmMyForm.shpLine.Left = 125  && Specify Line control column

frmMyForm.cmdCmndBtn1.Visible =.T.  && Up Command button visible
frmMyForm.cmdCmndBtn2.Visible =.T.  && Down" Command button visible
frmMyForm.cmdCmndBtn3.Visible =.T.  && Quit Command button visible

frmMyForm.SHOW  && Display the form
READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmndBtn1 AS COMMANDBUTTON  && Create Command button
   Caption = 'Slant \<Up'  && Caption on the Command button
   Left = 50  && Command button column
   Top = 100  && Command button row
   Height = 25  && Command button height
   
   PROCEDURE Click
      ThisForm.shpLine.Visible = .F.  && Hide the Line control
      ThisForm.shpLine.LineSlant ='/'  && Slant up
      ThisForm.shpLine.Visible = .T.  && Show the Line control
ENDDEFINE

DEFINE CLASS cmdMyCmndBtn2 AS CommandButton  && Create Command button
   Caption = 'Slant \<Down'  && Caption on the Command button
   Left = 200  && Command button column
   Top = 100  && Command button row
   Height = 25  && Command button height

   PROCEDURE Click
      ThisForm.shpLine.Visible = .F.  && Hide the Line control
      ThisForm.shpLine.LineSlant ='\'  && Slant down
      ThisForm.shpLine.Visible = .T.  && Show the Line control
ENDDEFINE

DEFINE CLASS cmdMyCmndBtn3 AS CommandButton  && Create Command button
   Caption = '\<Quit'  && Caption on the Command button
   Cancel = .T.  && Default Cancel Command button (Esc)
   Left = 125  && Command button column
   Top = 150  && Command button row
   Height = 25  && Command button height

   PROCEDURE Click
      CLEAR EVENTS  && Stop event processing, close Form
ENDDEFINE

Vea también

ControlBox (Propiedad) | TitleBar (Propiedad) | DEFINE CLASS | QueryUnload (Evento) | Unload (Evento) | Release (Método) | Destroy (Evento)

Se aplica a: Form (Objeto) | _SCREEN