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 |
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:
same now with child item:
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
|
|
|
|
|
Goto Forum:
Current Time: Thu Apr 18 09:35:51 CEST 2024
Total time taken to generate the page: 0.02056 seconds
|