FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Handle para query - Freeze de pantalla
Posts: 50
Joined: Tue Feb 02, 2021 10:21 PM
Handle para query - Freeze de pantalla
Posted: Sat Feb 20, 2021 01:09 AM

Buenas noches,

Utilizo Tdolphin para trabajar con MySQL.

Hay alguna manera de que muestre un reloj de trabajando y no se freeze la aplicaci贸n cuando una query tarda m谩s de 5 segundos en completarse? Porque lo que sucede es que, en clientes que deben generar un reporte, con una query muy complicada con muchos resultados, tarda aprox 10 segundos en ejecutarse (esta muy optimizada) y la pantalla a los segundos se friza, y si el usuario hace click, windows la considera como que no responde e intenta cerrarla.

A su vez, tengo queries de migracion de datos de un servidor a otro que toma unos minutos, y lo mismo. Reviso por mysql el processlist y me da como finalizada, pero no regresa a la aplicaci贸n para darle el mensaje de finalizado.

Existe alguna manera de solucionar esto?

Muchas gracias.

Nicol谩s
Posts: 231
Joined: Fri Jul 20, 2012 01:49 AM
Re: Handle para query - Freeze de pantalla
Posted: Sat Feb 20, 2021 01:18 AM
Tiene probado con MT?
Creo que utilizar MultiThreading se pode hacer en una segunda thread la query y no ira hacer freeze.

https://github.com/Petewg/harbour-core/ ... iThreading
Regards,

Lailton Fernando Mariano
Posts: 50
Joined: Tue Feb 02, 2021 10:21 PM
Re: Handle para query - Freeze de pantalla
Posted: Sat Feb 20, 2021 03:15 AM

Gracias por responder.

Si, con MT evito que se frize la app principal, pero si muestro el dialogo de proceso, (ej: Recibiendo informacion... Generando TXT de exportaci贸n) se friza ese dialogo.

A su vez, no retorna una vez finalizada una query que tarde unos 2 minutos y que efectivamente haya sido terminada en el mysql.

Nicol谩s
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Handle para query - Freeze de pantalla
Posted: Sat Feb 20, 2021 12:33 PM

Try with MsgRun for execute query

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Handle para query - Freeze de pantalla
Posted: Tue Sep 21, 2021 08:01 PM
he intentado poner un timer en msgrun, pero igual se freeza, el problema es que una vez se muestra el mensaje de espera, si por alguna razon la app pierde foco al retomarlo se freeza, igual pasa si el proceso toma tiempo, y se presiona cualquier tecla o se da click con el raton.

Mi idea era poner un sysrefresh con un timer adosado al dlg del msgrun pero no funciona, igual se congela

MSGRUN
Code (fw): Select all Collapse
...
聽 聽ACTIVATE DIALOG oDlg ON PAINT oDlg:SayText( oDlg:cMsg );
聽 聽 聽 聽 聽 聽 ON INIT ( oTmr := MsgRunBldTimer( oDlg ), oDlg:Center( oWndParent ) );
聽 聽 聽 聽 聽 聽 VALID MsgRunEndTimer( oTmr )

RETURN uReturn

//----------------------------------------------------------------------------//

STATIC FUNCTION MsgRunBldTimer( oDlg )
聽 聽LOCAL oTimer

聽 聽oTimer := TTimer():New( 400, {|| oTimer:Deactivate(), SysRefresh(), oTimer:Activate() }, oDlg )
聽 聽oTimer:Activate()

RETURN oTimer

//----------------------------------------------------------------------------//

STATIC FUNCTION MsgRunEndTimer( oTimer )

聽 聽oTimer:DeActivate()
聽 聽oTimer:End()

RETURN TRUE
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Handle para query - Freeze de pantalla
Posted: Tue Sep 21, 2021 08:34 PM
Estimado, alguien sabe para que sirve la funcion SetAsMsgBox() la cual aparece en MsgRun
Code (fw): Select all Collapse
聽 聽IF oWndParent == NIL .and. CenterMsgs( "?" )
聽 聽 聽 聽 lCenterMsg := TRUE
聽 聽 聽 聽 SetAsMsgBox()
聽 聽 聽ENDIF


Me parece que la variable oWndParent nunca es usada, aun si es usada cuando se llama en MsgRun.

siguiero, para empezar,
Code (fw): Select all Collapse
聽 聽IF oWndParent == NIL
聽 聽 聽 oWndParent := GetWndDefault()
聽 聽ENDIF


y luego un OF oWndParent en la definicion de los dialogos...
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Handle para query - Freeze de pantalla
Posted: Wed Sep 22, 2021 11:07 AM
If
Code (fw): Select all Collapse
CenterMsgs( .t. )

is set, all windows MsgBox messages like MsgInfo,MsgAlert,MsgYesNo, etc are all centered in the active window/dialog and without this setting they are all centered in the desktop window.

MsgRun() also behaves the same way.
If CenterMsgs() is set and oWndParent is not specified, then MsgRun() is centered in the active window/dialog.

This is accomplished by this code:
Code (fw): Select all Collapse
IF oWndParent == NIL .and. CenterMsgs( "?" )
   lCenterMsg := TRUE
   SetAsMsgBox()
ENDIF


In the above code, SetAsMsgBox() sets this dialog to behave like the standard windows msgboxes.

If oWndParent is specified, then the dialog is centered in the specified oWndParent, irrespective of the setting of CenterMsgs()

Otherwise the MsgRun dialog is centered in the desktop window.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Handle para query - Freeze de pantalla
Posted: Wed Sep 22, 2021 03:56 PM

Ok. Rao, thank you!

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Handle para query - Freeze de pantalla
Posted: Mon Sep 27, 2021 04:46 PM
Carlos,

I am not sure if this will help, but here is an example of a displayed timer while a routine is running.

This was originally posted by Enrico.

Code (fw): Select all Collapse
9/27/2006 8:27 AM

#include "Fivewin.ch" 


FUNCTION MAIN() 

聽 聽 LOCAL oDlg, oTmr 

聽 聽 DEFINE DIALOG oDlg 

聽 聽 DEFINE TIMER oTmr OF oDlg; 
聽 聽 聽 聽 聽 聽INTERVAL 1000; 
聽 聽 聽 聽 聽 聽ACTION TONE( 440, 1 ) 

聽 聽 ACTIVATE DIALOG oDlg; 
聽 聽 聽 聽 聽 聽 聽ON INIT ( oTmr:hWndOwner := oDlg:hWnd,; 
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽oTmr:Activate() ); 
聽 聽 聽 聽 聽 聽 聽CENTER 

聽 聽 RELEASE TIMER oTmr 

聽 聽 RETURN NIL

// EMG
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion