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 » Toolbar images vanishing [SOLVED]
Toolbar images vanishing [SOLVED] [message #25899] Thu, 18 March 2010 16:25 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
I found a strange bug, reproducible with following code, which appears just on windows platform :

BigIcons.iml:
PREMULTIPLIED
IMAGE_ID(Flag)

IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,109,209,77,75,27,65,28,128,241,185,7,106,64,47,122,209,139,94,20,68,65,5,61,108,15,201,33,8,70,216)
IMAGE_DATA(136,9,141,72,91,176,224,37,208,82,131,205,161,135,82,74,143,253,26,66,75,165,90,73,107,171,33,210,24,33,159,32)
IMAGE_DATA(44,33,132,80,74,41,37,251,146,205,251,211,217,93,27,10,221,129,231,54,191,249,15,51,34,40,2,98,184,222,8,196)
IMAGE_DATA(235,219,94,201,94,8,234,245,58,181,90,141,106,181,74,165,82,65,211,52,202,229,50,150,16,24,178,134,236,183,236,151)
IMAGE_DATA(76,188,20,100,110,50,110,135,215,135,164,11,105,6,131,1,253,190,83,159,94,175,231,214,237,118,233,36,147,180,183,183)
IMAGE_DATA(105,169,42,246,198,6,63,133,55,55,115,243,140,221,139,93,146,95,146,36,62,37,92,247,215,186,174,211,161,221,110,211)
IMAGE_DATA(90,89,193,94,88,160,57,55,135,29,137,240,67,120,119,118,230,58,54,254,57,65,236,44,230,111,91,45,207,206,206,98)
IMAGE_DATA(205,204,208,12,133,248,126,235,15,174,15,136,159,199,137,101,99,108,158,110,250,91,219,246,236,244,52,230,212,20,150,162)
IMAGE_DATA(120,94,190,215,227,111,79,80,179,42,209,143,81,214,63,172,251,219,102,211,179,147,147,24,19,19,152,107,107,212,29,255)
IMAGE_DATA(92,144,186,74,17,61,139,18,57,137,16,126,31,246,183,150,229,217,241,113,244,177,49,204,229,101,106,142,207,8,246,243)
IMAGE_DATA(251,158,61,14,115,247,173,226,111,77,115,104,245,96,16,99,113,145,138,227,211,130,189,203,61,66,199,33,148,119,10,171)
IMAGE_DATA(71,171,254,214,48,208,71,71,105,140,220,161,17,8,160,207,207,123,62,37,184,255,245,1,59,231,59,196,179,242,13,79)
IMAGE_DATA(183,134,254,191,51,150,150,208,229,92,199,234,242,15,53,199,63,149,61,146,61,148,221,147,169,130,82,169,68,177,88,164)
IMAGE_DATA(80,40,144,207,231,201,229,114,110,85,185,223,153,169,253,211,31,18,68,231,174,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(448, 1)


main.cpp :
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define IMAGECLASS BigIconsImg
#define IMAGEFILE <BigIcons/BigIcons.iml>
#include <Draw/iml.h>

Vector<Image> &v(void)
{
	static Vector<Image>vv;
	return vv;
}
INITBLOCK
{
	v().Add(BigIconsImg::Flag());
};

class BigIcons : public TopWindow
{
	public:
		typedef BigIcons CLASSNAME;
		
		ToolBar toolBar;
		
		void nullFunc(void) {}
		
		BigIcons()
		{
			toolBar.Add("one", BigIconsImg::Flag(), THISBACK(nullFunc));
			AddFrame(toolBar);
		}
};

GUI_APP_MAIN
{
	BigIcons().Run();
}


Passing mouse cursor over toolbar makes icon vanish and not reappear anymore. On Linux is all ok.
Removing the INITBLOCK part, the correct behaviour is restored.
The testcase (on which obviously the INITBLOCK is useless...) is taken from an application that needs to register some icons at program startup.

Ciao

Max

[Updated on: Mon, 24 January 2011 13:00] by Moderator

Report message to a moderator

Re: Toolbar images vanishing [message #25900 is a reply to message #25899] Thu, 18 March 2010 16:51 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Even simpler testcase (same image file as above...) :

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define IMAGECLASS BigIconsImg
#define IMAGEFILE <BigIcons/BigIcons.iml>
#include <Draw/iml.h>

INITBLOCK
{
	Image img = BigIconsImg::Flag();
};

class BigIcons : public TopWindow
{
	public:
		typedef BigIcons CLASSNAME;
		ToolBar toolBar;
		void nullFunc(void) {}
		BigIcons()
		{
			toolBar.Add("one", BigIconsImg::Flag(), THISBACK(nullFunc));
			AddFrame(toolBar);
		}
};

GUI_APP_MAIN
{
	BigIcons().Run();
}


It seems that accessing Iml from inside INITBLOCK can bring troubles....

Max
Re: Toolbar images vanishing [message #26033 is a reply to message #25900] Fri, 26 March 2010 17:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mdelfede wrote on Thu, 18 March 2010 11:51

Even simpler testcase (same image file as above...) :

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define IMAGECLASS BigIconsImg
#define IMAGEFILE <BigIcons/BigIcons.iml>
#include <Draw/iml.h>

INITBLOCK
{
	Image img = BigIconsImg::Flag();
};

class BigIcons : public TopWindow
{
	public:
		typedef BigIcons CLASSNAME;
		ToolBar toolBar;
		void nullFunc(void) {}
		BigIcons()
		{
			toolBar.Add("one", BigIconsImg::Flag(), THISBACK(nullFunc));
			AddFrame(toolBar);
		}
};

GUI_APP_MAIN
{
	BigIcons().Run();
}


It seems that accessing Iml from inside INITBLOCK can bring troubles....

Max



Definitely!

There is basic rule: No graphics in INITBLOCKs. Only Core stuff.

Mirek
Re: Toolbar images vanishing [message #26051 is a reply to message #26033] Fri, 26 March 2010 23:01 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Fri, 26 March 2010 17:25


Definitely!

There is basic rule: No graphics in INITBLOCKs. Only Core stuff.

Mirek



Yep, I solved it storing the string name of image instead ot the image itself; the image can be then fetched with GetImlImage() function.
Had to change some stuff in PolyXML ClassFactory, indeed.

Ciao

Max
Previous Topic: Draw::WrawText to paint ASCII sequence
Next Topic: Display::PaintBackground not called
Goto Forum:
  


Current Time: Thu Mar 28 23:30:42 CET 2024

Total time taken to generate the page: 0.01544 seconds