About Store Forum Documentation Contact



Post Reply 
Loading Gui Objects
Author Message
radez Offline
Member

Post: #1
Loading Gui Objects
Hi,

In the modified Loading Gui Objects tutorial, I added combobox loaded from file.When i use
Code:
ComboBox *combo;
...
D.text ( 0, 0.9,S+"combo element: "+combo() ); // draw selected element

complier generate error: " term does not evaluate to a function taking 0 arguments". That work well when combo isn't pointer but i want to use gui editor, not create gui by code. How to deal with it?
12-06-2009 05:09 PM
Find all posts by this user Quote this message in a reply
jordicat Offline
Member

Post: #2
RE: Loading Gui Objects
Hi radez,
D.text ( 0, 0.9,S+"combo element: "+combo() );

I suppose that S ia a string. combo is a pointer to object gui ComboBox, so you are trying to create a string with a pointer S+string+pointer to object that is not a string, so there is a syntax mistake. The expresion combo() is not a string and it must be a string.
12-06-2009 05:57 PM
Find all posts by this user Quote this message in a reply
radez Offline
Member

Post: #3
RE: Loading Gui Objects
the problem is that i can't run combo() if it is pointer; for example
Code:
int x;
ComboBox combo;
Gui+=combo.create(Rect_C(0.5,0,0.4,0.08))
...
x=combo(); //return index of selected element (int value)
this work well
Code:
int x;
ComboBox *combo; //pointer
if(gui_objs.load("edytor.gobj"))
   {
Gui+=gui_objs;
combo=gui_objs.getComboBox("combo");
}
x=combo();

this not work, generate error:"error C2064: term does not evaluate to a function taking 0 arguments"
12-06-2009 06:32 PM
Find all posts by this user Quote this message in a reply
jordicat Offline
Member

Post: #4
RE: Loading Gui Objects
if you wrote x=combo(), the compiler understand that you want to execute a function named combo, but combo is a pointer to a object ComboBox. Yet, I am not an expert of esenthel gui, but this is syntax error in C++ context.
Try to write this, for the compiler is the same than the first version:
x = (*combo)();
12-06-2009 08:52 PM
Find all posts by this user Quote this message in a reply
radez Offline
Member

Post: #5
RE: Loading Gui Objects
Thx that work. I tried *combo() but not (*combo)() i'm not often write in C/C++, it was simple mistake :(
12-06-2009 09:46 PM
Find all posts by this user Quote this message in a reply
Post Reply