simple label example doesn't execute in emulator

3 posts / 0 new
Last post
Eric Gbofu
sangohan's picture
Offline
Joined: 23 Mar 2011
Posts:
simple label example doesn't execute in emulator

Hi all,
A very simple label example code don't execute in the MoRE emulator (just the background color appear). Only examples in MoSync execute.
Here is the code and tell me please why i don't see a label on the screen:
---------------------------------------

#include
#include
#include

using namespace MAUtil;
using namespace MAUI;

class MyScreen : public Screen {
public:
MyScreen() {
Label *l=new Label(0,0,50,50,NULL);
l->setBackgroundColor(0x0e419f);
l->setCaption("Welcome Eric");
setMain(l);

}

~MyScreen() {
// todo: delete main widget of this screen
}

void keyPressEvent(int keycode){
if(keycode==MAK_5)
maExit(0);
}
private:
};

class MAUIMoblet : public Moblet {
public:
MAUIMoblet() {
// initialize
screen = new MyScreen();
screen->show();
}

void keyPressEvent(int keyCode, int nativeCode) {
// todo: handle key presses
}

void keyReleaseEvent(int keyCode, int nativeCode) {
// todo: handle key releases
}
MyScreen* screen;

~MAUIMoblet() {
delete screen;
}

};

extern "C" int MAMain() {
Moblet::run(new MAUIMoblet());
return 0;
};

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi, it looks like you've not set up a font. You need to a font class, and optionally set it as the default font
Font* f = new Font(FONT); //Where FONT is the name of the font resource in the resource file
Environment::getSingleton().setDefaultFont(f);

Eric Gbofu
sangohan's picture
Offline
Joined: 23 Mar 2011
Posts:

Thanks sam. It works