Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is it possible to change TreeView's background color, not node color?

New Here ,
Feb 02, 2010 Feb 02, 2010

In advance, Thanks!!

treeview.JPG

Actually, I've made my own treeview in my project. and  I've changed my treeview node color as i want

I wonder whether or not to change treeview's background color, not node color in below class.

// in ~.fr

Class
{
  kMyTreeViewWidgetBoss,
  kTreeViewWidgetBoss,
  {


     IID_ICONTROLVIEW,                    kMyTreeViewCtrlViewImpl,  


     IID_ITREEVIEWWIDGETMGR,      kMyTreeViewListBoxWidgetMgrImpl,
     IID_ITREEVIEWHIERARCHYADAPTER,  kMyTreeViewListBoxHierarchyAdapterImpl,
     IID_ISTRINGLISTDATA,                          kStringListDataImpl,
     IID_IOBSERVER,                                  kMyTreeViewCtrlBoxObserverImpl,
    }
},
type MainTreeViewListBox(kViewRsrcType)       : TreeViewWidget    (ClassID = kMyTreeViewWidgetBoss)  {};

MainTreeViewListBox   //Tree view
(
           kMyTreeViewWithTextListWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
           kBindAll,           // Frame binding
           Frame(-1, 26, 300, 276)  // Frame
           kTrue, kTrue,         // Visible, Enabled
           kTrue,       // EraseBeforeDraw
           kInterfacePaletteFill,   // InterfaceColor
           "",
           kHideRootNode,// | kDrawEndLine, // Options. Display root node
           kFalse,  // Use H Scroll bar
           kTrue,  // Use V scroll bar
           20,   // fVScrollButtonIncrement
           20,   // fVThumbScrollIncrement
           0,   // fHScrollButtonIncrement
           0,   // fHThumbScrollIncrement
           2,   // Items selectable, 0 = No Selection, 1 = Single Selection, 2 = Multiple Selection
           kFalse,  // Allow children from multiple parents to be selected
           kTrue,  // Allow discontiguous selection
           {
            //The tree view is dynamically created. 
           },
),        

class MyTreeViewCtrlView : public PanelView

{

...

virtual void   Draw(IViewPort* viewPort, SysRgn updateRgn);
...

}

void MyTreeViewCtrlView::Draw( IViewPort*  viewPort, SysRgn  updateRgn )
{
   AGMGraphicsContext gc(viewPort, this, updateRgn);
  InterfacePtr<IGraphicsPort>  gPort(gc.GetViewPort(), UseDefaultIID()); // IID_IGRAPHICSPORT);
  ASSERT(gPort);

  gPort->gsave();
  PMRect frameOut      = GetFrame();
  frameOut.MoveTo(0, 0);


  COLORREF crBackColor    = RGB( 255, 0, 0 );

  gPort->setrgbcolor( GetRGBtoReal( GetRValue(crBackColor) ), GetRGBtoReal( GetGValue(crBackColor) ), GetRGBtoReal( GetBValue (crBackColor) ));
gPort->rectpath(frameOut);
gPort->fill();

gPort->grestore();

PanelView::Draw( viewPort, updateRgn );

}

In above case, there are errors in kMyTreeViewCtrlViewImple when Indesign is launching.

// Error Assert

XferObject- ReadWrite for impl kMyTreeViewCtrlViewImpl of iid IID_ICONTROLVIEW in class kMyTreeViewWidgetBoss read wrong amount in plugin kMyTreeViewWidgetBoss

///

but, in kMyTreeViewWidgetBoss ClassDescriptionTable, when remove this( IID_ICONTROLVIEW, kMyTreeViewCtrlViewImpl), that's ok. but I can't change background color. just interfacepalettefill color

Please help me!!

TOPICS
SDK
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2010 Feb 02, 2010

Hello yjmedia,     I am sorry that I can't help you, but I am solving the problem of filling TreeNode with RGB color. Could you please advise me how have you reached filling of TreeNode ?  Thank you, marxin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2010 Feb 02, 2010
LATEST

Here's a sample!

That's all.

#define GetRGBtoReal( X )   (double) X / (double) 255.f


COLORREF crBackColor    = RGB( 255, 0, 0 );

gPort->setrgbcolor( GetRGBtoReal( GetRValue(crBackColor) ), GetRGBtoReal( GetGValue(crBackColor) ), GetRGBtoReal( GetBValue(crBackColor) ));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines