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 » U++ Widgets - General questions or Mixed problems » What Label.WhenAction supposed to do? - nothing [PARTLY SOLVED :)]
Re: What Label.WhenAction supposed to do? [message #1860 is a reply to message #1845] Fri, 24 March 2006 00:05 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Wed, 22 March 2006 13:47


Luigi, as an old C programmer I can tell you that you will lose more time with C programming style... Smile. I used this style in my example just for clarity and to have less lines...

And to make a shift from C to C++ you don't need to much time unless you spend time following tutorials which are written with a purpose to make money...

My guess is that your laziness simply hides fear of unknown...

My advice - do it in a lazy man's way Smile - learn from code samples, try to make programs and do not hesitate asking questions here!


Thank you for your advice. I'll try to fill the gap. I know the principle of C++ and I've even written some thing many years ago. But when now I approached again the C++ to use it in GUI development I see it is a mess.

Please let me ask you what is the word THISBACK that appear in the code and in assist menu'. For example in the reference assembly the package 'menu':

#include <CtrlLib/CtrlLib.h>

struct App : public TopWindow {
	bool numbers_enabled;

	void Exit()
	{
		Close();
	}

	void EnableNumbers()
	{
		numbers_enabled = !numbers_enabled;
	}

	void ShowNumber(int n)
	{
		PromptOK(AsString(n));
	}

	void SubMenu(Bar& bar)
	{
		for(int i = 0; i < 10; i++)
			bar.Add(AsString(i), t_(THISBACK1)(ShowNumber, i));
	}

	void Menu(Bar& bar)
	{
		bar.Add("Enable numbers", THISBACK(EnableNumbers))
		   .Check(numbers_enabled);
		bar.Add(numbers_enabled, "Numbers", THISBACK(SubMenu));
		bar.Add("Exit", THISBACK(Exit))
		   .Key(K_CTRL_E);
	}

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

	MenuBar menu;

	typedef App CLASSNAME;

	App()
	{
		numbers_enabled = false;
		AddFrame(menu);
		menu.Set(THISBACK(MainBar));
	}
};

GUI_APP_MAIN
{
	App().Run();
}


has some error somewhere because the compiler report:
C:\upp\reference\Menu\menu.cpp: In member function `void App::SubMenu(Bar&)':
C:\upp\reference\Menu\menu.cpp:24: error: `THISBACK1' undeclared (first use this function)

The THISBACK in assist sometime show the list of callback while sometime show nothing. Can you say two words about its purpose and how to use?

Many thanks in advance,
Luigi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: CtrlLayoutOKCancel - detecting Cancel vs Bad input?
Next Topic: 603.r9 TreeCtrl etc. repaint optimization [BUG?]-No,feature.ParentCtrl and Ctrl
Goto Forum:
  


Current Time: Sat Jun 07 19:41:51 CEST 2025

Total time taken to generate the page: 0.04677 seconds