Beispiel #1
0
void NativeEditBox::textBoxClosed(int res, int length) {
	if(res == MA_TB_RES_OK) {
		MAUI_LOG("length: %d", length);
		String str;
		str.resize(length);
		sprintf(str.pointer(), "%S", mString);
		setCaption(str);
		MAUI_LOG("%S", mString);
		requestRepaint();
		// TODO: Remove commented out code.
		/*
		if(mListener != NULL) {
			mListener->nativeEditFinished();
		}
		*/		
		ListenerSet_fire(
			NativeEditBoxListener, 
			mEditBoxListeners, 
			nativeEditFinished(this, mCaption));
		
	}
	// TODO: Remove commented out code.
	//mListener = NULL;
	Environment::getEnvironment().removeTextBoxListener(this);
}
Beispiel #2
0
bool DefaultInputPolicy::keyPressed(int keyCode, int nativeCode) {
	if(!mOwner->isEnabled())
		return false;
	bool ret = mOwner->keyPressed(keyCode, nativeCode);
	if (!ret) {
		Direction dir = mapKeyCodeToDirection(keyCode);
		if (dir != NONE) {
			Widget* newFocus;
			newFocus = mOwner->getFocusableInDirectionFrom(mOwner, dir);
			if (newFocus) {
				MAUI_LOG("Got new focus!");
				mOwner->setFocused(false);
				Screen::getCurrentScreen()->setFocusedWidget(newFocus);			
				//newFocus->setFocused(true);
				//ret = newFocus->keyPressed(keyCode, nativeCode);
			}
		}
	}

	return ret;
}