Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » OptionTree has too large horizontal size
OptionTree has too large horizontal size [message #40182] Sat, 29 June 2013 10:56 Go to next message
Typhoor is currently offline  Typhoor
Messages: 14
Registered: October 2012
Location: Erlangen, Germany
Promising Member
I'm using OptionTree on current U++(6157) with Win7/MSC10

The horizontal size of the OptionTree-item is too large so that scrollbar is shown.

Left normal TreeCtrl right OptionTree:
index.php?t=getfile&id=4237&private=0

same now with child item:
index.php?t=getfile&id=4238&private=0

Here a quick test program:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : TopWindow 
{
  TreeCtrl   tree1;
  OptionTree tree2;
  Splitter   horz;
	
  App()
  {
    Sizeable(true).Zoomable(true).Add(horz.Horz().SizePos());
    horz.Add(tree1);
    horz.Add(tree2);
    tree1.SetRoot(CtrlImg::Dir(), "Root" );
    tree1.Add(0, CtrlImg::File(), "Very long text using the full width of this line.....");
    tree2.SetRoot("OptionRoot");
    tree2.Add(0,"Very long text using the full width of this line.....");
  }
};

GUI_APP_MAIN
{
  App().Run();
}


I changed near line 118 in CtrlLib/TreeCtrl.cpp ctrl->GetStdSize() to ctrl->GetMinSize() to solve the issue. (I'm not quite sure if I catched everything) :

Size   TreeCtrl::Item::GetCtrlSize() const
{
  if(!ctrl) return Size(0, 0);
//Size csz = ctrl->GetStdSize(); *** original code 6157
  Size csz = ctrl->GetMinSize();
  return Size(Nvl(size.cx, csz.cx), Nvl(size.cy, csz.cy));
}


It seems that the GetStdSize() uses unlying sizing as char count and multiplies it with fontsize to get to horizontal size?!?

Can this correction been taken into the main source, or is there a better solution?


Since we are into changing code:
Can we make the methods SetOption() and SetChildren() of OptionTree protected, so that in derived classes some logic can be added?
(CtrlLib/Treectrl.h near line 330)
class OptionTree : public TreeCtrl {
  Vector<Option *> option;
  Array<Option>    aux;
  bool             manualmode;

protected:  <<<<<<<
  void SetOption(int i);
  void SetChildren(int id, bool b);

public:
... and so on...


Thanx
Ralph
Re: OptionTree has too large horizontal size [message #40344 is a reply to message #40182] Mon, 22 July 2013 21:41 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Typhoor,

For me the first part of yours patch is absolutely correct (CtrlLib/TreeCtrl.cpp - line 118). I have tested in on GNU/Linux.

Size   TreeCtrl::Item::GetCtrlSize() const
{
    if(!ctrl) return Size(0, 0);
    Size csz = ctrl->GetMinSize();
    return Size(Nvl(size.cx, csz.cx), Nvl(size.cy, csz.cy));
}


Sincerely,
Klugier


U++ - one framework to rule them all.
Re: OptionTree has too large horizontal size [message #40584 is a reply to message #40344] Sun, 18 August 2013 16:57 Go to previous message
mirek is currently online  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, patch applied. Welcome to the contributors list Smile

Mirek
Previous Topic: Cannot scroll selected node into view from code [SOLVED]
Next Topic: TreeCtrlDnD inheritance bug?
Goto Forum:
  


Current Time: Fri Mar 29 13:46:41 CET 2024

Total time taken to generate the page: 0.01126 seconds