Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - Multiple line GridItem text?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple line GridItem text?

 Post Reply Post Reply
Author
Message
CGrant View Drop Down
Newbie
Newbie
Avatar

Joined: 30 May 2005
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote CGrant Quote  Post ReplyReply Direct Link To This Post Topic: Multiple line GridItem text?
    Posted: 30 May 2005 at 4:49pm

I've been looking for a way to add a textual grid item that has more than one line of text - e.g. an address or a user's short free format comment.

Any pointers would be appreciated

Colin

Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2005 at 7:30am
I've been using the PropertyGrid for a while, and I'm 99% sure there's no way to do this.  I suggest submitting a feature request to Codejock.
Back to Top
CGrant View Drop Down
Newbie
Newbie
Avatar

Joined: 30 May 2005
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote CGrant Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2005 at 11:04am

Thanks, I thought that was the case.

I'm waiting to find out if it is an absolute requirement for my project or not. If it is then I'll look to see if there is a way to subclass and owner draw but it sounds like more effort than its worth.

Colin

 

Back to Top
CGrant View Drop Down
Newbie
Newbie
Avatar

Joined: 30 May 2005
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote CGrant Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2005 at 5:42pm

I have managed to display multiline text, though editing it still lies ahead.

Basically the code uses owner draw variable height and a class especially for the multi line text.

The property grid creation has to specify the style...


if ( m_wndPropertyGrid.Create( rc, this, IDC_PROPERTY_GRID, LBS_OWNERDRAWVARIABLE ) )

Then adding a property uses a new class


CXTPPropertyGridItem* pSettings = m_wndPropertyGrid.AddCategory(_T("Example"));
strTesting = "Hello\nWorld";
(void)pSettings->AddChildItem(new CMultilineTextGridItem(_T("TESTING"), strTesting, &strTesting));

The class does the minimum possible to get text up (all comments removed for brevity)


class CMultilineTextGridItem : public CXTPPropertyGridItem 
{
public:
    CMultilineTextGridItem(CString strCaption, LPCTSTR strValue = NULL, CString* pBindString = NULL);
     virtual ~CMultilineTextGridItem();
     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
     virtual BOOL OnDrawItemValue(CDC& dc, CRect rcValue);
};

The implementation is short too


CMultilineTextGridItem::CMultilineTextGridItem(CString strCaption, LPCTSTR strValue, CString* pBindString)
:CXTPPropertyGridItem(strCaption, strValue, pBindString)
{
    // do nothing
}

CMultilineTextGridItem::~CMultilineTextGridItem()
{
    // do nothing
}

void CMultilineTextGridItem::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
    CXTPPropertyGridView* pGrid = GetGrid();
    CDC * dc = pGrid->GetDC();
    CRect rc;
    dc->DrawText(GetValue(), &rc, DT_CALCRECT );
    pGrid->ReleaseDC(dc);
    lpMeasureItemStruct->itemHeight = rc.Height();
}

BOOL CMultilineTextGridItem::OnDrawItemValue(CDC& dc, CRect rcValue)
{
    CRect rcText(rcValue);
    dc.DrawText( GetValue(), rcText, DT_LEFT);
    return TRUE;
}

I hope that helps someone else too; feel free to let me know of any bugs.

Colin

 

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2005 at 4:32pm
In the next release (9.70), you can set the size of individual items, multi-line text support is also added
Back to Top
CGrant View Drop Down
Newbie
Newbie
Avatar

Joined: 30 May 2005
Location: United Kingdom
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote CGrant Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2005 at 5:35pm

Wonderful. Is there somewhere that states the release dates?

 

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2005 at 6:33am
No, But I am really sure it will be by the end of next week
Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2005 at 10:29am

Originally posted by SuperMario SuperMario wrote:

In the next release (9.70), you can set the size of individual items, multi-line text support is also added

 

That's good news... Will this enhancement also be available in the ActiveX version of the control? Thanks.

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.235 seconds.