FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Msgdate function error
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Msgdate function error
Posted: Sun May 27, 2012 02:50 PM
Hi Antonio,

This code
Code (fw): Select all Collapse
#include "fivewin.ch"

PROCEDURE main()
LOCAL dData, oGet

dData := msgDate() 

RETURN


results in a shifted list of days of the calendar
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Msgdate function error
Posted: Mon May 28, 2012 12:40 PM
André,

Please try this change in function MsgDate() in source\function\msgmeter.prg in line 59:

Code (fw): Select all Collapse
   @ 0.8, 0 SAY "  " + SubStr( CDow( dDate - Dow( dDate ) + 2 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 3 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 4 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 5 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 6 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 7 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate - Dow( dDate ) + 8 ), 1, 3 ) COLOR CLR_HRED
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Msgdate function error
Posted: Mon May 28, 2012 09:54 PM
Display of week-day names is starting with the week-day of dDate. dDate is the first parameter to the function, which defaults to Date(). So the display of header changes based on the value of dDate.

One solution would be to move the block of code:
Code (fw): Select all Collapse
   @ 0.8, 0 SAY "  " + SubStr( CDow( dDate ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 1 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 2 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 3 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 4 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 5 ), 1, 3 ) + "   " + ;
                       SubStr( CDow( dDate + 6 ), 1, 3 ) COLOR CLR_HRED

next to this code:
Code (fw): Select all Collapse
   dDate -= Day( dDate ) - 1
   while DoW( dDate ) != 2 // Monday
      dDate --
   enddo


Alternatively this code for the header can be used instead of the original code:
Code (fw): Select all Collapse
   @ 0.8, 0 SAY "  " + Left( NToCDow( 2 ), 3 ) + "   " + ;
                       Left( NToCDow( 3 ), 3 ) + "   " + ;
                       Left( NToCDow( 4 ), 3 ) + "   " + ;
                       Left( NToCDow( 5 ), 3 ) + "   " + ;
                       Left( NToCDow( 6 ), 3 ) + "   " + ;
                       Left( NToCDow( 7 ), 3 ) + "   " + ;
                       Left( NToCDow( 1 ), 3 ) COLOR CLR_HRED
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion