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 #3520 is a reply to message #3516] Wed, 31 May 2006 07:19 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
This work:
#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), THISBACK1(show,i));
	}
	void Opcoes(Bar& bar){
		bar.Add("Mostrar numeros", THISBACK(List_Numbers));
		bar.Add("Lista :", THISBACK(draw));
		bar.Add("Sair", THISBACK(Exit)).Key(K_CTRL_Q);
	}
	void MainBar(Bar& bar){
		bar.Add("Opcoes",THISBACK(Opcoes));
	}
		
	MenuBar opcoes;
	typedef App CLASSNAME;
	
	App(){
        list_numbers = true;
        AddFrame(opcoes);
        opcoes.Set(THISBACK(MainBar));
    }
};

GUI_APP_MAIN
{
	App().Run();
}


You mixed up the old code with the new one. Moreover there were some mistakes due to variable with capital letter. Compare it with your previous code to see the difference and understand the errors.
Luigi
 
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: Fri Jul 18 16:05:05 CEST 2025

Total time taken to generate the page: 0.00421 seconds