New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post by ukoenig »

Hello,

because I don't like the normal MsgWait-function ( no Brush, no Linefeed, no Font ... )
I created new visual Styles.
The Msg-Size is calculated from : the longest Text, Fontsize and given Space between Textlines

Image

Image

@ 190, 465 BTNBMP oBtn9 FILENAME c_path + "\Bitmaps\Rename.bmp" ;
SIZE 42, 38 OF oDlg1 PIXEL NOBORDER ;
TOP ;
PROMPT " &Rename" ;
FONT oTxtfont ;
ACTION ( IMG_RENAME(), ;
MSG_INFO(oBrush3, oTxtfont, ;
"Rename-info :", ;
"File " + cReadImg + "\" + cFileNoPath( cImgname ), ;
"renamed to ", ;
"File " + cReadImg + "\" + cNewImg + "." + cFileExt( cImgname ) , ;
3000, 8388608, 10, 50, 50 )
)

Function :

MSG_INFO( ;
oBrush, ; // Brush
oFont, ; // Font
cTitle, ; // MsgTitle
cText1, ; // MsgText 1
cText2, ; // MsgText 2
cText3, ; // MsgText 3
nIntervall, ; // Timer
nTxtColor, ; // Textcolor
nSpace, ; // Space between Text
nMsgTop, ; // MsgTop
nMsgLeft ) // Msg Left

Code: Select all

FUNCTION MSG_INFO(oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, nIntervall, nColor, nSpace, nTop, nLeft)
LOCAL oDlg, nMsgTW := 300, nMsgTH := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 

//ACTION  ( Img_Rename(), ; // Function
//MSG_INFO(oBrush3, oTxtfont, ; // Message
//"Rename-info :", ;
//"File 1", ;
//"renamed to ", ;
//"File 2", ;
//2000, 8388608, 20, 90, 50 ) ) // Intervall, Text-color, Line-space, MsgTop, MsgLeft

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH := oFont:nHeight()

nDlgHeight := ( 6 * nSpace ) + ( 4 * nMsgTH )
nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT ( SETTRANSP( oDlg ), ;
     oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
     MSG_INFO1(oDlg, oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, ;
               nColor, nMsgTH, nSpace, nDlgWidth, nDlgHeight), ;
     SET_TMR(oDlg,nIntervall) )

RETURN( NIL )

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

FUNCTION MSG_INFO1(oDlg, oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, nColor, nMsgTH, nSpace, nDlgWidth, nDlgHeight)
LOCAL oTitle

@  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight OF oDlg SHADOW ROUND 
oTitle:aGrdBack := {}
SET BRUSH OF oTitle TO oBrush
oTitle:nClrLine1 := 8388608

@  2 * nSpace, 30  TITLETEXT OF oTitle TEXT cTitle  FONT ofont  COLOR nColor 

@  3 * nSpace + nMsgTH , 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont  COLOR nColor
@  ( 4 * nSpace ) + ( 2 * nMsgTH ) , 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont  COLOR nColor 
@  ( 5 * nSpace ) + ( 3 * nMsgTH ), 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont  COLOR nColor

RETURN( NIL )

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

FUNCTION SET_TMR(oDlg,nIntervall)
LOCAL oTmr, lActive := .F.

DEFINE TIMER oTmr INTERVAL nIntervall ACTION MSG_INFO2(oDlg, lActive) OF oDlg
ACTIVATE TIMER oTmr

RETURN( NIL )

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

FUNCTION MSG_INFO2(oDlg, lActive)

IF ! lActive
    lActive = .t.
    oDlg:End()
    lActive = .f.
ENDIF

RETURN( NIL )

// Activate for older FWH-versions
//-------------------------------------------

#define LWA_COLORKEY 1 
#define GWL_EXSTYLE -20 
#define WS_EX_LAYERED 524288 

STATIC FUNCTION SETTRANSP( oDlg ) 

SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 
SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, , , LWA_COLORKEY ) 

RETURN NIL
 
A visual Alert with selected Brush and Images !
( MSG_YESNO will be the same, but with two Button and Returns .T. or .F. )

Image

Function ( 48 x 48 BMP's are used )

MSG_ALERT( ;
oBrush, ; // Brush
oFont, ; // Font
cTitle, ; // MsgTitle
cText1, ; // MsgText 1
cText2, ; // MsgText 2
cText3, ; // MsgText 3
nTxtColor, ; // Textcolor
nSpace, ; // Space between Text
nMsgTop, ; // MsgTop
nMsgLeft, ; // Headline BMP
cImage )

Code: Select all

...
...
MSG_ALERT(oBrush3, oTxtfont, ;
       "Attention", ;
       "No Images in : " + cFilePath( cImgname ), ;
       "with = > " + cSeek + " ???", ;
       "found !!! ", 8388608, 12, 78, 165, ;
       c_path + "\Bitmaps\Warning.bmp" )
...
...
// ------------------------

FUNCTION MSG_ALERT(oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, ;
                                          nColor, nSpace, nTop, nLeft, cImage)
LOCAL oDlg, nMsgTW := 300, nMsgTH := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH := oFont:nHeight()

IF EMPTY( cImage )
    nDlgHeight := ( 7 * nSpace ) + ( 4 * nMsgTH )
ELSE
    nDlgHeight := ( 7 * nSpace ) + ( 4 * nMsgTH ) + 70
ENDIF
nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg ;
ON INIT ( SETTRANSP( oDlg ), ;
        oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
        MSG_ALERT1(oDlg, oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, ;
                              nColor, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage) )

RETURN( NIL )

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

FUNCTION MSG_ALERT1(oDlg, oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, ;
                                         nColor, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage)
LOCAL oTitle, oBmp, oBtn

@  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight -10 OF oDlg SHADOW ROUND 
oTitle:aGrdBack := {}
SET BRUSH OF oTitle TO oBrush
oTitle:nClrLine1 := 8388608

IF EMPTY(cImage)
    @  2 * nSpace, 30  TITLETEXT OF oTitle TEXT cTitle  FONT ofont  COLOR nColor 

    @  3 * nSpace + nMsgTH , 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont  COLOR nColor
    @  ( 4 * nSpace ) + ( 2 * nMsgTH ) , 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont  COLOR nColor 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH ), 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont  COLOR nColor
ELSE
    @ 2 * nSpace, 25 BITMAP oBmp FILENAME cImage OF oTitle ADJUST SIZE 48, 48 PIXEL NOBORDER

    @  2 * nSpace + 25, 80 TITLETEXT OF oTitle TEXT cTitle  FONT ofont  COLOR nColor 

    @  3 * nSpace + nMsgTH + 25, 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont  COLOR nColor
    @  ( 4 * nSpace ) + ( 2 * nMsgTH ) + 25 , 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont  COLOR nColor 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont  COLOR nColor
ENDIF

@ ( 6 * nSpace ) + ( 3 * nMsgTH ) + 30, nDlgWidth - 60  BTNBMP oBtn FILENAME c_path + "\Bitmaps\Close.bmp" ;
SIZE 55, 55 OF oTitle PIXEL ROUND NOBORDER ;
ACTION  ( oDlg:End() )
oBtn:cTooltip := "Exit Alert"
oBtn:lTransparent := .T.
oBtn:l2007 := .F.

RETURN( NIL )
 
Best Regards
Uwe :lol:
Last edited by ukoenig on Thu Apr 28, 2011 10:40 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Kleyber
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Re: Visual MSGWAIT- ALERT- and YESNO-functions

Post by Kleyber »

Dear Uwe,

Very nice. What about the MsgRun() function? Is there a way to create a new one which we can change the text dynamically? It would be nice if it is possible.
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Visual MSGWAIT- ALERT- and YESNO-functions

Post by nageswaragunupudi »

While better looking MsgRun dialog can be created, present functionality provides for chaging the text dynamically.

MsgRun( cMsg, cTitle, { |oDlg| MyFunction( oDlg ) }

In my function, whenever the text is to be changed:

oDlg:cMsg := "new message"
oDlg:Refresh()

or better

oDlg:Say( 11, 0, xPadC( oDlg:cMsg, nWidth ),,,, .T. ); SysRefresh()
Regards

G. N. Rao.
Hyderabad, India
User avatar
Kleyber
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-functions

Post by Kleyber »

Nagesh,

Fantastic!!! Thanks a lot for the tip.
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-functions

Post by ukoenig »

MSG_Alert
MSG_Wait
MSG_YesNo


New :
1. A Image can be added to Headline ( optional )
2. Two different Fonts are supported : Headline and 3 Textlines
3. MSG_YesNo accepts 3 different Images
4. Different Colors for Head and Textlines

Image

Code: Select all

// ----------------------------------------------------
// ---------- ALERT - FUNCTION --------------

FUNCTION MSG_ALERT(oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                          nColor1, nColor2, nSpace, nTop, nLeft, cImage1, cImage2)
LOCAL oDlg, nMsgTW := 300, nMsgTH := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont1 ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont2 ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont2 ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont2 ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH1 := oFont1:nHeight()
nMsgTH2 := oFont2:nHeight()

IF EMPTY( cImage1 )
     nDlgHeight := ( 8 * nSpace ) + nMsgTH1 + ( 3 * nMsgTH2 ) + 40
ELSE
     nDlgHeight := ( 8 * nSpace ) + (  3 * nMsgTH2 ) + 80
ENDIF

nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg ;
ON INIT ( SETTRANSP( oDlg ), ;
        oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
        MSG_ALERT1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                              nColor1, nColor2, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage1, cImage2) )

RETURN( NIL )

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

FUNCTION MSG_ALERT1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                         nColor1, nColor2, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage1, cImage2)
LOCAL oTitle, oBmp, oBtn

@  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight -10 OF oDlg SHADOW ROUND 
oTitle:aGrdBack := {}
SET BRUSH OF oTitle TO oBrush
oTitle:nClrLine1 := 8388608

IF EMPTY(cImage1)
    @    2 * nSpace, 30  TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace   +         nMsgTH2,   30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ELSE
    @    2 * nSpace, 25 BITMAP oBmp FILENAME cImage1 OF oTitle ADJUST SIZE 48, 48 PIXEL NOBORDER

    @    2 * nSpace + nMsgTH1, 80 TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace   +         nMsgTH2   + 25, 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ENDIF

@ nDlgHeight - 65, nDlgWidth - 60  BTNBMP oBtn FILENAME cImage2 ;
SIZE 55, 55 OF oTitle PIXEL ROUND NOBORDER ;
ACTION  ( oDlg:End() )
oBtn:cTooltip := "Exit Alert"
oBtn:lTransparent := .T.
oBtn:l2007 := .F.

RETURN( NIL )
 
Image

Code: Select all

// ----------------------------------------------------
// ---------- YESNO - FUNCTION --------------

FUNCTION MSG_YESNO(oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                          nColor1, nColor2, nSpace, nTop, nLeft, cImage1, cImage2, cImage3)
LOCAL oDlg, nMsgTW := 300, nMsgTH := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 

PRIVATE lYESNO := .F.

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont1 ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont2 ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont2 ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont2 ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH1 := oFont1:nHeight()
nMsgTH2 := oFont2:nHeight()

IF EMPTY( cImage1 )
     nDlgHeight := ( 8 * nSpace ) + nMsgTH1 + 3 * nMsgTH2  + 40
ELSE
     nDlgHeight := ( 8 * nSpace ) + ( 3 * nMsgTH2 ) + 80
ENDIF

nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg ;
ON INIT ( SETTRANSP( oDlg ), ;
        oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
        lYESNO := MSG_YESNO1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                              nColor1, nColor2, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage1, cImage2, cImage3) )

RETURN lYESNO 

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

FUNCTION MSG_YESNO1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                         nColor1, nColor2, nMsgTH, nSpace, nDlgWidth, nDlgHeight, cImage1, cImage2, cImage3)
LOCAL oTitle, oBmp, oBtn1, oBtn2

@  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight -10 OF oDlg SHADOW ROUND 
oTitle:aGrdBack := {}
SET BRUSH OF oTitle TO oBrush
oTitle:nClrLine1 := 8388608

IF EMPTY(cImage1)
    @    2 * nSpace, 30  TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace    +        nMsgTH2,   30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ELSE
    @    2 * nSpace, 25 BITMAP oBmp FILENAME cImage1 OF oTitle ADJUST SIZE 48, 48 PIXEL NOBORDER

    @    2 * nSpace +           nMsgTH1, 80 TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace +           nMsgTH2   + 25, 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ENDIF

@ nDlgHeight - 65, (nDlgWidth / 2) - 65  BTNBMP oBtn1 FILENAME cImage2 ;
SIZE 55, 55 OF oTitle PIXEL ROUND NOBORDER ;
ACTION  ( lYESNO := .T., oDlg:End() )
oBtn1:cTooltip := "YES"
oBtn1:lTransparent := .T.
oBtn1:l2007 := .F.

@ nDlgHeight - 65, (nDlgWidth / 2) + 25  BTNBMP oBtn2 FILENAME cImage3 ;
SIZE 55, 55 OF oTitle PIXEL ROUND NOBORDER ;
ACTION  ( lYESNO := .F., oDlg:End() )
oBtn2:cTooltip := "NO"
oBtn2:lTransparent := .T.
oBtn2:l2007 := .F.

RETURN lYESNO 
 
Image

Code: Select all

// ----------------------------------------------------
// ---------- WAIT - FUNCTION ----------------

FUNCTION MSG_WAIT(oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                       nIntervall, nColor1, nColor2, nSpace, nTop, nLeft, cImage)
LOCAL oDlg, nMsgTW := 300, nMsgTH1 := 20, nMsgTH2 := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 
LOCAL oTmr

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont1 ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont2 ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont2 ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont2 ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH1 := oFont1:nHeight()
nMsgTH2 := oFont2:nHeight()

IF EMPTY( cImage )
     nDlgHeight := ( 7 * nSpace ) + nMsgTH1 + ( 3 * nMsgTH2 ) 
ELSE
     nDlgHeight := ( 7 * nSpace ) + ( 3 * nMsgTH2 ) + 40
ENDIF

nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg ;
ON INIT ( SETTRANSP( oDlg ), ;
        oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
        MSG_WAIT1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                              nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage), ;
        START_TMR(oDlg,oTmr,nIntervall) )

RETURN( NIL )

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

FUNCTION START_TMR(oDlg,oTmr,nIntervall)

IF oTmr == nil
    DEFINE TIMER oTmr INTERVAL nIntervall ACTION oDlg:End() OF oDlg
    ACTIVATE TIMER oTmr
ELSE
    Alert( "There is already a working timer..." )
ENDIF

RETURN NIL

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

FUNCTION MSG_WAIT1(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
                                         nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage)
LOCAL oTitle, oBmp

@  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight - 10 OF oDlg SHADOW ROUND 
oTitle:aGrdBack := {}
SET BRUSH OF oTitle TO oBrush
oTitle:nClrLine1 := 8388608

IF EMPTY(cImage)
    @    2 * nSpace, 30  TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace   +         nMsgTH2 ,  30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ELSE
    @    1 * nSpace, 25 BITMAP oBmp FILENAME cImage OF oTitle ADJUST SIZE 40, 40 PIXEL NOBORDER

    @    2 * nSpace + 10, 80 TITLETEXT OF oTitle TEXT cTitle  FONT oFont1  COLOR nColor1 

    @    3 * nSpace   +         nMsgTH2   + 25, 30  TITLETEXT OF oTitle TEXT cTxt1  FONT oFont2  COLOR nColor2
    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt2  FONT oFont2  COLOR nColor2 
    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt3  FONT oFont2  COLOR nColor2
ENDIF

RETURN( NIL )
 
Samples using the new Functions :

Code: Select all

// ---------------------------------------------
// ------------ IMAGE - COPY ------------

FUNCTION IMG_COPY()
LOCAL cDestination
   
IF lSwapDir = .F.
    cDestination := cSaveImg + "\" + cFileNoPath( cImgname )
ELSE                                                               
    cDestination := cReadImg + "\" + cFileNoPath( cImgname ) 
ENDIF

// Test-alerts
// --------------
// MsgAlert( cImgname, "Image from Read-directory" )    
// MsgAlert( cDestination, "Image copy to Destination-directory" )  

COPYFILE( cImgname, cDestination, .F. )

IF !File(cDestination)
    MSG_ALERT(oBrush3, oBigFont, oTxtfont, ;   // Brush, Headfont, Textfont
          "Attention", ;   // Headline
          "Image : ", ;   // 1. Text
          cImgname, ;   // 2. Text
          "not copied !", ;   // 3. Text
          128, 8388608, 12, 78, 165, ;   // HeadColor, TextColor, Space, Top, Left
          c_path + "\Bitmaps\Alert.bmp", ;   // Title-image or NIL => NIL for no Bitmap !!!
          c_path + "\Bitmaps\Close.bmp" )   // Exit-image
ELSE
    MSG_WAIT(oBrush3, oBigFont, oTxtfont, ;
          "Image-copy", ;   // Headline
          "File " + cImgname, ;   // 1. Textline
          "copied to ===> ", ;   // 2. Textline
          cDestination, ;   // 3. Textline
          3000, 128, 8388608, 12, 78, 165, ;   // Intervall, Head-color, Text-color, Space, Top, Left
          c_path + "\Bitmaps\Wait.bmp" )   // Title-Image 
ENDIF

RETURN( NIL )

// ---------------------------------------------
// ------------ IMAGE - DELETE---------

FUNCTION IMG_DELETE()
LOCAL cRead, cReadpath
                               
IF lSwapDir = .F.
    cRead := cReadImg + "\" + cFileNoPath( cImgname )
        cReadpath := cReadImg + "\"
ELSE                                                               
    cRead := cSaveImg + "\" + cFileNoPath( cImgname ) 
        cReadpath := cSaveImg + "\"
ENDIF

// Test-alerts
// --------------
// MsgAlert( cRead, "Image from Read-directory" )   

IF MSG_YESNO( oBrush3, oBigFont, oTxtfont, ;  // Brush, Headfont, Textfont
          "Image delete", ;   // Headline
          "Do You want to delete Image", ;   // 1. Text 
          cFilePath( cImgname ), ;   // 2. Text
          cFileNoPath( cImgname ) + "   ???", ;   // 3. Text
          128, 8388608, 12, 78, 165, ;   // HeadColor, TextColor, Space, Top, Left
          c_path + "\Bitmaps\Help1.bmp", ;   // Title-image or NIL
          c_path + "\Bitmaps\Yes.bmp", ;   // Yes-image
          c_path + "\Bitmaps\Close.bmp" )   // No-image

    oBrw2:End() 
        FErase(cRead)
    aImg := ReadImages( cReadpath )
    SHOW_BROW()
    IF !FILE( "&cDestination" )
        MSG_WAIT(oBrush3, oBigFont, oTxtfont, ;
             "Image delete", ;
             "Image : " + cImgname, ;
             "successfull deleted !", ;
             "", 3000, 128, 8388608, 12, 78, 165, ;
             c_path + "\Bitmaps\Wait.bmp" ) 
    ELSE
        MSG_ALERT(oBrush3, oBigFont, oTxtfont, ; 
          "Attention", ;                          
          "Could not delete Image : ", ;  
          cRead, ;    
          "", ;      
          128, 8388608, 12, 78, 165, ;
          c_path + "\Bitmaps\Alert.bmp", ; 
          c_path + "\Bitmaps\Close.bmp" ) 
    ENDIF
ENDIF

RETURN NIL

// ---------------------------------------------
// ------------ IMAGE - RENAME---------

FUNCTION IMG_RENAME()
LOCAL oDlg5, oBtn1, oBtn2, oSay1, oSay2, oSay3, oGet1, cOldImg
IF lSwapDir = .F.
    cOldImg := cReadImg + "\" + cFileNoPath( cImgname )
ELSE                                                               
    cOldImg := cSaveImg + "\" + cFileNoPath( cImgname ) 
ENDIF
cNewImg := SPACE(50)

DEFINE DIALOG oDlg5 FROM  0, 0 TO 200, 400 TITLE "Image-Rename" PIXEL BRUSH oBrush2 

@ 5, 20 SAY oSay1 VAR cOldImg of oDlg5 PIXEL SIZE 100, 15 COLOR 0 ;
FONT oTxtFont TRANSPARENT ADJUST

@ 20, 20 SAY oSay2  PROMPT "Rename to ( NO File-extension ! ) :" of oDlg5 PIXEL SIZE 100, 15 COLOR 128 ;
FONT oTxtFont TRANSPARENT ADJUST

@ 35, 20 GET oGet VAR cNewImg OF oDlg5 PIXEL SIZE 100, 15 COLOR "+W/B" FONT oTxtFont

@ 38, 120 SAY oSay3 PROMPT "." + cFileExt(cOldImg) of oDlg5 PIXEL SIZE 100, 15 COLOR 0 ;
FONT oTxtFont TRANSPARENT ADJUST

@ 50, 100 BTNBMP oBtn1 FILENAME c_path + "\Bitmaps\Rename.bmp" ;
SIZE 55, 55 OF oDlg5 PIXEL NOBORDER ;
TOP ;
PROMPT "" ;
FONT oTxtfont ;
ACTION  ( oGet:Refresh(), IMG_REN(cOldImg), oDlg5:End() )
oBtn1:cTooltip := "Rename Image"
oBtn1:lTransparent := .T.
oBtn1:l2007 := .F.
oBtn1:SetColor( 16312263 )

// MSG_WAIT(oBrush, oFont, cTitle, cTxt1, cTxt2, cTxt3, ;
//                     nIntervall, nColor, nSpace, nTop, nLeft, cImage)

@ 50, 145 BTNBMP oBtn2 FILENAME c_path + "\Bitmaps\Exit.bmp" ;
SIZE 55, 55 OF oDlg5 PIXEL NOBORDER ;
TOP ;
PROMPT "" ;
FONT oTxtfont ;
ACTION  ( MSG_WAIT(oBrush3, oBigFont, oTxtfont, ;
                   "Rename-info :", ;
                   "File " + cOldImg, ;
                   "not renamed !!!", ;
                   "", 3000, 128, 8388608, 12, 78, 165, ;
                   c_path + "\Bitmaps\Wait.bmp" ), ; 
          oDlg5:End() )
oBtn2:cTooltip := "Exit rename"
oBtn2:lTransparent := .T.
oBtn2:l2007 := .F.
oBtn2:SetColor( 16312263 )

ACTIVATE DIALOG oDlg5 CENTERED

RETURN( NIL )

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

FUNCTION IMG_REN(cOldImg)

cNewImg := Alltrim(cNewImg)                            
cRen := cFilePath(cOldImg) + ALLTRIM( cNewImg) + "." + cFileExt(cOldImg)

// Test-alerts
// --------------
// MsgAlert( cOldImg, "Image from Read-directory" ) 
// MsgAlert( cRen, "Image-rename" ) 

IF MSG_YESNO( oBrush3, oBigFont, oTxtfont, ;   
                 "Image rename", ;                  
                 "Do You want to rename Image", ;      
                 cOldImg + " to =>", ;          
                 cRen + "   ???", ;                  
                 128, 8388608, 12, 78, 165, ;       
                 c_path + "\Bitmaps\Help1.bmp", ;    
                 c_path + "\Bitmaps\Yes.bmp", ;      
                 c_path + "\Bitmaps\Close.bmp" )   

    COPYFILE( cOldImg, cRen, .F. )  
    IF !File(cRen)
        MSG_ALERT(oBrush3, oBigFont, oTxtfont, ;  
                       "Attention", ;                   
                       "File", ;                          
                       cRen, ;                          
                       "not created !", ;                          
                       128, 8388608, 12, 78, 165, ;        
                    c_path + "\Bitmaps\Alert.bmp", ;     
                    c_path + "\Bitmaps\Close.bmp" )    
    ELSE    
        FErase(cOldImg)
        IF File(cOldImg)
            MSG_ALERT(oBrush3, oBigFont, oTxtfont, ; 
                           "Attention", ;         
                           "Old Image", ;           
                           cOldImg, ;                 
                           "not deleted !", ;            
                           128, 8388608, 12, 78, 165, ;   
                        c_path + "\Bitmaps\Alert.bmp", ;    
                        c_path + "\Bitmaps\Close.bmp" ) 
        ELSE    
            IF File(cRen)
                oBrw2:End()
            //  FRENAME(Chr(34) + cDestination + Chr(34), Chr(34) + cRen + Chr(34))
                aImg := ReadImages( cFilePath(cOldImg) )
                SHOW_BROW()

                cImgname := cRen
                SHOW_ROW()

                IF FILE( "&cRen" )
                     MSG_WAIT(oBrush3, oBigFont, oTxtfont, ;
                     "Rename-info :", ;
                     "File " + cOldImg, ;
                     "renamed to ", ;
                     "File " + cRen, 100000, 128, 8388608, 12, 78, 165, ;
                     c_path + "\Bitmaps\Wait.bmp" )
                ELSE
                    MSG_ALERT(oBrush3, oBigFont, oTxtfont, ;   
                                   "Attention", ;          
                                   "Coudn't rename Image : ", ;  
                                   cOld, ;                      
                                   "to => " + cRen, ;               
                                   128, 8388608, 12, 78, 165, ;    
                                c_path + "\Bitmaps\Alert.bmp", ;    
                                c_path + "\Bitmaps\Close.bmp" ) 
                ENDIF
            ENDIF
        ENDIF
    ENDIF
ENDIF

RETURN( NIL )

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

FUNCTION IMG_MOVE(oReadFrom, oSaveTo)
LOCAL cGetImg, cWriteImg
       
IF lSwapDir = .F.
    cGetImg := cReadImg + "\" + cFileNoPath( cImgname ) 
    cWriteImg := cSaveImg + "\" + cFileNoPath( cImgname )
ELSE
    cGetImg := cSaveImg + "\" + cFileNoPath( cImgname )
    cWriteImg := cReadImg + "\" + cFileNoPath( cImgname ) 
ENDIF

// Test-alerts
// --------------
// MsgAlert( cGetImg, "Image from Read-directory" ) 
// MsgAlert( cWriteImg, "Image to Save-directory" ) 

IF MSG_YESNO( oBrush3, oBigFont, oTxtfont, ;   
                 "Image move", ;                            
                 "Do You want to move Image", ;          
                 cGetImg + " to =>", ;                      
                 cWriteImg + "   ???", ;                    
                 128, 8388608, 12, 78, 165, ;             
                 c_path + "\Bitmaps\Help1.bmp", ;       
                 c_path + "\Bitmaps\Yes.bmp", ;           
                 c_path + "\Bitmaps\Close.bmp" )       

    COPYFILE( cGetImg, cWriteImg, .F. )
    IF !File(cWriteImg)
        MSG_ALERT(oBrush3, oBigFont, oTxtfont, ;      
                       "Attention", ;                       
                       "Image : ", ;                        
                       cWriteImg, ;                     
                       "not moved !", ;                     
                       128, 8388608, 12, 78, 165, ;       
                    c_path + "\Bitmaps\Alert.bmp", ;     
                    c_path + "\Bitmaps\Close.bmp" )    
    ELSE
        FErase(cGetImg)
        IF FILE(cGetImg)
            MSG_ALERT(oBrush3, oBigFont, oTxtfont, ;      
                           "Attention", ;                   
                           "Coudn't move Image : ", ;      
                           cGetImg, ;                       
                           "to => " + cWriteImg, ;          
                           128, 8388608, 12, 78, 165, ;     
                        c_path + "\Bitmaps\Alert.bmp", ;  
                        c_path + "\Bitmaps\Close.bmp" ) 
        ELSE
            ReadImages( cFilePath(cGetImg) )
                        nCount := oBrw2:nRowSel // remember Row
            oBrw2:End()
            SHOW_BROW()
            oBrw2:nArrayAt := nCount // move to Row
            oBrw2:nRowSel := nCount
            oBrw2:Refresh()
        ENDIF
    ENDIF
ENDIF

RETURN NIL

// Needed for older FWH-versions !!!!
//-------------------------------------------

#define LWA_COLORKEY 1 
#define GWL_EXSTYLE -20 
#define WS_EX_LAYERED 524288 

STATIC FUNCTION SETTRANSP( oDlg ) 

SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) ) 
SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, , , LWA_COLORKEY ) 

RETURN NIL
Best Regards
Uwe :lol:
Last edited by ukoenig on Fri Apr 29, 2011 10:08 pm, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post by Silvio »

Uwe,

If I only a caption and a message text

Can you explain me

how I can calc the SIZE ( w/h)of a dialog sample msginfo() ?
Best Regards, Saludos

Falconi Silvio
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post by ukoenig »

Silvio,

You have to do many Calculations.
The calculation is the same in all Functions :

MSG_ALERT(oBrush, ;
oFont1, ;
oFont2, ;
cTitle, ;
cTxt1, ;
cTxt2, ;
cTxt3, ;
nColor1, nColor2, ;
nSpace, nTop, nLeft, ;
cImage1, cImage2)


Image

1. Get the Text-len from all included Textlines ( 2 Fonts are used )
nMsgTW1 := oDlg:GetWidth( cTitle, oFont1 ) + 40 // 40 = BMP-size
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont2 )
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont2 )
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont2 )


2. Get the max Textlen of 4 Textlines ( with many textlines, better use a For/Next )
nMsgTW := MAX( nMsgTW1, nMsgTW2 ) // get max of Line 1 and 2
nMsgTW := MAX( nMsgTW, nMsgTW3 ) // get max of result and Line 3
nMsgTW := MAX( nMsgTW, nMsgTW4 ) // get max of result and Line 4


Result of Dialog-width from max Textlen + Left-distance + Right-distance:
nWDialog = 40 + nMsgTW

3. Font-height of Font 1
nMsgTH1 := oFont1:nHeight()

4. Font-height of Font 2
nMsgTH2 := oFont2:nHeight()

5. Count the Spaces You need like :
1. space = space from top Dialog to Top Headline-BMP
2. space = space between Bottom BMP and 1. Textline
3. space = space between 1. Textline and 2. Textline
4. space = space between 2. Textline and 3. Textline
5. space = space between 3. Textline and Exit-BMP-top
6. space = space between Exit-BMP-bottom and Dialog-bottom


Because Head-BMP-height > Head-font-height, Head-font-height is not included in the Calculation
Result : Dialog-height from 6 Spaces + 3 * Font-height2 + 2 * BMP-height :
nHDialog := ( 6 * nSpace ) + ( 3 * nMsgTh2 ) + 80
( 80 = Height 40 of Top-BMP and 40 of Bottom-BMP )

Best Regards
Uwe :lol:
Last edited by ukoenig on Fri Apr 29, 2011 12:34 pm, edited 5 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post by Silvio »

I made simply in this mode

I calc the with of ctext before to create the dialog ( sometimes is good see the classes of fivewin because they are a good school for us !!!!)


#define SIZE_BOTTOM 13
#define SIZE_RIGHT 40

FUNCTION msgYesNo(cText, oWnd, cTitle,cparser)
Local nBottom := SIZE_BOTTOM
Local nRight := SIZE_RIGHT
Local nWidth := GetTextWidth( 0,cText , oApp():oFont:hFont )
Local nHeight := nBottom * DLG_CHARPIX_H

DEFINE DIALOG oDlgYesNo SIZE nWidth, nHeight PIXEL ;
TITLE cTitle BRUSH oBrush TRANSPARENT ;
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION, 4 )


....

ACTIVATE DIALOG oDlgYesNo;
ON INIT DlgCenter(oDlgYesNo,oApp():oWndMain);
VALID !GETKEYSTATE( VK_ESCAPE )


and if I need a ctext much long I made a control

cparser on text sample if there @@@ then CRLF
Best Regards, Saludos

Falconi Silvio
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New Arrangement of MSGWAIT- ALERT- and YESNO-function

Post by ukoenig »

A Counter added :
( calculated with < Interval * Counter >, define Intervall for 1 Second )
Maybe some Improvements possible ?

Image

MSG_RUN(oBrush3, oBigFont, oTxtfont, ; // Brush, Headfont, Textfont
"Attention", ; // Headline
"No Images in : " + cFilePath( cImgname ), ; // 1. Text
"with = > " + cSeek + " ???", ; // 2. Text
"found !!! ", ; // 3. Text
3000, 5, 128, 8388608, 12, 78, 165, ; // Intervall, Counter, HeadColor, TextColor, Space, Top, Left
c_path + "\Bitmaps\Alert.bmp" ) // Title-image

Code: Select all

// ----------------------------------------------------
// ---------- RUN - FUNCTION --------------

FUNCTION MSG_RUN(oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
nIntervall, nSec, nColor1, nColor2, nSpace, nTop, nLeft, cImage)
LOCAL oDlg, nMsgTW := 300, nMsgTH1 := 20, nMsgTH2 := 20, nDlgWidth := 300, nDlgHeight := 100
LOCAL nMsgTW1 := 10, nMsgTW2 := 10, nMsgTW3 := 10, nMsgTW4 := 10 

PRIVATE oTitle, lTitle := .F., oHead

DEFINE DIALOG oDlg FROM  nTop, nLeft TO 590, 159 PIXEL ; // TRANSPARENT ;
STYLE WS_POPUP BRUSH TBrush():New( "NULL" ) 

nMsgTW1 := oDlg:GetWidth( cTitle, oFont1 ) 
nMsgTW2 := oDlg:GetWidth( cTxt1, oFont2 ) 
nMsgTW3 := oDlg:GetWidth( cTxt2, oFont2 ) 
nMsgTW4 := oDlg:GetWidth( cTxt3, oFont2 ) 

nMsgTW := MAX( nMsgTW1, nMsgTW2 )
nMsgTW := MAX( nMsgTW, nMsgTW3 )
nMsgTW := MAX( nMsgTW, nMsgTW4 )

nMsgTH1 := oFont1:nHeight()
nMsgTH2 := oFont2:nHeight()

IF EMPTY( cImage )
     nDlgHeight := ( 7 * nSpace ) + nMsgTH1 + ( 3 * nMsgTH2 ) 
ELSE
     nDlgHeight := ( 7 * nSpace ) + ( 3 * nMsgTH2 ) + 40
ENDIF
nDlgWidth := nMsgTW + 40

ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT ( SETTRANSP( oDlg ), ;
     oDlg:Move( nTop, nLeft, nDlgWidth, nDlgHeight, .f. ), ;
     MSG_RUN1(oDlg, lTitle, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
     nIntervall, nSec, nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage), ;
     RUN_TMR(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
     nIntervall, nSec--, nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage) )

RETURN( NIL )

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

FUNCTION RUN_TMR(oDlg, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
     nIntervall, nSec, nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage)  
LOCAL oTmr, lTitle := .F.

IF oTmr == nil
     DEFINE TIMER oTmr INTERVAL nIntervall ACTION ;
      MSG_RUN1(oDlg, lTitle, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
     nIntervall, nSec--, nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage) ;
     OF oDlg    
     ACTIVATE TIMER oTmr
ELSE
     Alert( "There is already a working timer..." )
ENDIF

RETURN NIL

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

FUNCTION MSG_RUN1(oDlg, lTitle, oBrush, oFont1, oFont2, cTitle, cTxt1, cTxt2, cTxt3, ;
          nIntervall, nSec, nColor1, nColor2, nMsgTH1, nMsgTH2, nSpace, nDlgWidth, nDlgHeight, cImage)
LOCAL oBmp

IF ! lActive
     lActive = .T.
     IF nSec = 0
          oDlg:End()
     ELSE
          IF lTitle = .F. 
               @  0, 0 TITLE oTitle SIZE nDlgWidth, nDlgHeight - 10 OF oDlg SHADOW ROUND 
               oTitle:aGrdBack := {}
               SET BRUSH OF oTitle TO oBrush
               oTitle:nClrLine1 := 8388608
               lTitle := .T.
               IF EMPTY(cImage)
                    @    2 * nSpace, 30  TITLETEXT oHead OF oTitle TEXT cTitle + ;
                    "  Left : " + LTRIM( STR( nSec)) + " Sec." FONT oFont1  COLOR nColor1 
                    @    3 * nSpace   +         nMsgTH2 ,  30  TITLETEXT OF oTitle TEXT cTxt1 ;
                           FONT oFont2  COLOR nColor2
                    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt2  ;
                           FONT oFont2  COLOR nColor2 
                    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ), 30  TITLETEXT OF oTitle TEXT cTxt3  ;
                           FONT oFont2  COLOR nColor2
               ELSE
                    @    1 * nSpace, 25 BITMAP oBmp FILENAME cImage ;
                          OF oTitle ADJUST SIZE 40, 40 PIXEL NOBORDER
                    @    2 * nSpace + 10, 80 TITLETEXT oHead OF oTitle TEXT cTitle + ;
                           "  Left : " + LTRIM( STR( nSec)) + " Sec." FONT oFont1  COLOR nColor1 
                    @    3 * nSpace   +         nMsgTH2   + 25, 30  TITLETEXT OF oTitle TEXT cTxt1 ;
                           FONT oFont2  COLOR nColor2
                    @  ( 4 * nSpace ) + ( 2 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt2  ;
                           FONT oFont2  COLOR nColor2 
                    @  ( 5 * nSpace ) + ( 3 * nMsgTH2 ) + 25, 30  TITLETEXT OF oTitle TEXT cTxt3  ;
                           FONT oFont2  COLOR nColor2
              ENDIF     
        ELSE
              cTitle := cTitle + "  Left : " + LTRIM( STR( nSec)) + " Sec."
              oHead:Refresh()
         ENDIF
     ENDIF
     lActive = .F.
ENDIF

RETURN( NIL )
 
Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply