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 » U++ Library : Other (not classified elsewhere) » Display problem with Splitter, GLCtrl and MenuBar
Display problem with Splitter, GLCtrl and MenuBar [message #15625] Thu, 01 May 2008 20:02 Go to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hi,

I'm currently on Linux with current SVN and I have found a display problem with components mentioned in the title.

The GLCtrl in the splitter is rendered to high when there is a menubar and there is also a refresh problem if you resize the splitter.

Here is a screenshot of both problems:
index.php?t=getfile&id=1180&private=0

I also attached a testcase.
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15711 is a reply to message #15625] Mon, 05 May 2008 16:37 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
I'll check it on next days!

Ciao

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15732 is a reply to message #15711] Tue, 06 May 2008 20:14 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Fixed, will post updated code in svn.

Quick fixes : In Core/X11DHCtrl.cpp, from line 341 :

			case POSITION   : // = 100,
			case LAYOUTPOS  : // = 101,
				r = GetRectInParentWindow();
				XGetGeometry(Xdisplay, top->window, &dummy, &x, &y, &width, &height, &border, &depth);
				if( (x != r.left || y != r.top) && ((int)width == r.Width() && (int)height == r.Height()))
					XMoveWindow(Xdisplay, top->window, r.left, r.top);
				else if( (x == r.left || y == r.top) && ((int)width != r.Width() || (int)height != r.Height()))
					XResizeWindow(Xdisplay, top->window, r.Width(), r.Height());
				else if( x != r.left || y != r.top || (int)width != r.Width() || (int)height != r.Height())
					XMoveResizeWindow(Xdisplay, top->window, r.left, r.top, r.Width(), r.Height());

				break;

			default:
				break;

		} // switch(reason)
	}

} // END DHCtrl::State()


and, in X11Wnd, from line 152 :

// Gets the rect inside the parent window
Rect Ctrl::GetRectInParentWindow(void) const
{
	Rect r = GetRect();
	Ctrl *q = parent;
	while(q)
  	{
		if(q->top)
			break;
		r += q->GetRect().TopLeft();
		q = q->parent;
	}
	if(q)
		r += q->GetScreenView().TopLeft() - q->GetScreenRect().TopLeft() ;
	return r;

}
// 01/12/2007 - END


Ciao

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15750 is a reply to message #15625] Wed, 07 May 2008 00:50 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Thank you for the fix Smile

[Updated on: Wed, 07 May 2008 00:50]

Report message to a moderator

Re: Display problem with Splitter, GLCtrl and MenuBar [message #15800 is a reply to message #15750] Thu, 08 May 2008 00:21 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
sorry, I posted incomplete quickfix here in forum... here the complete Status function in X11DHCtrl.cpp (some declarations were missing...). From line 294 :

/////////////////////////////////////////////////////////////////////////////////////////
// State handler
void DHCtrl::State(int reason)
{
	Window dummy;
	int x, y;
	unsigned int width, height, border, depth;
	Rect r;

	// No handling if in error state
	if( isError)
		return;

	// Initializes the control if needed (and possible...)
	if(!isInitialized && GetTopWindow() && GetTopWindow()->GetWindow())
		Init();

	if(isInitialized)
	{
		switch( reason )
		{
			case FOCUS      : // = 10,
				break;

			case ACTIVATE   : // = 11,
				break;

			case DEACTIVATE : // = 12,
				break;

			case SHOW       : // = 13,
				MapWindow(IsShown());
				break;

			case ENABLE     : // = 14,
				break;

			case EDITABLE   : // = 15,
				break;

			case OPEN       : // = 16,
				break;

			case CLOSE      : // = 17,
				Terminate();
				break;

			case POSITION   : // = 100,
			case LAYOUTPOS  : // = 101,
				r = GetRectInParentWindow();
				XGetGeometry(Xdisplay, top->window, &dummy, &x, &y, &width, &height, &border, &depth);
				if( (x != r.left || y != r.top) && ((int)width == r.Width() && (int)height == r.Height()))
					XMoveWindow(Xdisplay, top->window, r.left, r.top);
				else if( (x == r.left || y == r.top) && ((int)width != r.Width() || (int)height != r.Height()))
					XResizeWindow(Xdisplay, top->window, r.Width(), r.Height());
				else if( x != r.left || y != r.top || (int)width != r.Width() || (int)height != r.Height())
					XMoveResizeWindow(Xdisplay, top->window, r.left, r.top, r.Width(), r.Height());

				break;

			default:
				break;

		} // switch(reason)
	}
} // END DHCtrl::State()


In svn that's already ok.
Sorry again for the missing part Sad

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15855 is a reply to message #15625] Mon, 12 May 2008 16:03 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hi,

I finally found time to test your fix and for my testcase it works great Smile

But my program still has the same problem as before Sad
I tried to locate the problem but I don't really understand the layout code of U++ Smile

I made a new testcase which shows the problem ( again Smile )
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15856 is a reply to message #15855] Mon, 12 May 2008 17:33 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, I'll give it a try this evening Smile

Max

EDIT : the strange stuff is that now it doesn't depend on GLCtrl.... About the same happens if you change your first class :

class GLTest : public StaticRect
{
	virtual void Paint(Draw &w)
	{
		w.DrawRect(GetRect(), Yellow());
	}
};


I'll investigate a bit more...

Max

[Updated on: Mon, 12 May 2008 20:55]

Report message to a moderator

Re: Display problem with Splitter, GLCtrl and MenuBar [message #15868 is a reply to message #15625] Tue, 13 May 2008 18:23 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
I tested a bit with your code, but the problem with that is that you use GetRect() instead of GetSize().

GetRect gives you the relative position to the parent ctrl, but if you want to fill the whole StaticRect with a color you want to draw from (0, 0) and not from the position the ctrl has relative to its parent.

So it seems the problem has still something to do with the GLCtrl.
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15869 is a reply to message #15868] Tue, 13 May 2008 18:49 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, you're right, even if it should not trash the client area as it does.
I'll check GLCtrl code... thanx for bug report Smile

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15871 is a reply to message #15869] Tue, 13 May 2008 20:53 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well, hopefully ( Smile ) solved!

In CtrlCore/X11DHCtrl.cpp, from line 294 :

/////////////////////////////////////////////////////////////////////////////////////////
// State handler
void DHCtrl::State(int reason)
{
	Window dummy;
	int x, y;
	unsigned int width, height, border, depth;
	Rect r;

	// No handling if in error state
	if( isError)
		return;

	// Initializes the control if needed (and possible...)
	if(!isInitialized && GetTopWindow() && GetTopWindow()->GetWindow())
		Init();

	if(isInitialized)
	{
		switch( reason )
		{
			case FOCUS      : // = 10,
				break;

			case ACTIVATE   : // = 11,
				break;

			case DEACTIVATE : // = 12,
				break;

			case SHOW       : // = 13,
				MapWindow(IsShown());
				break;

			case ENABLE     : // = 14,
				break;

			case EDITABLE   : // = 15,
				break;

			case OPEN       : // = 16,
				break;

			case CLOSE      : // = 17,
				Terminate();
				break;

			case POSITION   : // = 100,
			case LAYOUTPOS  : // = 101,
				SyncNativeWindows();
				break;

			default:
				break;

		} // switch(reason)
	}
}


And in CtrlCore/X11Wnd.cpp, from line 152 :

// Gets the rect inside the parent window
Rect Ctrl::GetRectInParentWindow(void) const
{
	Rect r = GetRect();
	Ctrl *q = parent;
	while(q)
  	{
		if(q->top)
			break;
		r += q->GetRect().TopLeft() + q->GetView().TopLeft();
		q = q->parent;
	}
	if(q)
		r += q->GetView().TopLeft();
	return r;

}


Ciao

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15873 is a reply to message #15625] Tue, 13 May 2008 21:03 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Ahh, everything works now Smile

Thank you very much Surprised
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15877 is a reply to message #15873] Tue, 13 May 2008 23:37 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
kodos wrote on Tue, 13 May 2008 21:03

Ahh, everything works now Smile

Thank you very much Surprised


Well, it was time !!! Smile
Thank you for testing !

Max
Re: Display problem with Splitter, GLCtrl and MenuBar [message #15886 is a reply to message #15877] Wed, 14 May 2008 09:10 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Patch applied. Thanks.

Mirek
Previous Topic: ImageCtrl issue
Next Topic: Uninitialized class members.
Goto Forum:
  


Current Time: Thu Mar 28 12:15:19 CET 2024

Total time taken to generate the page: 0.01379 seconds