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.
Subject |
Author |
Date |
|
Eddie Judson
|
Jan 8, 2007 - 6:08 PM
|
I have a compound property value in a property store that is specified below:
CExtPropertyValueCompound * pValueCompoundColorFill = new CExtPropertyValueCompound("Fill Color" ); pValueCompoundColorFill->DescriptionSet( _T("Specifies the fill color of the object") ); CExtGridCellColor * pColorCellCompoundFill = STATIC_DOWNCAST( CExtGridCellColor, pValueCompoundColorFill->ValueDefaultGetByRTC( RUNTIME_CLASS(CExtGridCellColor) ) ); pColorCellCompoundFill->m_PackedColor.SetColor(IsNoFill() ? COLORREF(-1) : GetFillColor() ); pColorCellCompoundFill->SetMode( CExtGridCellColor::eRGB ); pColorCellCompoundFill->m_bEnableButtonDefaultColor=true; pColorCellCompoundFill->m_sBtnTextColorDefault="No Fill"; pColorCellCompoundFill->m_clrDefault = COLORREF(-1);
When I click the No Fill button in the pop up color selection OnPgcInputComplete is not fired and when I extract the value from the property store (pColorCellCompoundFill->m_PackedColor.GetColor())the value is still the default color not COLORREF(-1)
Can you point me in the right direction.
Regards,
Eddie
|
|
Eddie Judson
|
Jan 13, 2007 - 4:14 PM
|
Thanks for your reply, I have done this and am getting the OnPgcInputComplete event, but how do I know that the "No Fill" button was pressed as I specifiy pColorCellCompoundFill->m_clrDefault = COLORREF(-1);
and in OnPgcInputComplete I have
CExtPropertyValueCompound * pCompound = DYNAMIC_DOWNCAST( CExtPropertyValueCompound, pPropertyItem ); CExtGridCell * pCellActiveValue = pCompound->ValueActiveGet(); ASSERT_VALID( pCellActiveValue ); CExtSafeString strPropertyName = pCompound->NameGet(); COLORREF testClr=COLORREF(-1); if( strPropertyName == "Fill Color" ) { CExtGridCellColor * pCell = STATIC_DOWNCAST( CExtGridCellColor, pCellActiveValue ); testClr= pCell->GetColor(); }
and testClr is coming out as white not COLORREF(-1)?
Regards, Eddie
|
|
Technical Support
|
Jan 15, 2007 - 1:11 PM
|
Yes, you are right. Our previous bug-fix was not complete. So we fixed this. We will upload 2.63.3 tomorrow. Please note now all the negative color values (i.e. COLORREF(-1L) ) are interpreted as invalid (empty). To detect whether the cell color is valid (not empty), use CExtGridCellColor::IsEmpty() .
|
|
Eddie Judson
|
Jan 18, 2007 - 3:20 AM
|
Thanks for your help, how to I download 2.63.3? Regards, Eddie
|
|
Technical Support
|
Jan 18, 2007 - 1:31 PM
|
|
|
Eddie Judson
|
Jan 22, 2007 - 11:31 PM
|
This now works correctly except now when I show the property grid and set the color with pColorCellCompoundFill->SetColor(IsNoFill() ? COLORREF(-1) : GetFillColor() ); I cannot choose the top left color in the picker which is black, any suggestions? Regards, Eddie
|
|
Technical Support
|
Jan 23, 2007 - 11:16 AM
|
The CExtGridCellColor::m_clrDefault property is initialized, by default, to COLORREF(-1L) . If you set it to a correct color value constructed using the RGB() preprocessor function, then you will should see it in the top color button of the color pop-up menu.
|
|
Eddie Judson
|
Jan 23, 2007 - 6:55 PM
|
Here is my code for setting the default color button
pColorCellCompoundFill->SetColor(IsNoFill() ? COLORREF(-1) : GetFillColor() ); pColorCellCompoundFill->SetMode( CExtGridCellColor::eRGB ); pColorCellCompoundFill->m_bEnableButtonDefaultColor=true; pColorCellCompoundFill->m_sBtnTextColorDefault="No Fill"; pColorCellCompoundFill->m_clrDefault = COLORREF(-1);
It is NOT the default color button that is not working it is the top left in this picture http://eddiejud.dnsalias.com/dotnetnuke/portals/0/notworking.gif
Regards, Eddie
|
|
Technical Support
|
Jan 25, 2007 - 7:05 AM
|
Please find the following code in the CExtGridCellColor::OnButtonPopupMenuTrack() method: if( nResultCmdID == 0 )
return true; and replace it with this if( nResultCmdID == 0
&& clrValueFinal == COLORREF( -1L )
)
return true; This should fix this. Thank you.
|
|
Technical Support
|
Jan 9, 2007 - 11:34 AM
|
Thank you for reporting the bug. We have just fixed it.
Please find the declaration of e_color_selection_t in the CExtPopupColorMenuWnd class and replace it with this: enum e_color_selection_t
{
__ECST_NONE = COLORREF( -1L ),
__ECST_BUTTON_CUSTOM = COLORREF( -2L ),
__ECST_BUTTON_DEFAULT = COLORREF( -3L ),
}; Update the CExtPopupColorMenuWnd::_OnMouseClick() method: bool CExtPopupColorMenuWnd::_OnMouseClick(
UINT nFlags,
CPoint point,
bool & bNoEat
)
{
ASSERT_VALID( this );
bNoEat;
if( GetSafeHwnd() == NULL )
return false;
if( GetSite().GetAnimated() != NULL )
return true;
TranslateMouseClickEventData_t _td( this, nFlags, point, bNoEat );
if( _td.Notify() )
{
bNoEat = _td.m_bNoEat;
return true;
}
bool bLButtonUpCall =
(nFlags==WM_LBUTTONUP || nFlags==WM_NCLBUTTONUP)
? true : false;
if( m_eCombineAlign != __CMBA_NONE
&& m_bTopLevel
)
{
CRect rcExcludeAreaTest( m_rcExcludeArea );
ScreenToClient( &rcExcludeAreaTest );
if( rcExcludeAreaTest.PtInRect( point ) )
{
if( !bLButtonUpCall )
{
_OnCancelMode();
return true;
}
return false;
} // if( rcExcludeAreaTest.PtInRect( point ) )
} // if( m_eCombineAlign != __CMBA_NONE ...
if( _IsTearOff() && CExtPopupMenuWnd::_HitTest(point) == IDX_TEAROFF )
{
if( ! bLButtonUpCall )
_DoTearOff();
return true;
}
if( ! bLButtonUpCall )
return false;
bool bEndSequence = false;
HWND hWndOwn = GetSafeHwnd();
ASSERT( hWndOwn != NULL && ::IsWindow(hWndOwn) );
int m_nColorIdxCurr = _ColorItemHitTest(point);
if( ( m_nColorIdxCurr >= 0
|| m_nColorIdxCurr == IDX_DEFAULT_COLOR_BTN
|| m_nColorIdxCurr == IDX_CUSTOM_COLOR_BTN
)
&& ( ! _FindCustomizeMode() )
)
{
bEndSequence = true;
_NotifyColorChanged( true );
g_SoundPlayer->PlaySound(
CExtSoundPlayer::__ON_MENU_CMD_CLICKED
);
}
if( ! ::IsWindow(hWndOwn) )
return true;
CPoint ptScreenClick( point );
ClientToScreen( &ptScreenClick );
HWND hWndFromPoint = ::WindowFromPoint( ptScreenClick );
if( hWndFromPoint != NULL
&& hWndFromPoint == m_pWndParentMenu->GetSafeHwnd()
)
{
m_pWndParentMenu->ScreenToClient( &ptScreenClick );
return
m_pWndParentMenu->_OnMouseClick(
nFlags,
ptScreenClick,
bNoEat
);
}
if( bEndSequence || ( ! bLButtonUpCall ) )
{
COLORREF clr = (COLORREF)__ECST_NONE;
switch( m_nColorIdxCurr )
{
case IDX_DEFAULT_COLOR_BTN:
clr = (COLORREF)__ECST_BUTTON_DEFAULT;
break;
case IDX_CUSTOM_COLOR_BTN:
clr = (COLORREF)__ECST_BUTTON_CUSTOM;
break;
default:
clr = _GetColorValue( m_nColorIdxCurr );
break;
}
_EndSequence( clr );
// _EndSequence( 0xFFFF );
}
return true;
}
Finally update the CExtGridCellColor::OnButtonPopupMenuTrack method and recompile the library.
bool CExtGridCellColor::OnButtonPopupMenuTrack(
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
if( _tcsi.m_nButtonType != INT(__EBTT_DROPDOWN) )
return CExtGridCellEx::OnButtonPopupMenuTrack( _tcsi );
// move focus and selection to the cell
if( _tcsi.m_nColType == 0 && _tcsi.m_nRowType == 0 )
{
CPoint ptFocusOld = _tcsi.m_wndGrid.FocusGet();
CPoint ptFocusDesired( _tcsi.m_nColNo, _tcsi.m_nRowNo );
CRect rcSelectionOld = _tcsi.m_wndGrid.SelectionGet( false, -1 );
CRect rcSelectionDesired( _tcsi.m_nColNo, _tcsi.m_nRowNo, _tcsi.m_nColNo, _tcsi.m_nRowNo );
DWORD dwSiwStyles = _tcsi.m_wndGrid.SiwGetStyle();
if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_ROWS )
{
LONG nColumnCount = _tcsi.m_wndGrid.ColumnCountGet();
rcSelectionDesired.SetRect( 0, _tcsi.m_nRowNo, nColumnCount - 1, _tcsi.m_nRowNo );
}
if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_COLUMNS )
{
LONG nRowCount = _tcsi.m_wndGrid.RowCountGet();
rcSelectionDesired.SetRect( _tcsi.m_nColNo, 0, nRowCount - 1, _tcsi.m_nColNo );
}
if( ptFocusDesired != ptFocusOld
|| rcSelectionOld != rcSelectionDesired
)
{
if( ptFocusDesired != ptFocusOld )
_tcsi.m_wndGrid.FocusSet( ptFocusDesired, true, true, false, false );
if( rcSelectionOld != rcSelectionDesired )
_tcsi.m_wndGrid.SelectionSet( rcSelectionDesired, true, false, false );
_tcsi.m_wndGrid.OnSwDoRedraw();
}
}
_tcsi.m_wndGrid.InvalidateRect( &_tcsi.m_rcCellExtra );
_tcsi.m_wndGrid.OnSwUpdateWindow();
CExtPopupColorMenuWnd * pPopup = new CExtPopupColorMenuWnd;
if( ! pPopup->CreatePopupMenu( _tcsi.m_wndGrid.GetSafeHwnd() ) )
{
ASSERT( FALSE );
return true;
}
pPopup->m_bEnableBtnColorDefault = false;
if( m_bEnableButtonDefaultColor )
{
pPopup->m_bEnableBtnColorDefault = true;
pPopup->m_clrDefault = m_clrDefault;
if( m_sBtnTextColorDefault != _T("") )
pPopup->m_sBtnTextColorDefault = m_sBtnTextColorDefault;
}
if( m_bEnableButtonRandomColor )
{
pPopup->m_bEnableBtnColorDefault = true;
pPopup->m_clrDefault = COLORREF( -100L );
if( m_sBtnTextColorRandom != _T("") )
pPopup->m_sBtnTextColorDefault = m_sBtnTextColorRandom;
}
if( m_bEnableButtonCustomColor )
{
pPopup->m_bEnableBtnColorCustom = true;
if( m_sBtnTextColorCustom != _T("") )
pPopup->m_sBtnTextColorCustom = m_sBtnTextColorCustom;
}
pPopup->m_clrInitial = (GetColor()&(~0xFF000000));
CRect wr( _tcsi.m_rcCell );
_tcsi.m_wndGrid.ClientToScreen( &wr );
CPoint ptTrack( wr.BottomRight() );
ptTrack.x +=
pPopup->OnQueryMenuShadowSize();
CRect rcExclude( ptTrack, ptTrack );
COLORREF clrValueFinal = COLORREF( CExtPopupColorMenuWnd::__ECST_NONE );
pPopup->m_pClrValueFinal = &clrValueFinal;
HWND hWndGrid = _tcsi.m_wndGrid.m_hWnd;
g_pCellMenuTracking = this;
UINT nResultCmdID = 0;
if( ! pPopup->TrackPopupMenu(
TPMX_RIGHTALIGN | TPMX_COMBINE_NONE | TPMX_DO_MESSAGE_LOOP,
ptTrack.x,
ptTrack.y,
&rcExclude,
this,
NULL,
&nResultCmdID,
true
)
)
{
g_pCellMenuTracking = NULL;
delete pPopup;
ASSERT( FALSE );
return true;
}
if( ! ::IsWindow( hWndGrid ) )
return true;
if( g_pCellMenuTracking == this )
g_pCellMenuTracking = NULL;
else if( g_pCellMenuTracking == NULL )
return true;
if( nResultCmdID == 0 )
return true;
if( nResultCmdID == CExtPopupColorMenuWnd::__ECST_BUTTON_DEFAULT )
{
SetColor( m_clrDefault, false );
}
else if( nResultCmdID == CExtPopupColorMenuWnd::__ECST_BUTTON_CUSTOM )
{
clrValueFinal = (GetColor()&(~0xFF000000));
#if (!defined __EXT_PROFUIS_STATIC_LINK || defined __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES)
CExtLocalResourceHelper _LRH;
CExtColorDlg dlg( clrValueFinal, clrValueFinal, &_tcsi.m_wndGrid );
if( dlg.DoModal() != IDOK )
return true;
clrValueFinal = dlg.m_clrNew;
#else
CColorDialog dlg( clrValueFinal, CC_FULLOPEN, &_tcsi.m_wndGrid );
if( dlg.DoModal() != IDOK )
return true;
clrValueFinal = dlg.m_cc.rgbResult;
#endif // #if (!defined __EXT_PROFUIS_STATIC_LINK || defined __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES)
SetColor( clrValueFinal, false );
}
else if( clrValueFinal == COLORREF( -100L ) )
{
SetRandomizedColor( 32, 244, 32, 244, 32, 244 );
}
else
SetColor( clrValueFinal, false );
_tcsi.m_wndGrid.InvalidateRect( &_tcsi.m_rcCellExtra );
_tcsi.m_wndGrid.OnGridCellInputComplete(
*this,
_tcsi.m_nColNo,
_tcsi.m_nRowNo,
_tcsi.m_nColType,
_tcsi.m_nRowType
);
return OnButtonPopupMenuComplete( _tcsi );
} That should fix the problem.
|
|