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 » Problem displaying labels under ubuntu 7.10
Problem displaying labels under ubuntu 7.10 [message #15088] Sat, 29 March 2008 17:05 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks for the 2008.2 beta for linux Smile

My code compiles and runs fine apart from a few display problems. I use a drag and drop option tree and whilst I can see the option control and the image, the text gets hidden behind the option and is limited to the client space of the option control.

I have reproduced the problem by adapting the DND tree control example

EDIT: this code runs perfectly under Windows XP, just not under ubuntu 7.10

#include "CtrlLib/CtrlLib.h"

using namespace Upp;

struct App : TopWindow {
	TreeCtrl   tree;

	Option options[10000];

	typedef App CLASSNAME;

	void DropInsert(int parent, int ii, PasteClip& d)
	{
		tree.AdjustAction(parent, d);
		if(AcceptInternal<TreeCtrl>(d, "mytreedrag")) {
			tree.InsertDrop(parent, ii, d);
			tree.SetFocus();
			return;
		}
		if(AcceptText(d)) {
			tree.SetCursor(tree.Insert(parent, ii, Image(), GetString(d)));
			tree.SetFocus();
			return;
		}
	}

	void Drag()
	{
		if(tree.DoDragAndDrop(InternalClip(tree, "mytreedrag"),
		                       tree.GetDragSample()) == DND_MOVE)
			tree.RemoveSelection();
	}

	App() {
		Add(tree.SizePos());
		Vector<int> parent, parent2;
		parent.Add(0);
		tree.SetRoot(Image(), "The Tree");
		for(int i = 1; i < 10000; i++) 
		{
			TreeCtrl::Node node(CtrlImg::File(),options[i],20);
			node.Set(FormatIntRoman(i, true));
			parent.Add(tree.Add(parent[rand() % parent.GetCount()],node));
		
//			parent.Add(tree.Add(parent[rand() % parent.GetCount()], Image(),
//			            FormatIntRoman(i, true)));
			if((rand() & 3) == 0)
				tree.Open(parent.Top());
		}
		tree.Open(0);
		tree.WhenDropInsert = THISBACK(DropInsert);
		tree.WhenDrag = THISBACK(Drag);
		tree.MultiSelect();
		Sizeable();
	}
};

GUI_APP_MAIN
{
	App().Run();
}

[Updated on: Sun, 30 March 2008 03:02]

Report message to a moderator

Re: Problem displaying labels under ubuntu 7.10 [message #15178 is a reply to message #15088] Mon, 07 April 2008 16:21 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
no interest?

the test case I've given is very clear. Is there anything else I can do to help get this fixed?

Nick
Re: Problem displaying labels under ubuntu 7.10 [message #15180 is a reply to message #15178] Mon, 07 April 2008 19:24 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I believe the problem is probably linked to the changes suggested here but I'm not sure why it would only affect Ubuntu.

I think the problem might be the change to TreeCtrl::Item::GetValueSize. Unfortunately I can't test this on Ubuntu at the mo, but if you want a quick fix I can suggest 2 changes that might fix it:
Size   TreeCtrl::Item::GetValueSize() const
{
	return display ? display->GetStdSize(value) : StdDisplay().GetStdSize(value);
}

Size   TreeCtrl::Item::GetCtrlSize() const
{
	return IsNull(size) ? (ctrl ? ctrl->GetStdSize() : Size(0, 0)) : size;
}

Size   TreeCtrl::Item::GetSize() const
{
	Size sz = GetValueSize();
	Size csz = GetCtrlSize();
	sz += Size(2 * margin, 2 * margin);
	Size isz = image.GetSize();
	sz.cx += isz.cx;
	sz.cy = max(sz.cy, isz.cy);
	sz.cx += csz.cx;
	sz.cy = max(sz.cy, csz.cy);
	return sz;
}

and then in TreeCtrl::Paint you need to add:
			if(m.ctrl)
				x += m.GetCtrlSize().cx;

after the 'dword st;' line (near the end).

The problem with TreeCtrl is that everyone seems to find new and interesting ways of breaking it and the fixes always break something else Smile. So I can't guarantee that these changes will work for everyone but it works for both reference examples, your example and the one from the thread linked above.

James

[Updated on: Wed, 09 April 2008 09:57]

Report message to a moderator

Re: Problem displaying labels under ubuntu 7.10 [message #15182 is a reply to message #15180] Mon, 07 April 2008 22:18 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks James,

Your suspicions were correct. I didn't realise there was a second 2008.1 beta (the numbering convention appears to have changed from YYYY.MM). I "upgraded" to the second beta and now its broken in windows too. Your fixes works though so I can only hope they make it into the official version.

Nick
Re: Problem displaying labels under ubuntu 7.10 [message #15320 is a reply to message #15182] Wed, 16 April 2008 11:25 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, applied.

Mirek
Previous Topic: problem in Refreshing at end of tree
Next Topic: Cursor doesn't refresh
Goto Forum:
  


Current Time: Fri Mar 29 07:09:25 CET 2024

Total time taken to generate the page: 0.01571 seconds