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 » Wy StyleNormal().Write() is global?
Re: Wy StyleNormal().Write() is global? [message #40707 is a reply to message #40706] Sat, 07 September 2013 19:19 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

iST1 wrote on Sat, 07 September 2013 18:57

I need to set own background image for buttons:

Button::Style &s1 = btn1.StyleNormal().Write();
s1.look[0] = img1;
s1.look[1] = img1;
s1.look[2] = img1;
s1.look[3] = img1;
s1.pressoffset = Point(1, -1);

Button::Style &s2 = btn2.StyleNormal().Write();
s2.look[0] = img2;
s2.look[1] = img2;
s2.look[2] = img2;
s2.look[3] = img2;
s2.pressoffset = Point(1, -1);

But after this btn1 also have img2 instead img1.

Hi,

StyleNormal() is a static method, hence it must only affect global properties Smile I think what you want is SetStyle() on the particular widget. What you are trying to do would look something like this (note: I haven't tested it):
	Button::Style s1 = Button::StyleNormal();
	s1.look[0] = img1;
	s1.look[1] = img1;
	s1.look[2] = img1;
	s1.look[3] = img1;
	s1.pressoffset = Point(1, -1);
	btn1.SetStyle(s1);
	
	Button::Style s2 = Button::StyleNormal();
	s2.look[0] = img1;
	s2.look[1] = img1;
	s2.look[2] = img1;
	s2.look[3] = img1;
	s2.pressoffset = Point(1, -1);
	btn2.SetStyle(s2);

The basic idea is to create a new style by copying and modifying the default one, then assigning the new style to your button.

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PATCH: plugin/jpg CMYK support
Next Topic: Transparent Background - Image control
Goto Forum:
  


Current Time: Wed May 15 08:06:07 CEST 2024

Total time taken to generate the page: 0.03325 seconds