Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CMarkupTreeCtrl problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CMarkupTreeCtrl problem

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: CMarkupTreeCtrl problem
    Posted: 28 August 2009 at 9:42am
XTP 13.1.
 
CMarkupTreeCtrl is owner-drawn. This means the width of the items is not set (since Windows does not draw it) which leads to a missing horizontal scrollbar. The control is not wide enough to show my items, and I have to make sure the tree control becomes aware of this and then shows a properly scaled horizontal scrollbar.
 
I've searched the whole net. Can't find information about this (which is odd).
 
Any ideas?
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 10:30am
Solved it!
 
Replacing your "NULL" with the actual text of the item does the trick. Windows seems to calculate the widths upon the InsertItem call!
 
---------------------------------------------------------------------------
CString GetInnerText(CXTPMarkupObject* pParent);
 
HTREEITEM CMarkupTreeCtrl::AddItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent/* = TVI_ROOT*/, HTREEITEM hInsertAfter/* = TVI_LAST*/)
{
    CXTPMarkupUIElement* pUIElement = Parse(lpszItem);
   
    HTREEITEM hItem;
    if (pUIElement)
    {
        hItem = InsertItem(GetInnerText(pUIElement), nImage, nSelectedImage, hParent, hInsertAfter);
        SetItemData(hItem, (DWORD_PTR)pUIElement);
    }
    else
    {
        hItem = InsertItem(lpszItem, nImage, nSelectedImage, hParent, hInsertAfter);
    }
    return hItem;
}
 
PokerMemento - http://www.pokermemento.com/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2009 at 8:07am
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 02 September 2009 at 3:01am
Yeah, but what happens if you have a different font in the markup? Then the width will not match, right?
 
In general, I think the native Windows tree control is a disaster :(
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.141 seconds.