Question about Message-functions

Question about Message-functions

Postby driessen » Wed Jan 03, 2024 11:16 am

Hello,

I wonder if it is possible to use bold or italic characters in a Msg-function.

Code: Select all  Expand view
MsgAlert("Aaaa bbbb CCCC dddd eeee!","Take care")

Is it possible to put "CCCC" into bold or italic?

Thank you.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about Message-functions

Postby Antonio Linares » Wed Jan 03, 2024 2:40 pm

Dear Michel,

It is not possible using standard FWH Msg...() functions as they use Windows API MessageBox() which does not allows it.

So you have to create your own Msg...() function and here you have a great example from Mr. Rao:
viewtopic.php?p=260949&sid=d5c0b1968116267f40a085ad400602be#p260949
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Question about Message-functions

Postby driessen » Wed Jan 03, 2024 3:04 pm

Tuanks, Antonio.

I'll try that.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about Message-functions

Postby Otto » Wed Jan 03, 2024 7:06 pm

Hello Michel,

I use a dialog in Metro-style.
Image

Best regards,
Otto

Code: Select all  Expand view

#include "fivewin.ch"




#define CLR_VIOLET          RGB( 170,   0, 255 )
#define CLR_PINK            RGB( 244, 114, 208 )
#define CLR_CRIMSON         RGB( 162,   0,  37 )
#define CLR_AMBER           RGB( 240, 163,  10 )
#define CLR_OLIVE           RGB( 109, 135, 100 )
#define CLR_STEEL           RGB( 100, 118, 135 )
#define CLR_MAUVE           RGB( 118,  96, 138 )
#define CLR_TAUPE           RGB( 135, 121,  78 )
#define CLR_BLAUMETRO       RGB(   0, 174, 219 )
#define CLR_ROTMETRO        RGB( 191,  30,  75 )
#define CLR_PURPLE          RGB( 111,  66, 193 )

REQUEST DBFCDX
REQUEST DBFFPT

function main
 
  MetroMsgInfo( "Programmabbruch", "WINDOWS: There is no default printer currently selected" + CRLF +;
        "Go into your Windows Control Panel and choose the Printer settings." + CRLF + CRLF +;
        "Right-click the printer that you want to use, and then click Set as Default Printer."+ CRLF+;
        "A check mark on the printer icon indicates that the printer is now the default printer." + CRLF + CRLF +;
        "If the customer requires help with this they should refer to their IT administrator." )

return

INIT PROCEDURE PrgInit
   
    SET CENTURY ON
    SET EPOCH TO YEAR(DATE())-98
   
    SET DELETED ON
    SET EXCLUSIVE OFF
   
    REQUEST HB_Lang_DE
   
    HB_LangSelect("DE")
   
    SET DATE TO GERMAN
   
    rddsetdefault( "DBFCDX" )
   
    EXTERN DESCEND
   
RETURN

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

FUNCTION MetroMsgInfo( cTitel, cAnzeige1 )
    local lVar        := .f.
    local oDlg, oGet, oBTNNaviWeiter, oBTNNaviInfo, obtnAbbruch, oCbx
    local cPassword   := Space( 10 )
    local nWidth      := GetSysMetrics( 0 )
    local nHeight     := GetSysMetrics( 1 )
    local nLine       := 0
    local nRowSpace   := 20
    local nRowOffset  := 20
    local cInfo       := ( procname(1) + "   " + str( procline(1) ) )
    local oFntMetroNormal2, oFntMetroMedium2,oFntMetroFLATBTN
    local nRibbonTopClr :=   rgb(227, 162, 26)
    *----------------------------------------------------------
    DEFAULT cTitel := "Infobox"
    *----------------------------------------------------------
    DEFINE FONT oFntMetroNormal2      NAME "TAHOMA" SIZE 0,-22
    DEFINE FONT oFntMetroMedium2      NAME "TAHOMA" SIZE 0,-32
    DEFINE FONT oFntMetroFLATBTN      NAME "TAHOMA" SIZE 0,-18
 
    oFntMetroSay := TFont():New( "Calibri", 0, -13, .F.,.F.,0,0,,.F.,.F.,.F.,0,3,2,1,,34 )
 
    //cAnzeige1 := ansiToOem(cAnzeige1)
    nLine := 16
    DEFINE DIALOG oDlg ;
       TITLE "Auswahl" ;
       FROM 0, 5 ;
       TO nHeight*1/2, nWidth + 6 ;
       PIXEL ;
       STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
       COLOR CLR_WHITE, nRibbonTopClr ;
       FONT oFntMetroFLATBTN
 
    oDlg:SetFont( oFntMetroNormal2 )
 
    nLine := 0.5
    @ nRowOffset * nLine , nWidth/5/2.05 ;
       SAY cTitel ;
       OF oDlg ;
       PIXEL ;
       FONT oFntMetroMedium2 ;
       COLOR CLR_WHITE, nRibbonTopClr
 
    nLine := 2
    @ nRowOffset + nRowSpace * nLine,nWidth/5/2.05 ;
       SAY cAnzeige1 ;
       OF oDlg ;
       PIXEL ;
       FONT oFntMetroMedium2 ;
       COLOR CLR_WHITE, nRibbonTopClr ;
       SIZE 600, 600
 
    *----------------------------------------------------------
 
   @ ( nHeight*1/2 - 65 ) / 2.05,nWidth/5/2.05 ;
        BTNBMP oBTNNaviWeiter PROMPT "OK";
      SIZE ( 128 ) /2.05, ( 64 ) /2.05 ;
       PIXEL OF oDlg FLAT COLOR  CLR_WHITE, CLR_ROTMETRO ;
      ACTION ( lVar := .T., oDlg:End() ) ;
      DEFAULT
    
 
    @ 0,0 ;
       FLATBTN oBTNNaviInfo ;
       PROMPT "+" ;
       FONT oFntMetroSay ;
       SIZE ( 32) /2.05 , ( 32) /2.05 ;
       OF oDlg ;
       ACTION ( msginfo( cInfo ) ) ;
       COLOR nRibbonTopClr, RGB( 210, 210, 210 )
 
    oBTNNaviInfo:cTooltip := {"Info"}
 
    ACTIVATE DIALOG oDlg CENTERED
 
 RETURN NIL
 //----------------------------------------------------------------------------//
 
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: Question about Message-functions

Postby karinha » Thu Jan 04, 2024 1:03 pm

Very good mister Otto.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Question about Message-functions

Postby Otto » Thu Jan 04, 2024 1:32 pm

Hello Joao,
Ever since I test before every print and show this large msginfo, we've had far fewer inquiries in support.
If the default printer is missing, there often are unforeseen errors in Fivewin.

Best regards,
Otto



Code: Select all  Expand view

    If GetPrintDefault() = 0
        //? "no default printer"
        MetroMsgInfo( "Programmabbruch", "WINDOWS: There is no default printer currently selected" + CRLF +;
        "Go into your Windows Control Panel and choose the Printer settings." + CRLF + CRLF +;
        "Right-click the printer that you want to use, and then click Set as Default Printer."+ CRLF+;
        "A check mark on the printer icon indicates that the printer is now the default printer." + CRLF + CRLF +;
        "If the customer requires help with this they should refer to their IT administrator." )
    else
        //
        ? "Default printer " + ud_prngetname()

    endif
 
//----------------------------------------------------------------------------//


function ud_PrnGetName()
    local cret, oprn
    PRINTER oPrn
    cRet := oPrn:getmodel()
     endprint
 return cret
 //----------------------------------------------------------------------------//




 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: Question about Message-functions

Postby karinha » Thu Jan 04, 2024 2:08 pm

Very good mister Otto. Thank you.

Code: Select all  Expand view

// FWH\SAMPLES\OTTOMSG2.PRG

#Include "Fivewin.ch"

#define CLR_ROTMETRO        RGB( 191,  30,  75 )

FUNCTION Main()

   DefaultPrinter()

RETURN NIL

FUNCTION DefaultPrinter() // MODIFIQUEI A PRINTER.PRG E FUNCIONA...

   LOCAL SGETDEFAULTPRINTER
   LOCAL nPrn, nRet

   /*
   GetPrintDC( GetActiveWindow() )

   // Coloca a impressora selecionada como Default do Windows
   SetDefaultPrinter( PRNGETNAME() )
   */


   nRet := PrinterSetUp()

   nPrn := PrnGetName()

   IF( nRet # 0 )

      SetDefaultPrinter( PRNGETNAME() )

      MetroMsgInfo( "Programmabbruch", "WINDOWS: There is no default printer currently selected" + CRLF +;
         "Go into your Windows Control Panel and choose the Printer settings." + CRLF + CRLF +;
         "Right-click the printer that you want to use, and then click Set as Default Printer."+ CRLF+;
         "A check mark on the printer icon indicates that the printer is now the default printer." + CRLF + CRLF +;
         "If the customer requires help with this they should refer to their IT administrator." )

      sGetDefaultPrinter := GetDefaultPrinter()

      // ? PrnStatus( sGetDefaultPrinter )

      IF PrnStatus( sGetDefaultPrinter ) = 4096

         // Verifica se SPOOLER esta desligado e tenta liga-lo
         MsgRun( sGetDefaultPrinter +": "+isprint( GetDefaultPrinter() ) + ;
                         " ou Spooler Desligado.", "Status da Impressora", ;
                 {|| WinExec( "NET START SPOOLER", 7 ) } )

      ENDIF

      //? GetPrinter()

   ELSE

      ? "Default Printer Is: " + ud_prngetname()

      RETURN( .F. )

   ENDIF

RETURN NIL

FUNCTION ud_PrnGetName()

   LOCAL cRet, oPrn

   PRINTER oPrn

      cRet := oPrn:GetModel()

   ENDPRINT

RETURN( cret )

FUNCTION MetroMsgInfo( cTitel, cAnzeige1 )

   LOCAL oFntMetroSay
   LOCAL lVar        := .F.
   LOCAL oDlg, oGet, oBTNNaviWeiter, oBTNNaviInfo, obtnAbbruch, oCbx
   LOCAL cPassword   := Space( 10 )
   LOCAL nWidth      := GetSysMetrics( 0 )
   LOCAL nHeight     := GetSysMetrics( 1 )
   LOCAL nLine       := 0
   LOCAL nRowSpace   := 20
   LOCAL nRowOffset  := 20
   LOCAL cInfo       := ( ProcName( 1 ) + "   " + Str( ProcLine( 1 ) ) )
   LOCAL oFntMetroNormal2, oFntMetroMedium2, oFntMetroFLATBTN
   LOCAL nRibbonTopClr :=   rgb( 227, 162, 26 )

   DEFAULT cTitel := "Infobox"

   DEFINE FONT oFntMetroNormal2 NAME "TAHOMA" SIZE 0, - 22
   DEFINE FONT oFntMetroMedium2 NAME "TAHOMA" SIZE 0, - 32
   DEFINE FONT oFntMetroFLATBTN NAME "TAHOMA" SIZE 0, - 18

   DEFINE FONT oFntMetroSay NAME 'Calibri' SIZE 0, -12 BOLD

   // cAnzeige1 := ansiToOem(cAnzeige1)
   nLine := 16
   DEFINE DIALOG oDlg ;
      TITLE "Auswahl" ;
      FROM 0, 5 ;
      TO nHeight * 1 / 2, nWidth + 6 ;
      PIXEL ;
      STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
      COLOR CLR_WHITE, nRibbonTopClr ;
      FONT oFntMetroFLATBTN

   oDlg:SetFont( oFntMetroNormal2 )

   nLine := 0.5
   @ nRowOffset * nLine, nWidth / 5 / 2.05 ;
      SAY cTitel ;
      OF oDlg ;
      PIXEL ;
      FONT oFntMetroMedium2 ;
      COLOR CLR_WHITE, nRibbonTopClr

   nLine := 2

   @ nRowOffset + nRowSpace * nLine, nWidth / 5 / 2.05 ;
      SAY cAnzeige1 ;
      OF oDlg ;
      PIXEL ;
      FONT oFntMetroMedium2 ;
      COLOR CLR_WHITE, nRibbonTopClr ;
      SIZE 600, 600

   @ ( nHeight * 1 / 2 - 65 ) / 2.05, nWidth / 5 / 2.05 ;
      BTNBMP oBTNNaviWeiter PROMPT "OK";
      SIZE ( 128 ) / 2.05, ( 64 ) / 2.05 ;
      PIXEL OF oDlg FLAT COLOR  CLR_WHITE, CLR_ROTMETRO ;
      ACTION ( lVar := .T., oDlg:End() )

   @ 0, 0 ;
      FLATBTN oBTNNaviInfo ;
      PROMPT "+" ;
      FONT oFntMetroSay ;
      SIZE ( 32 ) / 2.05, ( 32 ) / 2.05 ;
      OF oDlg ;
      ACTION ( msginfo( cInfo ) ) ;
      COLOR nRibbonTopClr, RGB( 210, 210, 210 )

   oBTNNaviInfo:cTooltip := { "Info" }

   ACTIVATE DIALOG oDlg CENTERED

RETURN NIL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests