Print Page | Close Window

Displaying blank values

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=2360
Printed Date: 27 November 2024 at 3:57pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Displaying blank values
Posted By: esc67
Subject: Displaying blank values
Date 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?




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net