Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtDateTimeWnd Collapse All
Subject Author Date
Eddie Judson Jul 9, 2005 - 8:03 PM

While upgrading my application grid to use prof-uis I used to use a
CDateTimeCtrl  m_OLDdtPicker;
I changed it over to
CExtDateTimeWnd m_dtPicker;


When I inistialise my grid the old picker worked fine with
  RECT rcMin;
  rcMin.left=0;
  rcMin.right=120;
  rcMin.top=0;
  rcMin.bottom=18;
  this-> m_OLDdtPicker.Create( WS_CHILD | WS_VISIBLE |  MCS_NOTODAY,rcMin,this,IDC_GRIDCAL);


But when I upgrade it to


  
  RECT rcMin;
  rcMin.left=0;
  rcMin.right=120;
  rcMin.top=0;
  rcMin.bottom=18;


  this->m_dtPicker.Create(this,rcMin,IDC_GRIDCAL,0x56010000);


0x56010000 = the same style that is in the sample application


the CExtDateTimeWnd fails on the create method, stepping into the create method it failes on


HWND hWnd = ::CreateWindowEx(cs.dwExStyle, cs.lpszClass,
   cs.lpszName, cs.style, cs.x, cs.y, cs.cx, cs.cy,
   cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams);


With paramaters


 cs.dwExStyle 0 unsigned long
+ cs.lpszClass 0x00bcceac "ProfUIS-DurationWnd" const char *
+ cs.lpszName 0x00000000 <Bad Ptr> const char *
 cs.style 1442906112 long
 cs.x 0 int
 cs.y 0 int
 cs.cx 120 int
 cs.cy 18 int
+ cs.hwndParent 0x00060fce {unused=??? } HWND__ *
+ cs.hMenu 0x00000349 {unused=??? } HMENU__ *
+ cs.hInstance 0x00400000 {unused=9460301 } HINSTANCE__ *
 cs.lpCreateParams 0x00000000 void *


Thanks for the help!
Regards,
   Eddie

Technical Support Jul 11, 2005 - 8:27 AM

Thank you for the bug report. We fixed it and sent you the updated code by e-mail.

If someone else encounters this problem and does not want to wait for the next release, they can fix this bug themselves:

1. At the end of the CExtDurationWnd::Create method, insert a call to the UpdateDurationWnd( false ) method:
bool CExtDurationWnd::Create(

    CWnd * pParentWnd,

    const RECT & rcWnd,

    UINT nDlgCtrlID,

    DWORD dwWindowStyle,

    CCreateContext * pContext

    )

{

    ASSERT_VALID( this );

        ...

        ...

        ...

    m_bInitialized = true;

    UpdateDurationWnd( false );

    return true;

}
2. Modify the CExtDurationWnd::UpdateDurationWnd method in this way:
void CExtDurationWnd::UpdateDurationWnd(

    bool bUpdate // = false

    )

{

    ASSERT_VALID( this );

    if(     GetSafeHwnd() == NULL

        ||  ( ! ::IsWindow( m_hWnd ) )

        ||  ( !m_bInitialized )

        )

        return;

    _RecalcDuration(); // should be before _RecalcLayout() !!!

    _RecalcLayout();

    Invalidate();

    m_wndDropDown.Invalidate();

    m_wndSpin.Invalidate();

    if(     bUpdate

        &&  (GetStyle() & WS_VISIBLE) != 0

        )

        UpdateWindow();

}
3. Recompile the library.

Eddie Judson Jul 12, 2005 - 8:43 AM

Thanks that fixed it, but I have a new problem I am linking against ProfUIS240smd.lib and when I call
this->m_dtPicker.SetDate(ThisDate.GetYear(),ThisDate.GetYear(),ThisDate.GetDay());


the linker is reporting error:


unresolved external symbol public: int __thiscall CExtDateTimeWnd::SetDate(int,int,int)


if I remove the AFX_INLINE statement before the method declaration and recomplie the library it seems to work fine.  Do I need the AFX_INLINE statement before the declaration or is it ok to remove it?

Technical Support Jul 12, 2005 - 10:35 AM

MFC’s AFX_INLINE declaration is just a C++ inline statement. It typically saves the overhead on function calls (including parameter passing and placing the object’s address on the stack). You can freely remove this statement without any troubles, but we think that you should just rebuild the library, because you problem may be caused by mismatches in the OBJ module between the CExtDateTimeWnd header and source files.