Riaz,
Please try this change in my example:
DEFINE TIMER oTimer ACTION oWnd:oWndClient:Say( 2, 2, Time() )
#include "FiveWin.ch"
#include "Image.ch"
#include "TTitle.ch"
STATIC hDC, oWnd, oFont, oTimefont, oDatafont, oTimer
FUNCTION Main()
LOCAL oBtn1, oBtn2
LOCAL nSWidth := GetSysMetrics(0), nSHeight := GetSysMetrics(1)
SET _3DLOOK ON
SetBalloon( .T. )
c_path := GETCURDIR() // FWH >= 12.01
// c_path := CURDRIVE() + ":\" + GETCURDIR()
DEFINE ICON oIco RESOURCE "Super"
oFont := TFont():New("Arial",0,-14,.F.,.T.,0,0,0,.T. )
oTimeFont := TFont():New("Arial",,-24,.F.,.F. ,,,,.F. )
oDateFont := TFont():New("Arial",,-24,.F.,.F. ,,,,.F. )
DEFINE WINDOW oWnd ;
TITLE "MDI Window / Dialog - Brushes and Logos" MDI
@ nSHeight - 158, nSWidth - 100 BTNBMP oBtn1 OF oWnd ;
SIZE 80, 70 PIXEL 2007 ;
NOBORDER ;
PROMPT " &Exit" ;
FILENAME c_path + "\Images\Exit.Bmp" ;
ACTION oWnd:End() ;
FONT oFont ;
TOP
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Exit " + CRLF + "Date / Time-test","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )
SHOW_TD()
SET MESSAGE OF oWnd TO "Window / Dialog - Brushes and Logos" ;
CENTERED CLOCK KEYBOARD 2007
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON RESIZE ( W_BACKGRD( oWnd:oWndClient, "PICTURE8.jpg" ), ;
IIF( nVisible = 1, ( aLogo[1] := ( oWnd:nHeight / 2 ) - 50 - ( 248 / 2 ), ;
aLogo[2] := ( oWnd:nWidth / 2 ) - ( 320 / 2 ) ), NIL ), ;
oBtn1:Move( oWnd:nHeight - 158, oWnd:nWidth - 110, , ,.T. ) )
SET _3DLOOK OFF
oFont:End()
oTimeFont:End()
oDateFont:End()
oTimer:End()
RETURN NIL
// -------- WINDOW - Background ---------------
FUNCTION W_BACKGRD( oWnd, cImage )
LOCAL oBrush
DEFINE IMAGE oImage FILE c_path + "\Images\" + cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, oWnd:nWidth, oWnd:nHeight , .T. ) )
oImage:End()
oWnd:SetBrush( oBrush )
oBrush:End()
RETURN( NIL )
// ----------------
FUNCTION SHOW_TD()
LOCAL oTitle, oTime, oDate
Local cTime := "", cDate := ""
@ 105, 20 TITLE oTitle SIZE 270, 50 OF oWnd TRANSPARENT SHADOWSIZE 0
oTITLE:lRound := .T.
oTITLE:lBorder := .F.
// Shadow Tansparent-intensity ( 10 = Low / 70 = Black )
oTITLE:nShadowIntensity = 20
// Display Time with Shadow
// -------------------------------------
@ 10, 50 + 10 TITLETEXT oTime OF oTitle TEXT cTime FONT oTimeFont ;
SHADOW BOTTOMRIGHT COLOR 16443068
// Display Date with Shadow
// -------------------------------------
@ 10, 50 + 120 TITLETEXT oDate OF oTitle TEXT cDate FONT oDateFont ;
SHADOW BOTTOMRIGHT COLOR 65535
// Text Shadow-Color
// -------------------------
oTITLE:nShadowTxtClr := 0
// Text-Shadow-Distance
// ------------------------------
oTITLE:nShadowTxtDis := 1
// Animated Title-Image
// ----------------------------
@ 2, 5 TITLEIMG OF oTITLE BITMAP c_path + "\Images\Clock.bmp" TRANSPARENT ;
ANIMA LEVEL 255 ;
ACTION MsgAlert( "Button with Action","Attention" )
DEFINE TIMER oTimer INTERVAL 500 ;
ACTION GETDATA( oTime, oDate ) OF oWnd
ACTIVATE TIMER oTimer
RETURN ( NIL )
// ---------------------------------
FUNCTION GETDATA( oTime, oDate )
LOCAL oTime1 := TTime():System()
cTime := oTime1:cGetTime() + " / "
cDate := DToC( Date() )
oTime:SetText( cTime )
oDate:SetText( cDate )
RETURN NIL
// ---------- DEFINED FORMAT -------------
FUNCTION CALC_TD2(oTime, oSay1, oSay2, oSay3, oSay4)
LOCAL oImage, oTime1, oDate1, oDate2, oDate3, oDate4
LOCAL cTime := Time()
LOCAL cDate1 := ALLTRIM( STR( DAY(DATE()) ))
LOCAL cDate2 := CMONTH( Date() )
LOCAL cDate3 := CDOW( Date() )
LOCAL cDate4 := ALLTRIM( STR( YEAR( DATE() ) ) )
// "TimeTxtTop", nT_TxtTop
// "TimeTxtLeft", nT_TxtLeft
// "DateTxtTop1", nD_TxtTop1
// "DateTxtTop2", nD_TxtTop2
// "DateTxtLeft1", nD_TxtL1
// "DateTxtLeft2", nD_TxtL2
// "DateTxtLeft3", nD_TxtL3
// "DateTxtLeft4", nD_TxtL4
nTimeDate := 2 // visible
// TimeText
// -------------
nT_Width1 := TEXT_WIDTH( oTimeFont, oTime, cTime )
nT_Height := INT( Abs( oTimeFont:nHeight ) )
// DateText
// -------------
nD_Width1 := TEXT_WIDTH( oTimeFont, oSay1, cDate1 ) // Day
nD_Width2 := TEXT_WIDTH( oDateFont, oSay2, cDate2 ) // Month
nD_Width3 := TEXT_WIDTH( oDateFont, oSay3, cDate3 ) // Weekday
nD_Width4 := TEXT_WIDTH( oTimeFont, oSay4, cDate4 ) // Year
nD_Height := INT( Abs( oDateFont:nHeight ) )
// MsgAlert( nT_Width1, "Time-width" )
// MsgAlert( nD_Width1, "Day-width" )
// MsgAlert( nD_Width2, "Month-width" )
// MsgAlert( nD_Width3, "Weekday-width" )
// MsgAlert( nD_Width4, "Year-width" )
nI_Width := 0
nI_Height := 0
IF nTDImgOn = 1 // INCLUDE Image
DEFINE IMAGE oImage FILENAME c_path + "\Images\" + cTDImage
nI_Width := oImage:nWidth
nI_Height := oImage:nHeight
oImage:End()
nT_TxtLeft := 10 + nI_Width + 10 // left Timertext
nD_TxtL1 := 10 + nI_Width + 10 // left Day
nD_TxtL2 := nD_TxtL1 + nD_Width1 + 10 // left Month
nD_TxtL3 := nD_TxtL2 // left Weekday
IF nD_Width2 >= nD_Width3 // Month > Weekday
nD_TxtL4 := nD_TxtL3 + nD_Width2 // left Year
ELSE
nD_TxtL4 := nD_TxtL3 + nD_Width3 // left Year
ENDIF
nTD_Width := nD_TxtL4 + nD_Width4 + 10 // Body Width
nT_TxtTop := 10 // Time Top
nD_TxtTop1 := nT_TxtTop + nT_Height + 5 // Day, Month and Year Top
nD_TxtTop2 := nD_TxtTop1 + nD_Height // Weekday Top
ELSE
nT_TxtLeft := 10 // left Timertext
nD_TxtL1 := 10 // left Day
nD_TxtL2 := nD_TxtL1 + nD_Width1 + 10 // left Month
nD_TxtL3 := nD_TxtL2 // left Weekday
IF nD_Width2 >= nD_Width3 // Month > Weekday
nD_TxtL4 := nD_TxtL3 + nD_Width2 // left Year
ELSE
nD_TxtL4 := nD_TxtL3 + nD_Width3 // left Year
ENDIF
nTD_Width := nD_TxtL4 + nD_Width4 + 10 // Body Width
nT_TxtTop := 10 // Time Top
nD_TxtTop1 := nT_TxtTop + nT_Height + 5 // Day, Month and Year Top
nD_TxtTop2 := nD_TxtTop1 + nD_Height // Weekday Top
ENDIF
IF nI_Height >= 10 + nT_Height + 10 + nT_Height .or. ;
nI_Height >= 10 + nT_Height + 10 + nD_Height
nTD_Height := nI_Height + 20 // Body Height
ELSE
IF 10 + nT_Height + 10 + nT_Height >= 10 + nT_Height + 10 + nD_Height
nTD_Height := 10 + nT_Height + 10 + nT_Height + 15 // Body Height
ELSE
nTD_Height := 10 + nT_Height + 10 + nD_Height + 15 // Body Height
ENDIF
ENDIF
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 104 guests