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 » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Newbie Problems with the menu example...
Re: Problems with the code [message #3516 is a reply to message #3515] Tue, 30 May 2006 19:47 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
_Seven_ wrote on Tue, 30 May 2006 19:12

Hi everyone. I am trying follow an example posted on site of U++ and i tried to create the same program but it's not work. I don't know where is the problem. Can you help me? Where i am wrong?
The code:
#include <CtrlLib/CtrlLib.h>

struct App : public TopWindow{
	bool list_numbers;
	
	void Exit(){
		Close();
	}
	void List_Numbers(){
		list_numbers=!list_numbers;
	}
	void show(int i){
		PromptOK(AsString(i));
	}
	void draw(Bar& bar){
		for(int i=0;i<10;i++)
			bar.Add(AsString(i), THISBACK(show,i));
	}
	void Opcoes(Bar& bar){
		bar.Add("Mostrar numeros", THISBACK(List_Numbers));
		bar.Add("Lista :", THISBACK(draw));
		bar.Add("Sair", THISBACK(Exit)).Key(CTRL_Q);
	}
	void MenuBar(Bar& bar){
		bar.Add("Opcoes",THISBACK(Opcoes));
	}
		
	MainBar Opcoes;
	typedef App CLASSNAME;
	
	App(){
        numbers_enabled = true;
        AddFrame(Opcoes);
        menu.Set(THISBACK(MainBar));
    }
};

GUI_APP_MAIN
{
	App.Run();
}





Hello Seven,

to help us (at least me) to help you please add some other information. For example let me know which was the original example you are referring to. In your code I see several mistakes. For example:

	bar.Add(AsString(i), THISBACK(show,i));

should be
	bar.Add(AsString(i), THISBACK1(show,i));

Please note the '1' as you are passing "one" parameter to show() method. There are other problems but first address me to the original example in this forum.

Luigi

PS: I guess our administrator will move this post in another forum, perhaps here:
http://www.arilect.com/upp/forum/index.php?t=thread&frm_ id=21& It is very important to post in the right place to speed up the answer and even to help new user to find what they need in few clicks. To have an idea about the topics treated in each forum try to have a look at them. I started in this manner and after some mistakes I learned where to post correctly, at least most of the time Smile .

[Updated on: Tue, 30 May 2006 19:48]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mechatronic transmission project [was -Please, help me!]
Next Topic: Problems with the position of buttons
Goto Forum:
  


Current Time: Mon Jun 02 19:48:29 CEST 2025

Total time taken to generate the page: 0.03051 seconds