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 -suppress seconds and extra space Collapse All
Subject Author Date
Philip Robinson Jan 21, 2008 - 9:02 PM

I have two questions here, both regarding CExtDateTimeWnd:

1. How do I suppress the seconds field in the edit control? My requirements ask for format like hh:mm


2. After hiding the "Today" and "None" buttons in the dropdown calendar, how do I get rid of the space they vacated?

Thanks.

Technical Support Jan 25, 2008 - 2:39 AM

1. You can use the CExtDurationWnd::SetShowItem() method which shows/hides the specified field in the date time control.

pDateTime->SetShowItem( CExtDurationWnd::second, false );
2. It seems you found a bug. Thank you. To fix it, please update the following method:
bool CExtDateTimeWnd::OnShowDropDownMenu()
{
            ASSERT_VALID( this );

            VERIFY( _UpdateDurationFromOleDateTime( true ) );

DWORD dwDatePickerStyle = OnDropDownCalendarQueryStyle();

CExtPopupDatePickerMenuWnd * pPopup = 
                        new CExtPopupDatePickerMenuWnd( 
                                   0L,
                                   CSize(1,1),
                                   WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
                                   dwDatePickerStyle
                                   );
            if( !pPopup->CreatePopupMenu( GetSafeHwnd() ) )
            {
                        ASSERT( FALSE );
                        delete pPopup;
                        return false;
            }
            
CRect rcClient;
            GetClientRect( &rcClient );
            ClientToScreen( &rcClient );
            
CPoint ptTrack(
                        rcClient.right, 
                        rcClient.bottom
                        );
            ptTrack.x += 
                        pPopup->OnQueryMenuShadowSize();

CRect rcExclude( ptTrack, ptTrack );
            if(         ! pPopup->TrackPopupMenu(
                                   TPMX_RIGHTALIGN,
                                   ptTrack.x, 
                                   ptTrack.y,
                                   rcExclude,
                                   this,
                                   NULL,
                                   NULL,
                                   true
                                   ) 
                        )
            {
                        ASSERT( FALSE );
                        delete pPopup;
                        return false;
            }
            return true;
}