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 » Draw, Display, Images, Bitmaps, Icons » Drawing Backgroud
Drawing Backgroud [message #7314] Thu, 21 December 2006 16:24 Go to next message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
1)I have coded I GUI that uses a tree Ctrl as a menu of my program.

2)Than, I paintd the GUI as White.

3)But now I want to insert an image as a Background of the
GUI that is already displaing the tree menu.

4)Thats is possible.

5) Why the stand code to Display an image do not show any image.

6) If I take the lines that insert the Tree in the GUI the image
appears.

Any Sugestion?

Check the Code
--------------------------------
xadrez::xadrez()
{
Progress pi;

CtrlLayout(*this, "Xadrez Postal 1.0");
estadoxadrezpostal = "Bem vindo ao Xadrez Postal !";
AddFrame(menu);
menu.Add("Ajuda", THISBACK(ajuda));
menu.Add("Sobre Xadrez Postal", THISBACK(sobre));
menu.Add("Sair",THISBACK(sair));
AddFrame(estadoxadrezpostal);
horizontal.Add(arvoredeescolha);
Add(horizontal.Horz().SizePos());
arvoredeescolha.MultiSelect();
arvoredeescolha.WhenOpen = THISBACK(OpenDir);
arvoredeescolha.WhenClose = THISBACK(CloseDir);
arvoredeescolha.WhenCursor = THISBACK(ShowPath);
arvoredeescolha.WhenLeftDouble = THISBACK(TratarOpcoesDeArvore);
arvoredeescolha.SetRoot(CtrlImg::Dir(), "Entrada");
pi.AlignText(ALIGN_LEFT);
LoadTree(0, "Entrada", pi);
BackPaint();
}
And
void Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, SWhite);
Size isz = vacat().GetSize();
w.DrawImage((sz.cx - isz.cx) / 2, (sz.cy - isz.cy) / 2, vacat());
}
----------------------------------------------------------
Best Regards Embarassed
Re: Drawing Backgroud [message #7317 is a reply to message #7314] Thu, 21 December 2006 21:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Performing GUI operations in constructor is not a very good idea.

Other than that, code is way to incomplete to give better advice.

Please post something compilable.

(And yes, it is possible).

Mirek
Re: Drawing Backgroud [message #7330 is a reply to message #7314] Fri, 22 December 2006 15:57 Go to previous messageGo to next message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
I attached the source you, ask.
It is a beginning of a software.
The main Idea it is to use a Tree
as a menu, but I also want to insert
an background image instead of White.

Angel Portal

Just go inside of you MyApps and expand this file.
Open TheIDE and select xadrez package.
  • Attachment: xadrez.zip
    (Size: 7.94KB, Downloaded 264 times)
icon6.gif  Re: Drawing Backgroud [message #7331 is a reply to message #7317] Fri, 22 December 2006 16:17 Go to previous messageGo to next message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
When you run the code, it will show this image!!

Angel Portal
  • Attachment: imagem.bmp
    (Size: 479.89KB, Downloaded 286 times)
Re: Drawing Backgroud [message #7334 is a reply to message #7331] Fri, 22 December 2006 18:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
OK, I guess I know what you are trying to do.

The trouble is that you cannot simply override the background of opaque widget. The Paint you have overriden works, but is hidden "behind" the TreeCtrl.

Mirek
Re: Drawing Backgroud [message #7336 is a reply to message #7334] Fri, 22 December 2006 19:55 Go to previous messageGo to next message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
How to show it?
Re: Drawing Backgroud [message #7343 is a reply to message #7336] Sat, 23 December 2006 09:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Well, you would need to create your own TreeCtrl.

Or we will have to alter the U++ library code. Just let me a while to chew this request, it is quite unusual.

....(20 minutes later)

OK, TreeCtrl now has "NoBackground" method. Combine with "Transparent".

I will add NoBackground to all "view" widgets.

Mirek
Re: Drawing Backgroud [message #7387 is a reply to message #7336] Tue, 26 December 2006 16:01 Go to previous messageGo to next message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
So in order to appear any background image, I just use
NoBackground method,is that what you sad?

Angel Portal
Re: Drawing Backgroud [message #7390 is a reply to message #7387] Tue, 26 December 2006 18:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
AngelPortal wrote on Tue, 26 December 2006 10:01

So in order to appear any background image, I just use
NoBackground method,is that what you sad?

Angel Portal


Yes. (But you must a new version of U++ Wink

(BTW, I have used your example as development code, so it surely works for you Wink

Mirek
Re: Drawing Backgroud [message #7417 is a reply to message #7314] Thu, 28 December 2006 10:51 Go to previous message
AngelPortal is currently offline  AngelPortal
Messages: 13
Registered: December 2006
Promising Member
thanks!
Previous Topic: How to NOT dlopen libgtk and stuff....?
Next Topic: Wrong Size problem..
Goto Forum:
  


Current Time: Sun Nov 17 14:06:14 CET 2019

Total time taken to generate the page: 0.02352 seconds