Page 1 of 1

Handle para query - Freeze de pantalla

PostPosted: Sat Feb 20, 2021 1:09 am
by nlerdafehn
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.

Re: Handle para query - Freeze de pantalla

PostPosted: Sat Feb 20, 2021 1:18 am
by Lailton
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

Re: Handle para query - Freeze de pantalla

PostPosted: Sat Feb 20, 2021 3:15 am
by nlerdafehn
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.

Re: Handle para query - Freeze de pantalla

PostPosted: Sat Feb 20, 2021 12:33 pm
by cnavarro
Try with MsgRun for execute query

Re: Handle para query - Freeze de pantalla

PostPosted: Tue Sep 21, 2021 8:01 pm
by carlos vargas
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: Select all  Expand view

...
   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

 

Re: Handle para query - Freeze de pantalla

PostPosted: Tue Sep 21, 2021 8:34 pm
by carlos vargas
Estimado, alguien sabe para que sirve la funcion SetAsMsgBox() la cual aparece en MsgRun
Code: Select all  Expand view

   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: Select all  Expand view

   IF oWndParent == NIL
      oWndParent := GetWndDefault()
   ENDIF
 


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

Re: Handle para query - Freeze de pantalla

PostPosted: Wed Sep 22, 2021 11:07 am
by nageswaragunupudi
If
Code: Select all  Expand view

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: Select all  Expand view

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.

Re: Handle para query - Freeze de pantalla

PostPosted: Wed Sep 22, 2021 3:56 pm
by carlos vargas
Ok. Rao, thank you!

Re: Handle para query - Freeze de pantalla

PostPosted: Mon Sep 27, 2021 4:46 pm
by James Bott
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: Select all  Expand view
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