Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - Displaying blank values
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Displaying blank values

 Post Reply Post Reply
Author
Message
esc67 View Drop Down
Newbie
Newbie


Joined: 09 June 2005
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote esc67 Quote  Post ReplyReply Direct Link To This Post Topic: Displaying blank values
    Posted: 09 June 2005 at 5:10pm

 

Here's a class to add "multi-select" to some simple grid items. It lets you display blank values when the data you are displaying have conflicting values.

class IMultiValue {
public:
 virtual bool IsMultiValue() = 0;
};

template <class GridItemClass>
class MultiSelect : public GridItemClass, public IMultiValue
{
public:
 MultiSelect(CString x):GridItemClass(x)
 {
  CXTPPropertyGridItem::SetValue("");
 }
 virtual void SetValue(CString strValue)
 {
  if (strValue.IsEmpty())
   CXTPPropertyGridItem::SetValue(strValue);
  else
   __super::SetValue(strValue);
 }
 virtual bool IsMultiValue()
 {
  return GetValue().IsEmpty();
 }
};

Usage:


CXTPPropertyGridItemBool* b = new MultiSelect<CXTPPropertyGridItemBool>(_T("BoolTest"));
myCategory->AddChildItem(b);

This class could be extended to have "addValue" and "resetValue" functions...

Is there a better way to do this? Has anybody else tried?

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.