FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Date/Time On Back Ground
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Date/Time On Back Ground
Posted: Mon Mar 26, 2012 11:53 AM

Riaz,

Please try this change in my example:

DEFINE TIMER oTimer ACTION oWnd:oWndClient:Say( 2, 2, Time() )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Mon Mar 26, 2012 12:08 PM
Antonio,

NO Problem :

Displayed on a MDI-window with NO Box :

1.) Works on MODAL or MDI.
2.) Displays a Combination of Time and Date.
3.) Time and Date with 2 different Colors
4.) defined Fonts ( can be different for Time and Date )
5.) Optional a selected Image
6.) Optional a defined Border, Transparent or Background with any Brush.
7.) Border with Shadow / no Shadow
8.) Optional a extra Info-text using any Font and Color.


Visual-design of any Style :



Best Regards
Uwe :-)
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.
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Mon Mar 26, 2012 12:25 PM

Dear All,
Anotnio, you last example does display a running clock on back ground.
ukoenig is working on the same..

Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Tue Mar 27, 2012 03:00 PM

Hi ukoenig,
Are you working on a solution on this..?
Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Tue Mar 27, 2012 03:23 PM
Riaz,

Yes, will be included in the Update of the Tool => LogoEdit to Release => 1.2
It is nearly finished with many new other Functions.

like :

1. A new Menu created, to get any Space for the Logo on Desktop ( see Pos No. 3 )
2. Extra Brushes for Folders
3. Menu can be moved to Mouse-click-position on Desktop
4. Logos can be centered and adjusted to a resized Window
5. new Time / date function
and much more..



Best Regards
Uwe :-)
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.
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Tue Mar 27, 2012 04:25 PM

Great, thanks for your contributions.......

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Tue Mar 27, 2012 07:31 PM
Riaz,

The Tests are done, still have to create a Painter.



Preview at Runtime on the Main-window.
Starting with the Painter many Things must be added like :
Font-selection, Image-selection, Border / NO Border, Single / Double-Line, Date-Format, Position ...



These Things are not possible using DS-Clock :

1. Added Image
2. different Colors for Time and Date
3. Transparent and Border
4. different Fonts for Time and Date
5. double Line for Time and Date

Best regards
Uwe :-)
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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Fri Mar 30, 2012 04:13 PM
Riaz,

I still need some Time, to finish the Tool.
In the Meantime a generated PRG for the Time / Date-display.



and the Clock



With the Tool You can design in Realtime :

1. Time Color and Font
2. Date Color and Font
3. Border YES / NO
4. Double Line YES / NO
5. Image YES / NO
6. Text Shadow YES / NO
7. Right Mouseclick on the Desktop, moves the Time/Date to the selected Position
.



The Code from the 1. Screenshot :

Code (fw): Select all Collapse
#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


Best Regards
Uwe :-)
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.
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Sat Mar 31, 2012 05:58 AM
Hi ukoenig ,

Thank you very much. This is great stuff. Your sample is already in use as last night I made a few changes and got it up and running, just the way I wanted....besides suffering from very bad cold and flu..

Have a look...



The center logo only display for 5 seconds but the clock is running...

Thanks and regards...
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Sat Mar 31, 2012 01:26 PM
Hi,
Now the Time Clock has been changed to AM/PM clock....



Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Tue Apr 03, 2012 09:04 PM
Riaz,

Your screendesign looks very nice.
I like the solution, splitting the date.
I will include it as a design-option.
I'm just testing the calculations, setting the different Infos in relation to each other.
From inside the tool, You only need to select a design/style and all values are calculated.

A sample from the INI-section :

[Time]
Visible=2 // Image ON
Top=50 // Box top
Left=50 // Box left
Width=357.67 // Box width
Height=63 // Box height
Border=2 // Border ON
Shadow=1 // Text-shadow ON
Double=1 // Double-line ON
Image=Clock.bmp // Image-file
ImageOn=1 // Image ON
DFormat=1 // Selected Date-format like : "mm/dd/yy" = American ( added Your Format : 02 Monday April 2012 )
TColor=65535 // Time-text-color
DColor=8453888 // Date-text-color
TFont=TFont():New("@Batang", ,-16,.F.,.F., , , ,.F. ) // Time-font
DFont=TFont():New("@Batang", ,-37,.F.,.F., , , ,.F. ) // Date-font
TTxtLeft=68 // Time-text Left-position
DTxtLeft=144.67 // Date-text Left-position
TTxtTop=14.40 // Time-text Top-position
DTxtTop=1.80 // Date-text Top-position




You can include Your logo in the time/date-box.
To the xBrowse ( dateformat ), I will add Your design from above.
Like You see, You can work on a logo and time/date-box at the same time in design-mode.
Even You don't need a Border, You can activate it, to see the complete needed painting area.



best regards
Uwe :-)
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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Mon Apr 09, 2012 01:55 PM
I added the extra format, defined from Riaz.
Now it will be possible, to test it with any font and color at runtime.
The new format can be selected from the xbrowse- format-list :



Best regards
Uwe :-)
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.
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Mon Apr 09, 2012 02:50 PM

Dear ukoenig,

Great Job. Looks perfect.
When will you release the LogoEdit Version 1.2.
Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Date/Time On Back Ground
Posted: Thu Apr 12, 2012 12:04 PM
Dear Riaz,

I finished testing the update.
It was a hard job, to get it working with all possible combinations like :

Logo oversized + time/date
image/No image
Border/No border
using date- or defined format ( month + weekday )
single/double-line .....

Now Your design is 100 % supported using different styles.
Just have to check if the Update should be placed in the
Toolsection or normal Forum.

Would it be possible for You, to do some testing if everything is OK ?
Just send me a Email and I will give You a Download-link.




Just to show the needed calculation, to get it working with any Font-combination :

Code (fw): Select all Collapse
// ---------- 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


Best Regards
Uwe :-)
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.
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Date/Time On Back Ground
Posted: Thu Apr 12, 2012 03:30 PM

Hi ukoenig,

Check your email....

Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan

Continue the discussion