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 » TopWindow&PopUp, TrayIcon » Howto set the icon for the application/and or topwindow in the code?
Re: Howto set the icon for the application/and or topwindow in the code? [message #26942 is a reply to message #26938] Fri, 11 June 2010 10:54 Go to previous message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
You can use ImageDraw to draw image and Icon to show a new icon.

aqq2.lay:
----------------------------------------------------------
LAYOUT(aqq2Layout, 200, 100)
	ITEM(Button, ChangeIcon, SetLabel(t_("Icon")).LeftPosZ(52, 104).TopPosZ(44, 36))
END_LAYOUT


aqq2.h:
----------------------------------------------------------
#ifndef _aqq2_aqq2_h
#define _aqq2_aqq2_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <aqq2/aqq2.lay>
#include <CtrlCore/lay.h>



class aqq2 : public Withaqq2Layout<TopWindow> {
	void SetIcon();
public:
	typedef aqq2 CLASSNAME;
	aqq2();
};


main.cpp:
----------------------------------------------------------
#include "aqq2.h"


void aqq2::SetIcon()
{
	ImageDraw iw(16, 16);
	iw.DrawRect(4,4,8,8,Color(Random(),Random(), Random()));
	Icon(iw);
}

aqq2::aqq2()
{
	CtrlLayout(*this, "Window title");
	ChangeIcon.WhenPush = THISBACK(SetIcon);
}

GUI_APP_MAIN
{
	aqq2().Run();
}

 
Read Message
Read Message
Previous Topic: [SOLVED] topmost menu popup crashes
Next Topic: Simple way of switching dialogs
Goto Forum:
  


Current Time: Mon Aug 25 23:33:36 CEST 2025

Total time taken to generate the page: 0.06122 seconds