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 » ColorPopUp Problem
icon9.gif  ColorPopUp Problem [message #3664] Mon, 12 June 2006 11:09 Go to next message
CyberEye is currently offline  CyberEye
Messages: 4
Registered: June 2006
Location: Germany
Junior Member
Hello @ all!

I have a problem with the ColorPopUp Widget.

I have a small test-application, where is a simple button. If I click it, there should popup the Color-Dialog.
Of course, it popup, but it doesn't stay on the screen. (It is only visible for some milliseconds.)

Here is a code sniped:

void ColorPop()
	{
		ColorPopUp chooser;
		chooser.PopUp(&myButton);
	}
	
	typedef MyAppWindow CLASSNAME;
		
	MyAppWindow()
	{
		Title("My application").Zoomable().Sizeable();
		AddFrame(menu);
		Add(myButton.LeftPos(10, 40).TopPos(10, 20));
		menu.Set(THISBACK(MainMenu));
		myButton.WhenAction = THISBACK(ColorPop);
	}
};


GUI_APP_MAIN
{
	MyAppWindow app;
	app.Run();
}


The only problem is the ColorPopUp, all other things work perfectly.

If you could help me, it would be very great!

friendly greetings

CyberEye
Re: ColorPopUp Problem [message #3673 is a reply to message #3664] Mon, 12 June 2006 15:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11864
Registered: November 2005
Ultimate Member
Well, the problem is obvious:

"PopUp" just opens ("launches") the popup window, nothing else. More specifically, it does not run any form of message loop.

What you do here is to construct ColorPopUp, then popup it, but just right after that you destruct it.

To solve this trouble, make your ColorPopUp member variable instead of local.

I recommend CtrlLib/ColorPusher for study... Smile

Mirek
icon14.gif  Re: ColorPopUp Problem [message #3676 is a reply to message #3673] Mon, 12 June 2006 16:54 Go to previous messageGo to next message
CyberEye is currently offline  CyberEye
Messages: 4
Registered: June 2006
Location: Germany
Junior Member
Oh yes, this is it!

Thank you for the tip! Smile

It was the thing with the lifetime of an Object. Rolling Eyes

I must learn to think in Objects and their construction/destruction and so on. Very Happy

friendly greetings

CyberEye
Re: ColorPopUp Problem [message #3679 is a reply to message #3664] Mon, 12 June 2006 17:08 Go to previous messageGo to next message
andrei-catalin is currently offline  andrei-catalin
Messages: 62
Registered: May 2006
Location: Romania
Member
Hello,

Below is a little adaptation of ch11 tutorial showing ColorPusher, ColorCtrl and ColorButton in action.

#include <CtrlLib/CtrlLib.h>

#define IMAGECLASS TutorialImg
#define IMAGEFILE <gui_tutorial/ch11/images.iml>
#include <Draw/iml.h>

struct MyAppWindow : TopWindow {
	MenuBar menu;
	ToolBar tool;
//================================
	ColorPusher colorSelector1;
    ColorCtrl colorSelector2;
    ColorButton colorSelector3;
 //=================================   
	void MenuFn() {
		PromptOK("Fn activated!");
	}

	void BarFn() {
		PromptOK("Fn2 activated!");
	}
	
	void Exit() {
		if(PromptOKCancel("Exit MyApp?"))
			Break();
	}

	void SubBar(Bar& bar) {
		bar.AddMenu("Function", TutorialImg::Fn(), THISBACK(MenuFn));
		bar.Add(TutorialImg::Fn2(), THISBACK(BarFn));
		bar.Add("Exit", TutorialImg::Exit(), THISBACK(Exit));

//==============================	
		bar.Separator();
		bar.Add(colorSelector1,120,20);
		colorSelector1.WithText();
		bar.Add(colorSelector2,50,20);
		bar.Add(colorSelector3);
		colorSelector3.ColorImage(CtrlImg::BoxButton0());
		colorSelector3.NullImage(CtrlImg::set_transparent());
//===============================
	}

	void MainMenu(Bar& bar) {
		bar.Add("Menu", THISBACK(SubBar));
	}

	typedef MyAppWindow CLASSNAME;

	MyAppWindow() {
		Title("My application with bars").Sizeable();
		AddFrame(menu);
		AddFrame(tool);
		menu.Set(THISBACK(MainMenu));
		tool.Set(THISBACK(SubBar));
	}
};

GUI_APP_MAIN
{
	MyAppWindow app;
	app.Run();
}


Andrei
icon14.gif  Re: ColorPopUp Problem [message #3691 is a reply to message #3679] Tue, 13 June 2006 08:58 Go to previous messageGo to next message
CyberEye is currently offline  CyberEye
Messages: 4
Registered: June 2006
Location: Germany
Junior Member
Hello andrei!

It's a cool example, how easy it is to embed and handle complex control-elements within a toolbar (for example).

Unbelievable to do it as easy in MFC-Framework or Win32 API directly. Shocked

For me, U++ is overall the best Framework to develop OS-independent! It's sad, that U++ is not well-known for most developer in the world. Sad

Only the compiling time is a bit long. Confused

friendly greetings

CyberEye
Re: ColorPopUp Problem [message #3692 is a reply to message #3691] Tue, 13 June 2006 11:22 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1353
Registered: November 2005
Location: Poland
Senior Contributor

Quote:

It's a cool example, how easy it is to embed and handle complex control-elements within a toolbar (for example).

Unbelievable to do it as easy in MFC-Framework or Win32 API directly.


Exactly! But more interesting is frame concept which is very flexible and useful - you can for example easily put any toolbar (or another frame) inside any upp control. The only thing I miss is an ability to set cliping of child controls to arbitrary rectangle (default is to a frame) what complicated my grid ctrl code and frankly forced me to develop it twice from scratch Wink

Quote:

For me, U++ is overall the best Framework to develop OS-independent!


Holy truth!
Re: ColorPopUp Problem [message #3693 is a reply to message #3691] Tue, 13 June 2006 12:01 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
CyberEye wrote on Tue, 13 June 2006 07:58


For me, U++ is overall the best Framework to develop OS-independent! It's sad, that U++ is not well-known for most developer in the world. Sad

CyberEye


More sad is the fact that so many promising members praising U++ disappear very quickly...
Re: ColorPopUp Problem [message #3695 is a reply to message #3693] Tue, 13 June 2006 14:14 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1353
Registered: November 2005
Location: Poland
Senior Contributor

Quote:

More sad is the fact that so many promising members praising U++ disappear very quickly...


How can you know that? Not everyone like to be active on forums..
Re: ColorPopUp Problem [message #3696 is a reply to message #3695] Tue, 13 June 2006 14:23 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
unodgs wrote on Tue, 13 June 2006 13:14

Quote:

More sad is the fact that so many promising members praising U++ disappear very quickly...


How can you know that? Not everyone like to be active on forums..


then look at the downloads statistics... and compare with other toolkits statistical trends...

[Updated on: Tue, 13 June 2006 14:23]

Report message to a moderator

Re: ColorPopUp Problem [message #3703 is a reply to message #3696] Tue, 13 June 2006 22:20 Go to previous message
forlano is currently offline  forlano
Messages: 1052
Registered: March 2006
Location: Italy
Experienced Contributor
fudadmin wrote on Tue, 13 June 2006 14:23

unodgs wrote on Tue, 13 June 2006 13:14

Quote:

More sad is the fact that so many promising members praising U++ disappear very quickly...


How can you know that? Not everyone like to be active on forums..


then look at the downloads statistics... and compare with other toolkits statistical trends...


Yes, I've contributed to their statistics too in the past. But after a few hours each single bit of their distro disappeared from my computer. Some toolkit is only much more known than other and the new users prefer to move toward the one that seems more supported and with a long tradition. I understand them. Some other, as me in the past, are just unaware and are conditioned by the label "good" on this well know page http://free-soft.org/guitool/ (what to do to merit this label there?). I landed here by chance.
I would like to invite once more the active upp members to post much more compilable test cases or part of their application showing some feature not yet covered by the upp documentation.
Because a complete user manual is missing, only a greater collection of code example can supply its lack.
I see many clever questions and answers in this forum but I do not understand what they are speaking about! Smile . Well, I think that at the end of the speech something could remain somewhere under the form of a stupid compilable test case for study purpose for the beginners.

Luigi

(ops... I am off topic Smile )
Previous Topic: Splash Screen
Next Topic: Resizing a TopWindow but keeping the width/height ratio fixed?
Goto Forum:
  


Current Time: Sun May 26 18:14:54 CEST 2019

Total time taken to generate the page: 0.00946 seconds