|
|
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...
Newbie Problems with the menu example... [message #3515] |
Tue, 30 May 2006 19:12 |
_Seven_
Messages: 35 Registered: April 2006
|
Member |
|
|
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();
}
[Updated on: Wed, 31 May 2006 16:47] by Moderator Report message to a moderator
|
|
|
Re: Problems with the code [message #3516 is a reply to message #3515] |
Tue, 30 May 2006 19:47 |
|
forlano
Messages: 1202 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 .
[Updated on: Tue, 30 May 2006 19:48] Report message to a moderator
|
|
|
|
Re: Problems with the code [message #3523 is a reply to message #3516] |
Wed, 31 May 2006 09:07 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
forlano wrote on Tue, 30 May 2006 18:47 |
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 .
|
Thanks, Luigi, for your help.
Seven,
1. when posting, please, try hard to make your topic name unique. Think, if all topics are named "Problems with code"... or "Help".
2. Also, in cases like yours (when code doesn't compile), post the first few lines of compiler output. Compiler messages should be helpful to name your topic and ... find the "problems with the code"...
|
|
|
|
|
Goto Forum:
Current Time: Sat Sep 21 04:37:36 CEST 2024
Total time taken to generate the page: 0.04601 seconds
|
|
|