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 » Look and Chameleon Technology » look of ctrl with styled horz and vert scrollbars
look of ctrl with styled horz and vert scrollbars [message #37827] Fri, 16 November 2012 02:53 Go to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
I got a TopWindow with a background painted Black() and added a number of NoBackground() Ctrls to it.
If a Ctrl needs to show both (styled) horizontal and vertical scroll bars at the same time, Ctrl right bottom corner square does not get painted accordingly (black).
Any clue on how to fix it?

index.php?t=getfile&id=3920&private=0

Thanks!!
Re: look of ctrl with styled horz and vert scrollbars [message #37829 is a reply to message #37827] Fri, 16 November 2012 07:44 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

kropniczki wrote on Fri, 16 November 2012 02:53

I got a TopWindow with a background painted Black() and added a number of NoBackground() Ctrls to it.
If a Ctrl needs to show both (styled) horizontal and vertical scroll bars at the same time, Ctrl right bottom corner square does not get painted accordingly (black).
Any clue on how to fix it?

index.php?t=getfile&id=3920&private=0

Thanks!!


Hi,

I believe that that little square is hardcoded to be painted in SColorFace color. So you can either modify that, but that will affect your entire application or you can make your own class which would inherit from ScrollBars and override FramePaint() - it is only three lines of code Smile

Alternative and probably better solution would be to modify ScrollBars to so that it can figure out the correct color from the style of the scrollbars it contains. Shouldn't be difficult too.

Best regards,
Honza
Re: look of ctrl with styled horz and vert scrollbars [message #37839 is a reply to message #37829] Fri, 16 November 2012 16:40 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Thank you, Honza, for the prompt reply.


Quote:

I believe that that little square is hardcoded to be painted in SColorFace color.


I've already tried that before I posted this thread, but it did not work.

Quote:

you can make your own class which would inherit from ScrollBars and override FramePaint() - it is only three lines of code


I'll try this next, for the apparent easy of it, let's see how it goes.

Quote:

Alternative and probably better solution would be to modify ScrollBars to so that it can figure out the correct color from the style of the scrollbars it contains. Shouldn't be difficult too.


You mean, modify Upp's native original code? Doesn't sound ok to me, unless you guys hard code it in upcoming releases, I guess.

Many thanks!
Re: look of ctrl with styled horz and vert scrollbars [message #37840 is a reply to message #37829] Fri, 16 November 2012 21:32 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Hi, Honza, please help me out with this:

dolik.rce wrote on Fri, 16 November 2012 03:44

... you can make your own class which would inherit from ScrollBars and override FramePaint() - it is only three lines of code Smile



If you mean Scrollbar.cpp code
void ScrollBars::FramePaint(Draw& w, const Rect& r) {
	if(x.IsShown() && y.IsShown() && !box) {
		int h = ScrollBarSize();
		w.DrawRect(r.right - h, r.bottom - h, h, h, SColorFace);
	}
}

Ok, but how to do it? First, let us check if I got your point right: let's say I create a class that inherits from ScrollBars (MyScrollBars), override FramePaint method and then make my Ctrls use it instead ScrollBars directly. If that's what you mean, TreeCtrl, for one, declares its ScrollBars sb member as private. Therefore I can not replace it by MyScrollbars. I'm sorry, but I don't follow you. Besides, ArrayCtrl, for instance, does not use ScrollBars. Can you elaborate on that?

dolik.rce wrote on Fri, 16 November 2012 03:44

Alternative and probably better solution would be to modify ScrollBars to so that it can figure out the correct color from the style of the scrollbars it contains. Shouldn't be difficult too.

And what about that? Can you help me out on how to do it, though?

Thanks!

[Updated on: Fri, 16 November 2012 21:34]

Report message to a moderator

Re: look of ctrl with styled horz and vert scrollbars [message #37841 is a reply to message #37829] Fri, 16 November 2012 22:37 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Looks like I found a makeshift solution when inspecting ScrollBars code. Unfortunately enough, however, it requires modifying ScrollBar.h hard code:
replace
StaticRect the_box
by
ParentCtrl the_box
in line 163.
Apparently, since ParentCtrl is transparent, it lets the background color show up through to the top Z level, which in itself is enough to take care of the nagging little bottom right square.
BTW, I also observed that ScrollBars constructor points its
Ctrl *box
member, which is protected, to the_box. One could therefore inherit from ScrollBars and re-point *box to a ParentCtrl instead, which would in turn avoid any direct manipulation of ScrollBar.h alltogether. However, then again, how to make TreeCtrl use my inherited class instead of ScrollBars?

Yet, what to do when Ctrl does not use ScrollBars, like ArrayCtrl, for example?

Thank you!

[Updated on: Fri, 16 November 2012 22:39]

Report message to a moderator

Re: look of ctrl with styled horz and vert scrollbars [message #37849 is a reply to message #37827] Sun, 18 November 2012 11:48 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi,

Sorry for late reply, I've been quite busy.

I somehow missed the fact that you are using TreeCtrl, I thought you use the ScrollBars directly. So overriding the FramePaint and using customized class is not really an option for you.

Quote:

Quote:

I believe that that little square is hardcoded to be painted in SColorFace color.
I've already tried that before I posted this thread, but it did not work.


It should work like this:
GUI_APP_MAIN{
	SColorFace_Write(Black());
	SColorText_Write(White());
	SColorPaper_Write(LtGray());
	SColorLabel_Write(Gray());
	// etc ...
	MyApp().Run();
}

This method is probably the best if you want to globally style entire application.

Quote:

Quote:

Alternative and probably better solution would be to modify ScrollBars to so that it can figure out the correct color from the style of the scrollbars it contains. Shouldn't be difficult too.

You mean, modify Upp's native original code? Doesn't sound ok to me, unless you guys hard code it in upcoming releases, I guess.

Yes, modifying this in U++ source is what I meant. IMHO it is a styling bug. However, I'm not really familiar with this, so the final decision is up to Mirek.

Could you post some simple testcase with the complete styling? E.g. something like the dialog on the image in your first post.

Honza
Re: look of ctrl with styled horz and vert scrollbars [message #37886 is a reply to message #37849] Mon, 19 November 2012 23:46 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Issue resolved!

Well, I'm afraid I had included the SColor..._Write(Color) stuff in the main app constructor instead of inside the GUI_APP_MAIN block Embarassed . How could I possibly know?

Anyway, before I found this out, I had modifyed ScrollBar.h declaration in line 163 from
StaticRect the_box;
to
ParentCtrl the_box;
and ArrayCtrl.h declaration in line 189 from
FrameBottom<StaticRect> scrollbox;
to
FrameBottom<ParentCtrl> scrollbox;
, respectively. By doing so, I replaced opaque StaticRect scrollbar containers by rather transparent ParentCtrl ones, which resolved the issue, regardless of where the SColor..._Write(Color) lines were included. Having said that, I ask: shouldn't it be hard-coded this way in future Upp releases for TreeCtrl and ArrayCtrl as well as for other widgets that use scrollbars? I mean, unless it implies unforeseen negative consequences, why not, since Upp help clearly states that
Quote:

"This class is supposed to be used as logical parent in situation when more widgets are to be grouped together. The only difference from Ctrl is that ParentCtrl activates Transparent in constructor"


Many thanks!

[Updated on: Mon, 19 November 2012 23:49]

Report message to a moderator

Re: look of ctrl with styled horz and vert scrollbars [message #37974 is a reply to message #37886] Mon, 26 November 2012 13:54 Go to previous message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
OK, I guess original intent of "box" is not important anymore, changing to ParentCtrl... (but will revert if any problems arise).

Mirek
Previous Topic: How to change window background?
Next Topic: TopWindow skin
Goto Forum:
  


Current Time: Sat Dec 14 14:13:05 CET 2024

Total time taken to generate the page: 0.02115 seconds