Página 1 de 1

Problema mensaje al salir

Publicado: 23 Jun 2015 20:12
por cris690
Resulta que tengo este codigo
if Dialog.Message("Confirmar salida", "Estás Seguro(a) que deseas salir?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON2) == 6 then
Application.Exit();
end
lo utilizo en on close y lo que pasa que al darle no igualmente se cierra la pagina ha hi alguna mansera de que no cierre la aplicaccion

Re: Problema mensaje al salir

Publicado: 23 Jun 2015 21:21
por Agotaras123
Lo que podes hacer es esto te dejo un script que utilizo yo

Global Functions

function SaliEx()

resultado = Dialog.Message("NOMBRE DE TU SISTEMA", "¿Estas seguro que deseas salir de la aplicación?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

if resultado == 7 then
---La Acción que quieres que haga al cancelar
else
Application.Exit(9);
end

end

Esta función la llamas donde la ocupes por lógica seria el el botón cerrar lo que tendrías que colocar en dicho botón seria lo siguiente:
 SaliEx()


Re: Problema mensaje al salir

Publicado: 23 Jun 2015 21:32
por cris690
Eso en realidad haria lo mismo lo que pasa es que lo llamas cun una funcion xd

Re: Problema mensaje al salir

Publicado: 25 Jun 2015 15:04
por Dow Sher
Bien cris te explico, lo que pasa es lo siguiente, como tu dices ese código lo pones en OnClose del proyecto, es decir, cuando se cierra el proyecto se ejecuta ese código, desafortunadamente no te va a funcionar así porque el proyecto ya ha sido cerrado. Lo que debes de hacer es poner ese código en un boton de salir como te dice Agotaras.

Re: Problema mensaje al salir

Publicado: 25 Jun 2015 23:18
por patch
QueryAllowProjectClose ( );

In them help file
QueryAllowProjectClose ( )
Called whenever the project is 'told' to close. Using this function, you can control how the user can close the application, such as confirming with the user that they intended to close the application.

Returns:
True if the application should close, false if it should not close.

Example:
function QueryAllowProjectClose()
    result= Dialog.Message("Application Exit", "Are you sure that you want to quit?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    --if they choose yes 
    if result == IDYES then
        --allow the app to close
        return true;
    else
        --cancel close
        return false;
    end
end
You just place that on the global that is it, no need to add it to your close button

:nyancat: :nyancat: :nyancat: :nyancat: :nyancat: :nyancat: :nyancat:

Re: Problema mensaje al salir

Publicado: 26 Jun 2015 00:16
por cris690
a ok entonces no se puede hacer nada

Re: Problema mensaje al salir

Publicado: 27 Jun 2015 03:45
por Dow Sher
YA TE DIJE!!! Usa un botón para salir!!! En configuraciones del proyecto usa el "estilo Flat" y coloca botones de minimizar y cerrar. En de cerrar pon la funcion que te dio Anchobeta

Re: Problema mensaje al salir

Publicado: 27 Jun 2015 14:44
por Luma
Crea botones para minimizar y salir...para ello debes poner tu proyecto an modalidad flat...de lo contrario te aparecerán los botones de cierre y minimizar que trae por defecto AMS.....cuando ya tengas tu proyecto en formato flat a los botones agregados de minimizar y cerrar ingresa la función que dice Míster Anchoveta........

Re: Problema mensaje al salir

Publicado: 27 Jun 2015 23:55
por NicolasG
patch escribió:QueryAllowProjectClose ( );

In them help file
QueryAllowProjectClose ( )
Called whenever the project is 'told' to close. Using this function, you can control how the user can close the application, such as confirming with the user that they intended to close the application.

Returns:
True if the application should close, false if it should not close.

Example:
function QueryAllowProjectClose()
    result= Dialog.Message("Application Exit", "Are you sure that you want to quit?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    --if they choose yes 
    if result == IDYES then
        --allow the app to close
        return true;
    else
        --cancel close
        return false;
    end
end
You just place that on the global that is it, no need to add it to your close button

:nyancat: :nyancat: :nyancat: :nyancat: :nyancat: :nyancat: :nyancat:

Re: Problema mensaje al salir

Publicado: 07 Ago 2019 02:57
por r34k
Hola;

@cris690 solo usa el código de @patch en Global Functions como lo dijo en primer lugar @Agotaras123, no se como no te pudo quedar claro :cerealspit-1414026180:

PD: Gracias a todos :mindblown-1414029295: