About RELEASE on a form

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

About RELEASE on a form

Post by jparada »

Translated by Google,

I have something typical, one form, the definition MAIN, it calls to other prg's, in another prg, I have something like this:

// In this way, mark the error: btnCancelar Of frmClientes No defined,
IF PCOUNT( ) # 0
* IF MsgYesNo('Desea Salir?','Mensaje')
frmClientes.RELEASE
* ENDIF
ENDIF
IF frmClientes.BtnCancelar . . .
.
.
ENDIF
// In this way made no mistake and mark the expected behavior, I go back to main menu,
IF PCOUNT( ) # 0
* IF MsgYesNo('Desea Salir?','Mensaje')
@500, 50 BUTTON btnCancelar OF frmClientes CAPTION 'Salir' ACTION frmClientes.RELEASE
* ENDIF
ENDIF
IF frmClientes.BtnCancelar . . .
.
.
ENDIF

I may be doing wrong or why is this behavior, even in the form MODAL (where error mark), I can close the form without any problem with ALT + F4.

Any idea what might be happening and how to fix it?.

Thanks

Greetings
Javier

Spanish,
Tengo algo típico, un form, con la definición MAIN, este llama a otros prg's, en algún otro prg, tengo algo como esto:
// De esta manera marca el error: btnCancelar Of frmClientes No defined,
IF PCOUNT( ) # 0
* IF MsgYesNo('Desea Salir?','Mensaje')
frmClientes.RELEASE
* ENDIF
ENDIF
IF frmClientes.BtnCancelar . . .
.
.
ENDIF
// De esta manera no marca error y realiza el comportamiento esperado, me regresa al menú principal,
IF PCOUNT( ) # 0
* IF MsgYesNo('Desea Salir?','Mensaje')
@500, 50 BUTTON btnCancelar OF frmClientes CAPTION 'Salir' ACTION frmClientes.RELEASE
* ENDIF
ENDIF
IF frmClientes.BtnCancelar . . .
.
.
ENDIF

Qué puedo estar haciendo mal, o porqué es este comportamiento, incluso en el form MODAL, (donde marca error), puedo cerrar el form sin ningún problema con ALT+F4.
Alguna idea de lo que pudiera estar pasando y como solucionarlo?.

Gracias

Saludos
Javier

User avatar
esgici
Posts: 4538
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

Hi Javier

HMG Help says :
DECLARE WINDOW <WindowName>

A window must be declared using this command, if you need to refer to it prior
its definition in code, or when you refer to it in a different .prg file from
the one it was defined using semi-oop syntax.
Does your problem may be related with this ?

Regards

--

Esgici
Viva INTERNATIONAL HMG :D

jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

Post by jparada »

Translated by Google,
Hi Esgici, Thanks for reply.

Apparently is not related to the issue of DECLARE WINDOW, since I am not referring to another window than the current one, my current window is called frmClientes defined as follows: DEFINE WINDOW frmClientes in the same Prg showing the problem with the code shown above.

Another thing I want to say is that frmClientes.RELEASE to completely abandon the program and generates ErrorLog.Htm, which shows that the error is pointed out that: Not defined btnCancel Of frmClientes which is part of the code continues.

I have also tried RELEASE WINDOW frmClientes result is the same error.

Thanks

Greetings
Javier

User avatar
esgici
Posts: 4538
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 410 times
Been thanked: 118 times
Contact:

Post by esgici »

Hola Javier

I can't understand the problem by this very few lines.

Could you post your program after "concentrated to error", that is extracting all lines not related with error ?

May be more convenient if you attach it in compressed form.

Saludos

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
luisvasquezcl
Posts: 1184
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Has thanked: 16 times
Been thanked: 18 times
Contact:

Post by luisvasquezcl »

Hola Javier
el problema es que la funcion que libera la ventana no la ve. Para solucionar este problema puedes hacer lo siguiente

PROCEDURE Salir
DECLARE WINDOW miventana
IF PCOUNT() # 0
IF MSGYESNO( ...... )
miventana.RELEASE
ENDIF
ENDIF
RETURN

creo que esto deberia solucionar tu problema

jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

Post by jparada »

Translated by Google,

Thanks for answering Esgici and Luis, for the moment I've solved by reversing the order of conditions, as follows:

IF frmClientes.BtnCancelar . . .
.
.
ENDIF

IF PCOUNT( ) # 0
IF MsgYesNo('Desea Salir?','Mensaje')
frmClientes.RELEASE
ENDIF
ENDIF

Currently is working as expected, so I do not understand is that the error is if I invested, I understand that erases the memory frmClientes form, and so if the flow of the program referred to as frmClientes and no mark error there, but I thought that by placing the release had to leave immediately and do not follow the program flow in this case the IF, or I'm wrong.

Thanks

Greetings
Javier

Spanish,

Gracias por contestar Esgici y Luis, de momento lo he resuelto invirtiendo el orden de las condiciones, así:

IF frmClientes.BtnCancelar . . .
.
.
ENDIF

IF PCOUNT( ) # 0
IF MsgYesNo('Desea Salir?','Mensaje')
frmClientes.RELEASE
ENDIF
ENDIF

De momento éstá funcionando como se espera, lo que no entiendo es porque el error se presenta si lo pongo invertido, entiendo que borra de memoria el form frmClientes, y por eso si continúa el flujo del programa como se hace referencia a frmClientes y ya no existe marca error, ahora bien yo pense que al poner el RELEASE debia salir inmediatamente y no seguir el flujo de programa en este caso del IF, o estoy equivocado.

Gracias

Saludos
Javier

User avatar
luisvasquezcl
Posts: 1184
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Has thanked: 16 times
Been thanked: 18 times
Contact:

Post by luisvasquezcl »

Hola Javier,
El flujo del programa continúa.
Tienes que separar lo que corresponde al manejo de ventanas y el flujo del programa; al poner release eliminas la ventana de la memoria pero el flujo continúa su proceso hasta el return.
Saludos
Luis Vasquez

jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

Post by jparada »

Translated by Google,

Hi Luis, Thanks for the clarification.

Greetings
Javier

Spanish,

Hola Luis, Gracias por la aclaración.

Saludos
Javier

Post Reply