DatePicker shows incorrect date ( month ) FWH 2004
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
DatePicker shows incorrect date ( month ) FWH 2004
Antonio
Just noticed that the date-picker control with FWH 2004 is not representing the month correct as seen in the database table ( ms access ).. see attached pic invoice 32165
The database table is correct but the date-picker control shows 00 for the month. I went back to a saved version of the same code compiled with FWH 1906 and the date-picker works just fine ..
Thanks
Rick Lipkin
Just noticed that the date-picker control with FWH 2004 is not representing the month correct as seen in the database table ( ms access ).. see attached pic invoice 32165
The database table is correct but the date-picker control shows 00 for the month. I went back to a saved version of the same code compiled with FWH 1906 and the date-picker works just fine ..
Thanks
Rick Lipkin
Last edited by Rick Lipkin on Thu Jun 04, 2020 4:45 pm, edited 4 times in total.
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: DatePicker shows incorrect date ( month ) FWH 2004
Hi Rick,
Try setting the computers date format (in the regional settings) to "mm/dd/yyyy" and see if that helps. Most likely it is currently set to "mmm/dd/yyyy"
Try setting the computers date format (in the regional settings) to "mm/dd/yyyy" and see if that helps. Most likely it is currently set to "mmm/dd/yyyy"
Thanks,
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
Jeff Barnes
(FWH 12.01, xHarbour 1.2.1, Bcc582)
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: DatePicker shows incorrect date ( month ) FWH 2004
Jeff
Thank you for your suggestion ... I just upgraded to FWH 2004 .. I went back to an older saved version of the same code that was compiled with 1906 and the datepicker control works as expected .. same computer .. just an older version of FWH.
Rick Lipkin
Thank you for your suggestion ... I just upgraded to FWH 2004 .. I went back to an older saved version of the same code that was compiled with 1906 and the datepicker control works as expected .. same computer .. just an older version of FWH.
Rick Lipkin
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: DatePicker shows incorrect date ( month ) FWH 2004
Can you please post some sample code that we can test on 1906 and 2004 and see at our end?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: DatePicker shows incorrect date ( month ) FWH 2004
Rao
Here is the sample AdoRick.prg that has been modified with a date picker ... here is the code :
Here is AdoRick.rc ..
Here is the sample AdoRick.prg that has been modified with a date picker ... here is the code :
Code: Select all
// Incremental Search
// adorick.prg
#include "FiveWin.ch"
#Include "Xbrowse.ch"
#include "dtpicker.ch"
STATIC oWnd,oBar,lOK,lOk1,oWndChild,oLbx
STATIC cLname,oLname,oFname,cFname,oFontB
Static dDatePur,oDatePur
//-------------
Func Main()
Local catNewDB,cFile,aDir,dExe,cDefa,mStart
Local oCn,cSql,oErr,oRsCust,cLOGIN,Saying,xLogin,cRights
Local cTitle,oButt1,oButt2,nYear,nScr1,nScr2,xMessage,cRdd
PUBLIC xCONNECT,xSource,xProvider
lOK := .F.
//-- get timestamp on .exe //
cFILE := GetModuleFileName( GetInstance() )
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
// where .exe started from is default directory //
mSTART := RAT( "\", cFILE )
cDEFA := SUBSTR(cFILE,1,mSTART-1)
aDIR := NIL
SET DEFA to ( cDEFA )
SET DELETED on
SET CENTURY on
SET 3DLOOK on
nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )
REQUEST DBFCDX
rddsetdefault ( "DBFCDX" )
nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)
xPROVIDER := "Microsoft.Jet.OLEDB.4.0"
xSOURCE := cDEFA+"\Rick.mdb"
cRDD := xPROVIDER+" -- "+xSOURCE
// global connection string
xCONNECT := 'Provider='+xPROVIDER+';Data Source='+xSOURCE
If .not. File( cDefa+"\Rick.mdb" )
Ferase( cDefa+"\Rick.mdb" )
// create the adox object
Try
catNewDB := CreateObject("ADOX.Catalog")
Catch
MsgInfo( "Could not Create ADOX object")
Return(.f.)
End try
// create the table Rick.mdb
Try
catNewDB:Create('Provider='+xProvider+';Data Source='+xSource+';Jet OLEDB:Engine Type=5' )
Catch
MsgInfo( "Could not create the table "+xSource )
Return(.f.)
End Try
Try
oCn := CREATEOBJECT( "ADODB.Connection" )
Catch
MsgInfo( "Could not create the ADO object for connection")
End Try
TRY
oCn:Open( xCONNECT )
CATCH oErr
MsgInfo( "Could not open a Connection to Database "+xSource )
RETURN(.F.)
END TRY
cSQL := "CREATE TABLE CUSTOMER"
cSQL += "( "
cSQL += "[CUSTOMEREID] char(18) NOT NULL, "
cSQL += "[LAST NAME] char(30) NULL, "
cSQL += "[FIRST NAME] char(30) NULL, "
cSQL += "[MID INIT] char(30) NULL, "
cSQL += "[ADDRESS1] char(30) NULL, "
cSQL += "[CITY] char(30) NULL, "
cSQL += "[STATE] char(30) NULL, "
cSql += "[MEMO] LONGBINARY NULL,"
cSql += "[DATEPUR] DateTime NULL, "
cSQL += "CONSTRAINT PK_USERINFO PRIMARY KEY ( CUSTOMEREID )"
cSQL += " )"
Try
oCn:Execute( cSQL )
Catch
MsgInfo( "Table CUSTOMER Failed" )
Return(.f.)
End try
oCn:Close()
oCn := nil
Endif
xLOGIN := UPPER( WNetGetuser() )+space(8) // fivewin
xLOGIN := SUBSTR(xLOGIN,1,8)
oRsCust := TOleAuto():New( "ADODB.Recordset" )
oRsCust:CursorType := 1 // opendkeyset
oRsCust:CursorLocation := 3 // local cache
oRsCust:LockType := 3 // lockoportunistic
// check for very first user
cSQL := "SELECT * FROM CUSTOMER"
TRY
oRsCust:Open( cSQL, xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening CUSTOMER table here" )
RETURN(.F.)
END TRY
If oRsCust:eof
oRsCust:AddNew()
oRsCust:Fields("CustomerEid"):Value := "011111111111111111"
oRsCust:Fields("Last Name"):Value := "Lipkin"
oRsCust:Fields("First Name"):Value := "Richard"
oRsCust:Fields("Mid Init"):Value := "M"
oRsCust:Fields("Address1"):Value := "123 Anywhere"
oRsCust:Fields("City"):Value := "Columbia"
oRsCust:Fields("State"):Value := "SC"
oRsCust:Fields("DatePur"):Value := Date()
oRsCust:Update()
oRsCust:AddNew()
oRsCust:Fields("CustomerEid"):Value := "011111111111111112"
oRsCust:Fields("Last Name"):Value := "Lipinsky"
oRsCust:Fields("First Name"):Value := "Jason"
oRsCust:Fields("Mid Init"):Value := "S"
oRsCust:Fields("Address1"):Value := "123 Arborgate"
oRsCust:Fields("City"):Value := "Columbia"
oRsCust:Fields("State"):Value := "SC"
oRsCust:Fields("DatePur"):Value := Date()
oRsCust:Update()
oRsCust:AddNew()
oRsCust:Fields("CustomerEid"):Value := "011111111111111113"
oRsCust:Fields("Last Name"):Value := "Lipkin"
oRsCust:Fields("First Name"):Value := "Beth"
oRsCust:Fields("Mid Init"):Value := " "
oRsCust:Fields("Address1"):Value := "123 Lake Murray Blvd"
oRsCust:Fields("City"):Value := "Lexington"
oRsCust:Fields("State"):Value := "SC"
oRsCust:Fields("DatePur"):Value := Date()
oRsCust:Update()
oRsCust:AddNew()
oRsCust:Fields("CustomerEid"):Value := "011111111111111114"
oRsCust:Fields("Last Name"):Value := "Lizzarous"
oRsCust:Fields("First Name"):Value := "Tim"
oRsCust:Fields("Mid Init"):Value := "J"
oRsCust:Fields("Address1"):Value := "456 Broad River"
oRsCust:Fields("City"):Value := "Irmo"
oRsCust:Fields("State"):Value := "SC"
oRsCust:Fields("DatePur"):Value := Date()
oRsCust:Update()
Endif
oFontB := TFont():New("Ms Sans Serif",,-6,.F.,.T. ,,,,.F. )
cRIGHTS := "(RWS)"
xMESSAGE := "User "+xLOGIN+" Rights "+cRIGHTS+ ;
" Default= "+cDEFA+" Rdd= "+cRDD+ ;
" Revision "+DTOC(dEXE)+;
" -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)
cTitle := "Test Incremental Search with ON CHANGE"
DEFINE WINDOW oWnd ;
TITLE cTITLE ;
MENU _BuildMenu();
MDI
DEFINE BUTTONBAR oBar OF oWnd SIZE 65,70 3DLOOK 2007
oBar:SetColor(0)
DEFINE BUTTON oButt1 OF oBar ;
MESSAGE "Customer Information" ;
ACTION _Custview( "A",oWnd,oButt1,oButt2 ) ;
PROMPT "Customer Info"
DEFINE BUTTON oButt2 OF oBar ;
MESSAGE "Close Application" ;
ACTION ( oWnd:End() ) ;
PROMPT "Quit"
SET MESSAGE OF oWnd ;
to xMESSAGE CLOCK 2007
ACTIVATE WINDOW oWnd MAXIMIZED ;
VALID ( IIF( !lOK, _ExitPgm(.T.), .F. ))
RETURN( NIL )
//---------------------------
Static FUNCTION _BuildMenu()
LOCAL oMENU, cDEFA
cDEFA := SET(7)
MENU oMenu 2007
menuitem "Login..." ;
MENUITEM "&About..."
MENUITEM "&Quit" ;
MESSAGE "Close this program";
ACTION oWND:END()
ENDMENU
RETURN( oMenu )
//-----------------------
Static FUNCTION _ExitPgm( lCLEAN )
LOCAL lOK3
lOK3 := .F.
IF lCLEAN = .T.
lOK3 := .T.
lOK := .T.
SET RESOURCES to
ENDIF
RETURN( lOK3 )
//-------------------------------
Static FUNC _Custview( cMODE,oWnd,oBtn1,oBtn2 )
LOCAL SAYING,cDEFA
LOCAL cTITLE
LOCAL oIco,oFld,oCust
LOCAL oRsCust,cSql
lOK1 := .F.
cSQL := "SELECT * from CUSTOMER order by [Last Name]"
oRsCust := TOleAuto():New( "ADODB.Recordset" )
oRsCust:CursorType := 1 // opendkeyset
oRsCust:CursorLocation := 3 // local cache
oRsCust:LockType := 3 // lockoportunistic
TRY
oRsCust:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening CUSTOMER table" )
RETURN(.F.)
END TRY
SysReFresh()
cTITLE := "Customer Maintenance"
DO CASE
CASE cMODE = "E"
cTITLE := "Customer Maintenance EDIT"
CASE cMODE = "A"
cTITLE := "Customer Maintenance ADD"
CASE cMODE = "V"
cTITLE := "Customer Maintenance VIEW"
ENDCASE
oBtn1:Disable()
oBtn2:Disable()
DEFINE WINDOW oWndChild ;
MDICHILD ;
FROM 0,0 to 32,100 ;
OF oWnd ;
TITLE cTITLE
DEFINE DIALOG oCust RESOURCE "CUSTOMER" of oWndChild
REDEFINE FOLDEREX oFld ID 109 of oCust PROMPT "Billing Information", "Service Address";
DIALOGS "CUSTVIEW", "SERVVIEW"
_Folder_1( cMode, oWnd, oRsCust, oFld ) // Custview folder
ACTIVATE DIALOG oCust NOWAIT ;
ON INIT ( oCust:Move( 0, 0 ));
VALID(!GETKEYSTATE( 27 ))
ACTIVATE WINDOW oWndChild ;
ON INIT oWndChild:SetSize( oCust:nWidth, oCust:nHeight, .T. );
VALID ( IIF( !lOK1, _ExitPgm1(.T.,oWndChild,oRsCust,oBtn1,oBtn2), .F. ))
RETURN( NIL )
// ---------- FOLDER-PAGE 1
Static FUNC _Folder_1( cMode, oWnd, oRsCust, oFld )
Local oSay1,oSay2,oSay3,oSay4,oSay5
cLname := space(50)
cFname := space(50)
dDatePur := if(empty(oRsCust:Fields("datePur"):Value), Date(),;
_TtoDate(oRsCust:Fields("datePur"):Value ))
REDEFINE SAY oSay1 PROMPT "Customer Type" ID 110 OF oFld:aDialogs[1] UPDATE
oSay1:SetFont( oFontB )
REDEFINE SAY oSay2 PROMPT "Customer Id" ID 111 OF oFld:aDialogs[1] UPDATE
oSay2:SetFont( oFontB )
REDEFINE SAY oSay3 PROMPT "Company or Last Name" ID 112 OF oFld:aDialogs[1] UPDATE
oSay3:SetFont( oFontB )
REDEFINE SAY oSay4 PROMPT "First Name" ID 113 OF oFld:aDialogs[1] UPDATE
oSay4:SetFont( oFontB )
REDEFINE SAY oSay5 PROMPT "Date Purchased" ID 163 OF oFld:aDialogs[1] UPDATE
oSay4:SetFont( oFontB )
REDEFINE GET oLname var cLname ID 153 of oFld:aDialogs[1] ;
ON CHANGE ( _Isearch( oLname, cLname, oLbx, oRsCust )) UPDATE
REDEFINE GET oFname var cFname ID 154 of oFld:aDialogs[1] UPDATE
REDEFINE DTPICKER oDatePur VAR dDatePur ID 164 OF oFld:aDialogs[1] PICTURE '@D' UPDATE // ;
* When cMode <> "V" UPDATE
REDEFINE xBROWSE oLBX ;
RECORDSET oRsCust ;
COLUMNS "CUSTOMEREID" ;
COLSIZES 50 ;
HEADERS "Cust Id" ;
ID 172 of oFld:aDialogs[1] ;
AUTOCOLS LINES
ADD oCol TO oLbx AT 1 DATA {|x| x := _ChkName(oRsCust:Fields("Last Name"):Value,;
oRsCust:Fields("First Name"):Value,;
oRsCust:Fields("Mid Init"):Value) };
HEADER "Last Name or Company" size 190
ADD oCol TO oLbx AT 2 DATA {|x| x := _ChkAdd(oRsCust:Fields("Address1"):Value,;
oRsCust:Fields("City"):Value,;
oRsCust:Fields("State"):Value) };
HEADER "Address" size 200
RETURN( nil )
//--------------------------
Static Function _TtoDate( tDate )
If empty( tDate)
Return( ctod("00/00/00"))
Endif
If ValType( tDate ) = "D"
Return(tDate )
Endif
Return( stod( substr( ttos( tDate ), 1, 8 ) ))
//----------------------------
Static Func _ChkName( cLast,cFirst,cMiddle )
Local cName
cName := substr("Unk"+space(45),1,45)
If cMiddle = " "
If cFirst = " " .or. empty( cFirst )
cName = substr( alltrim( cLast)+space(45),1,45)
Else
cName := substr(alltrim(cLast)+", "+alltrim(cFirst)+space(45),1,45)
Endif
Else
If cFirst = " " .or. empty( cFirst )
cName = substr( alltrim( cLast)+space(45),1,45)
Else
cName := substr(alltrim(cLast)+", "+alltrim(cFirst)+" "+;
alltrim(cMiddle)+space(45),1,45)
Endif
Endif
Return( cName )
//-------------------------------
Static Func _ChkAdd( cAddress, cCity, cState )
LOCAL cName
cName := if( cAddress = " " .or. empty( cAddress ), " ", alltrim( cAddress ))+" "+;
if( cCity = " " .or. empty( cCity), " ", alltrim(cCity))+" "+;
if( cState = " " .or. empty( cState), " ", alltrim(cState))
cName := substr( alltrim( cName ) +space(45),1,45)
Return( cName )
//-------------
Static Func _Isearch( oLname1, cLname1, oBrw, oRsCust )
cLname1 = Alltrim( oLName1:GetText() )
if Empty( cLname1 )
return .T.
endif
oRsCust:Filter := "[Last Name] like '"+cLname1+"%'"
oBrw:ReFresh()
Return .T.
//-------------------------------
Static FUNCTION _ExitPgm1( lCLEAN,oWndchild,oRsCust,oBtn1,oBtn2 )
LOCAL cDEFA, lOK3
cDEFA := SET(7)
IF lCLEAN = .T.
lOK1 := .T.
oRsCust:CLose()
oWndChild:End()
oBtn1:Enable()
oBtn2:Enable()
ENDIF
RETURN( lOK1 )
// -- end
Code: Select all
// Generated by ResEdit 1.6.6
// Copyright (C) 2006-2015
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
//#include "resource.h"
#ifndef WC_STATIC
#define WC_STATIC L"Static"
#endif
#ifndef MONTHCAL_CLASS
#define MONTHCAL_CLASS "SysMonthCal32"
#endif
#ifndef DATETIMEPICK_CLASS
#define DATETIMEPICK_CLASS "SysDateTimePick32"
#endif
//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
CUSTOMER DIALOG 3, 13, 538, 356
STYLE DS_SETFONT | WS_CHILDWINDOW
FONT 8, "Arial"
{
CONTROL "", 109, "TFolderex", 0x50010000, 3, 4, 524, 308, 0x00000000
}
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
CUSTVIEW DIALOG 12, 11, 513, 311
STYLE DS_SETFONT | WS_CHILDWINDOW
FONT 6, "MS Sans Serif"
{
LTEXT "Date Purchased", 163, 16, 103, 81, 12, SS_LEFT | SS_NOPREFIX, WS_EX_LEFT
CONTROL "", 164, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_SHOWNONE, 101, 101, 83, 13, WS_EX_LEFT
LTEXT "Customer Type", 110, 8, 8, 37, 22, SS_LEFT | SS_NOPREFIX, WS_EX_LEFT
AUTORADIOBUTTON " Individual ", 150, 46, 10, 63, 12, 0, WS_EX_LEFT
AUTORADIOBUTTON " Commercial", 151, 46, 24, 63, 12, 0, WS_EX_LEFT
CTEXT "Customer Id", 111, 112, 11, 94, 10, WS_BORDER | SS_CENTER | SS_NOPREFIX, WS_EX_LEFT
EDITTEXT 152, 112, 23, 94, 12, NOT WS_TABSTOP | ES_AUTOHSCROLL, WS_EX_LEFT
LTEXT "Company or Last Name", 112, 7, 39, 105, 10, SS_LEFT | SS_NOPREFIX, WS_EX_LEFT
LTEXT "First Name", 113, 119, 39, 73, 10, SS_LEFT | SS_NOPREFIX, WS_EX_LEFT
EDITTEXT 153, 7, 50, 105, 12, ES_AUTOHSCROLL, WS_EX_LEFT
EDITTEXT 154, 117, 50, 76, 12, ES_AUTOHSCROLL, WS_EX_LEFT
GROUPBOX "", 196, 2, 4294967294, 213, 304, 0, WS_EX_LEFT
CONTROL "Customer Info", 172, "TXBrowse", 0x50A10000, 221, 1, 290, 215, 0x00000000
}
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
SERVVIEW DIALOG 12, 11, 436, 311
STYLE DS_SETFONT | WS_CHILDWINDOW
FONT 6, "MS Sans Serif"
{
LTEXT "Company or Last Name", -1, 24, 58, 105, 10, SS_LEFT | SS_NOPREFIX, WS_EX_LEFT
EDITTEXT 120, 24, 70, 105, 12, ES_AUTOHSCROLL, WS_EX_LEFT
}
When compiled with FWH2004 and xHarbour .. run the program .. click on Customer Info and look at the Date Purchased Date picker .. you will notice the month = 00
[URL=http://img4.imagetitan.com/img.php?image=22_adorick1.jpg][img]http://img4.imagetitan.com/img4/small/22/22_adorick1.jpg[/img][/URL]
Thanks
Rick Lipkin
ps .. FYI looks like if you take off the date picker PICTURE '@D' clause the DatePicker displays the correct month .. don't know if the Picture clause is a function of xHarbour ( build 20200311 ) or FWH ..
Re: DatePicker shows incorrect date ( month ) FWH 2004
Rick, I confirm problem with clause PICTURE and Windows 10 20.04 / Fwh 20.04
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: DatePicker shows incorrect date ( month ) FWH 2004
Please apply the following fix in tdtpicke.prg.
Locate the following lines in the METHOD formatdate()
Please change the second line as:
Locate the following lines in the METHOD formatdate()
Code: Select all
if cFmt == '@d'
cFmt = Lower( Set( _SET_DATEFORMAT ) )
Code: Select all
if cFmt == '@d'
cFmt = StrTran( Lower( Set( _SET_DATEFORMAT ) ), "m", "M" )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: DatePicker shows incorrect date ( month ) FWH 2004
fwh.h is in \fwh\include folder.
If you are using xmate, please include this in the include path in C Complier section.
If you are using xmate, please include this in the include path in C Complier section.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: DatePicker shows incorrect date ( month ) FWH 2004
Rao
I put the file fwh.h in C:\Borland\BCC74\include\windows directory .. my xMate compiler info is set to that folder .. I was able to re-compile with the modified tdpicke.prg and your suggestions fixed the Date-picker control.
You can definitely add this fix to the next FWH Release.
Thanks
Rick Lipkin
I put the file fwh.h in C:\Borland\BCC74\include\windows directory .. my xMate compiler info is set to that folder .. I was able to re-compile with the modified tdpicke.prg and your suggestions fixed the Date-picker control.
You can definitely add this fix to the next FWH Release.
Thanks
Rick Lipkin