Ejemplo n.º 1
0
/**
 * Simple use case for the text box.
 * This program will show a text box and
 * retrieve the text entered by the user.
 */
extern "C" int MAMain() {
	// Initializations
	const wchar* title = L"My Title";
	const wchar* text = L"My Text";
	const int length = 1024;
	wchar buf[length];

	// Shows the text box
	// Returns when the text box is ready
	// to receive input
	maTextBox(title, text, buf, length, 0);

	// Event loop
	MAEvent event;
	maWait(0);
	while(maGetEvent(&event))
	{
		// Exit when the fire key is pressed
		if(event.type == EVENT_TYPE_KEY_PRESSED && event.key == MAK_FIRE) {
			maExit(0);
		}
		// When the TextBox closes, display the result (OK or CANCEL),
		// the text retrieved, and its length
		if( event.type == EVENT_TYPE_TEXTBOX ) {
			printf("Result (OK = 1 ; CANCEL = 2): %d\n", event.textboxResult);
			wprintf(L"The text box contained: %s\n", buf);
			printf("Length of the text: %d\n", event.textboxLength);
			printf("Press fire to exit...\n");
		}
		maWait(0);
	}
	return 0;
}
Ejemplo n.º 2
0
void NativeEditBox::activate(NativeEditBoxListener* listener) {
	mListener = listener;
	wsprintf(mString, L"%s",getCaption().c_str());
	int res = maTextBox((const wchar*)mTitleString.c_str(), (wchar*)mString,
		(wchar*)mString, mMaxSize, mOptions);
	if(res < 0) {
		PANIC_MESSAGE("maTextBox failed");
	}
	Environment::getEnvironment().addTextBoxListener(this);
}
Ejemplo n.º 3
0
void NativeEditBox::activate() {
	
#ifdef USE_NEWLIB
	swprintf(mString, mMaxSize, L"%s", mCaption.c_str());
#else
	wsprintf(mString, L"%s", mCaption.c_str());
#endif
	int res = 
		maTextBox(
			(const wchar*)mTitleString.c_str(), 
			(wchar*)mString,
			(wchar*)mString, 
			mMaxSize, 
			mOptions);
	if(res < 0) {
		PANIC_MESSAGE("maTextBox failed");
	}
	Environment::getEnvironment().addTextBoxListener(this);
}
Ejemplo n.º 4
0
BundleDownloader::BundleDownloader(BundleListener *bl):mSocket(this)
{
	mBundleListener = bl;
	maTextBox(L"Server IP:",L"localhost", mWServerAddress, 128, 0);
	Environment::getEnvironment().addTextBoxListener(this);
}