Msgdate function error

Msgdate function error

Postby ADutheil » Sun May 27, 2012 2:50 pm

Hi Antonio,

This code
Code: Select all  Expand view
#include "fivewin.ch"

PROCEDURE main()
LOCAL dData, oGet

dData := msgDate()

RETURN


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

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Msgdate function error

Postby Antonio Linares » Mon May 28, 2012 12:40 pm

André,

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

Code: Select all  Expand view
  @ 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Msgdate function error

Postby nageswaragunupudi » Mon May 28, 2012 9: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: Select all  Expand view
  @ 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: Select all  Expand view
  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: Select all  Expand view
  @ 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 104 guests