FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ¿cambiar fuente en msgRun ?
Posts: 851
Joined: Sun Nov 09, 2014 05:01 PM
¿cambiar fuente en msgRun ?
Posted: Fri Feb 16, 2024 12:03 PM
Estimados amigos, un saludo a todos

¿ Es posible cambiar el tipo de fuente y color a un dialogo rápido de tipo msgRun() ?
Code (fw): Select all Collapse
msgRun("Espere Mientras se Crea el Catálogo...",NIL, {|| :PrepareReport() })
con la letra por defecto se ve mal, por lo menos en este caso,

"Los errores en programación, siempre están entre la silla y el teclado..."



Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin



Carora, Estado Lara, Venezuela.
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: ¿cambiar fuente en msgRun ?
Posted: Fri Feb 16, 2024 12:44 PM
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=34020

MsgRun.prg
Code (fw): Select all Collapse
/*
    MsgWait y MsgRun no se muestran correctamente bajo 32 bits, el
    cálculo de coordenadas no es correcto pues el texto de cuerpo
    se recorta:

    Moises,

    En source\function\msgrun.prg hay que modificar estas líneas asi:

    Código:

    ACTIVATE DIALOG oDlg CENTER ;
             ON PAINT oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T. )

    Antonio Linares
    www.fivetechsoft.com
*/

#include "FiveWin.Ch"

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

FUNCTION MsgRun( cCaption, cTitle, bAction, oWndParent )  // MUDEI: 24/07/2017 - Joao

   LOCAL oDlg, nWidth, uReturn, aGrad

   /*
   DEFAULT cCaption := "Please, wait...",;
           bAction  := { || WaitSeconds( 1 ) }
   */

   DEFAULT cCaption := "Por Favor, Espere...", ;
      bAction  := {|| WaitSeconds( 1 ) }

   // Modelos de gradient
   // aGrad := { { 0.5, CLR_HRED,CLR_WHITE},{ 0.5,CLR_WHITE,CLR_HRED } }

   // aGrad := { { 0.30, CLR_HRED, CLR_WHITE},{ 0.70, CLR_WHITE, CLR_HRED } }

   aGrad := { { 0.30, CLR_BLACK, CLR_YELLOW }, { 0.70, CLR_YELLOW, CLR_BLACK } }

   /*
   SetDlgGradient( { {0.30,CLR_HRED,CLR_WHITE}, {0.70,CLR_WHITE,CLR_HRED} } )
   */

   DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 0, - 12 BOLD
   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 0, - 14 BOLD

   IF cTitle == NIL

      DEFINE DIALOG oDlg GRADIENT aGrad           ; // usando gradient
         FROM 0, 0 TO 3, Len( cCaption ) + 4   ;
         STYLE nOr( DS_MODALFRAME, WS_POPUP )

   ELSE

      DEFINE DIALOG oDlg GRADIENT aGrad           ; // usando gradient
         FROM 0, 0 TO 4, Max( Len( cCaption ), Len( cTitle ) ) + 4 ;
         TITLE cTitle ;
         STYLE DS_MODALFRAME

   ENDIF

   oDlg:bStart := {|| uReturn := Eval( bAction, oDlg ), oDlg:End(), SysRefresh() }
   oDlg:cMsg   := cCaption

   nWidth := oDlg:nRight - oDlg:nLeft

   SET FONT OF oDlg TO oFnt

   ACTIVATE DIALOG oDlg ON PAINT oDlg:SayText( oDlg:cMsg ) ;
      ON INIT oDlg:Center( oWndParent )

   oFnt:End()
   oFont:End()

RETURN uReturn

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

FUNCTION WaitSeconds( nSecs )

   LOCAL nStart := GetTickCount()

   DEFAULT nSecs := 1

   WHILE GetTickCount() - nStart < ( 1000 * nSecs )
   ENDDO

RETURN NIL

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

FUNCTION MsgWait( cCaption, cTitle, nSeconds )

   DEFAULT nSeconds := 4

RETURN MsgRun( cCaption, cTitle, {|| WaitSeconds( nSeconds ) } )

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

FUNCTION StopUntil( bBlock )

   DO WHILE !Eval( bBlock )
      WaitMessage()
      SysRefresh()
   ENDDO

RETURN NIL

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

// FIN / END
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 851
Joined: Sun Nov 09, 2014 05:01 PM
Re: ¿cambiar fuente en msgRun ?
Posted: Fri Feb 16, 2024 04:18 PM

Gracias joao,

No me funcionó, pero me diste la idea para resolver.

Saludos amigo!

"Los errores en programación, siempre están entre la silla y el teclado..."



Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin



Carora, Estado Lara, Venezuela.

Continue the discussion