I have a very strange behaviour of a get object.
The date doesn't fire it's bChange code if editing is made by hand. If the get is changed by action button the bChange block works okay.
I don't find an explanation or solution for this.
Here my code:
rc file
- Code: Select all Expand view
- #include <windows.h>
#include <commctrl.h>
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
1 24 "WindowsXP.Manifest"
DATE_DLG DIALOG DISCARDABLE 6, 18, 158, 70
STYLE WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE
CAPTION "Dialog"
FONT 10, "MS Sans Serif"
{
CONTROL "Date", -1, "Static", WS_GROUP, 8, 12, 24, 9
CONTROL "", 10, "Edit", ES_CENTER|WS_BORDER|WS_TABSTOP, 8, 24, 54, 11, WS_EX_RIGHT|0x00010000
CONTROL "Statistic-Month-Year", -1, "Static", WS_GROUP, 76, 12, 64, 9
CONTROL "", 20, "Edit", ES_AUTOHSCROLL|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 76, 24, 24, 11
CONTROL "", 30, "Edit", ES_CENTER|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 108, 24, 40, 11
CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 100, 48, 48, 14
}
prg file
- Code: Select all Expand view
- #include "FiveWin.ch"
FUNCTION Main()
//-------------
LOCAL oDlG, oDate, oStatMonth, oStatYear, oBtn
LOCAL hData := { => }
Set( _SET_EPOCH, 1990 )
Set( _SET_DATEFORMAT, "dd.mm.yyyy" )
hData[ "date" ] := date()
hData[ "stat_month" ] := month( date() )
hData[ "stat_year" ] := year( date() )
DEFINE DIALOG oDlg NAME "DATE_DLG"
REDEFINE GET oDate VAR hData[ "date" ];
ID 10 OF oDlg PICTURE "@D";
BITMAP "" ;
UPDATE ;
ACTION ( hData[ "date" ] := dGetCal() ,;
oDate:Refresh() ,;
hData[ "stat_month" ] := month( hData[ "date" ] ),;
hData[ "stat_year" ] := year( hData[ "date" ] ),;
oStatMonth:Refresh(), oStatYear:Refresh() ,;
oDate:SetFocus();
);
ON CHANGE (;
hData[ "stat_month" ] := month( hData[ "date" ] ),;
hData[ "stat_year" ] := year( hData[ "date" ] ),;
oStatMonth:Refresh(), oStatYear:Refresh() ,;
)
REDEFINE GET oStatMonth VAR hData[ "stat_month" ];
ID 20 OF oDlg PICTURE "99";
SPINNER MIN 1 MAX 12 ;
UPDATE
REDEFINE GET oStatYear VAR hData[ "stat_year" ];
ID 30 OF oDlg PICTURE "9999";
SPINNER MIN ( year( date() ) - 20 );
MAX ( year( date() ) + 20 );
UPDATE
REDEFINE BUTTON oBtn ID IDCANCEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
STATIC FUNCTION dGetCal()
//-----------------------
RETURN( ctod( "24.12.2008" ) )
Could please, anyone help me?
Thanks, -Detlef