FReply SCodeEditableText::OnKeyChar(const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent)
{
	FReply Reply = FReply::Unhandled();

	const TCHAR Character = InCharacterEvent.GetCharacter();
	if(Character == TEXT('\t'))
	{
		if (!GetIsReadOnly())
		{
			FString String;
			String.AppendChar(Character);
			InsertTextAtCursor(String);
			Reply = FReply::Handled();
		}
		else
		{
			Reply = FReply::Unhandled();
		}
	}
	else
	{
		Reply = SMultiLineEditableText::OnKeyChar( MyGeometry, InCharacterEvent );
	}

	return Reply;
}
FReply FSceneViewport::OnKeyChar( const FGeometry& InGeometry, const FCharacterEvent& InCharacterEvent )
{
	// Start a new reply state
	CurrentReplyState = FReply::Handled(); 

	if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue  )
	{
		// Switch to the viewport clients world before processing input
		FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );

		if (!ViewportClient->InputChar(this, InCharacterEvent.GetUserIndex(), InCharacterEvent.GetCharacter()))
		{
			CurrentReplyState = FReply::Unhandled();
		}
	}
	return CurrentReplyState;
}
bool FCEFWebBrowserWindow::OnKeyChar(const FCharacterEvent& InCharacterEvent)
{
	if (IsValid() && !bIgnoreCharacterEvent)
	{
		PreviousCharacterEvent = InCharacterEvent;
		CefKeyEvent KeyEvent;
#if PLATFORM_MAC
		KeyEvent.character = InCharacterEvent.GetCharacter();
#else
		KeyEvent.windows_key_code = InCharacterEvent.GetCharacter();
#endif
		KeyEvent.type = KEYEVENT_CHAR;
		KeyEvent.modifiers = GetCefInputModifiers(InCharacterEvent);

		InternalCefBrowser->GetHost()->SendKeyEvent(KeyEvent);
		return true;
	}
	return false;
}
void FWebBrowserWindow::OnKeyChar(const FCharacterEvent& InCharacterEvent)
{
	if (IsValid())
	{
		CefKeyEvent KeyEvent;
#if PLATFORM_MAC
		KeyEvent.character = InCharacterEvent.GetCharacter();
#else
		KeyEvent.windows_key_code = InCharacterEvent.GetCharacter();
#endif
		// TODO: Figure out whether this is a system key if we come across problems
		/*KeyEvent.is_system_key = message == WM_SYSCHAR ||
			message == WM_SYSKEYDOWN ||
			message == WM_SYSKEYUP;*/

		KeyEvent.type = KEYEVENT_CHAR;
		KeyEvent.modifiers = GetCefInputModifiers(InCharacterEvent);

		InternalCefBrowser->GetHost()->SendKeyEvent(KeyEvent);
	}
}
FReply SPythonEditableText::OnKeyChar(const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent)
{
	FReply Reply = FReply::Unhandled();

	const TCHAR Character = InCharacterEvent.GetCharacter();
	if (IsTextReadOnly())
	{
		return Reply;
	}
	Reply = FReply::Handled();
	// substitute tab, with 4 spaces
	if (Character == TEXT('\t'))
	{
		InsertTextAtCursor(FString("    "));
	}
	//else if (Character == TEXT('('))
	//{
	//	FString String=TEXT("()");
	//	InsertTextAtCursor(String);
	//}
	//else if (Character == TEXT('['))
	//{
	//	FString String = TEXT("[]");
	//	InsertTextAtCursor(String);
	//}
	//else if (Character == TEXT('{'))
	//{
	//	FString String = TEXT("{}");
	//	InsertTextAtCursor(String);
	//}
	//else if (Character == TEXT('\''))
	//{
	//	FString String = TEXT("''");
	//	InsertTextAtCursor(String);
	//}
	//else if (Character == TEXT('"'))
	//{
	//	FString String = TEXT("\"\"");
	//	InsertTextAtCursor(String);
	//}
	else
	{
		Reply = SMultiLineEditableText::OnKeyChar(MyGeometry, InCharacterEvent);
	}

	return Reply;
}
FReply FTextEditHelper::OnKeyChar( const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent, class ITextEditorWidget& TextEditor )
{
	FReply Reply = FReply::Unhandled();

	// Check for special characters
	const TCHAR Character = InCharacterEvent.GetCharacter();

	switch( Character )
	{
		// Backspace
	case TCHAR( 8 ):
		{
			if( !TextEditor.GetIsReadOnly() )
			{
				FScopedTextTransaction TextTransaction(TextEditor);

				TextEditor.BackspaceChar();
				
				Reply = FReply::Handled();
			}
		}
		break;


		// Tab
	case TCHAR( '\t' ):
		{
			Reply = FReply::Handled();
		}
		break;


		// Swallow OnKeyChar keys that we don't want to be entered into the buffer
	case 1:		// Swallow Ctrl+A, we handle that through OnKeyDown
	case 3:		// Swallow Ctrl+C, we handle that through OnKeyDown
	case 13:	// Swallow Enter, we handle that through OnKeyDown
	case 22:	// Swallow Ctrl+V, we handle that through OnKeyDown
	case 24:	// Swallow Ctrl+X, we handle that through OnKeyDown
	case 25:	// Swallow Ctrl+Y, we handle that through OnKeyDown
	case 26:	// Swallow Ctrl+Z, we handle that through OnKeyDown
	case 27:	// Swallow ESC, we handle that through OnKeyDown
	case 127:	// Swallow CTRL+Backspace, we handle that through OnKeyDown
		Reply = FReply::Handled();
		break;


		// Any other character!
	default:
		{
			// Type the character, but only if it is allowed.
			if (!TextEditor.GetIsReadOnly() && TextEditor.CanTypeCharacter(Character))
			{
				FScopedTextTransaction TextTransaction(TextEditor);
				TextEditor.TypeChar( Character );
				Reply = FReply::Handled();
			}
			else
			{
				Reply = FReply::Unhandled();
			}
		}
		break;

	}


	return Reply;
}
Beispiel #7
0
FReply FTextEditHelper::OnKeyChar( const FCharacterEvent& InCharacterEvent, const TSharedRef< ITextEditorWidget >& TextEditor )
{
	FReply Reply = FReply::Unhandled();

	// Check for special characters
	const TCHAR Character = InCharacterEvent.GetCharacter();

	switch( Character )
	{
		// Backspace
	case TCHAR( 8 ):
		{
			if( !TextEditor->GetIsReadOnly() )
			{
				FScopedTextTransaction TextTransaction(TextEditor);

				TextEditor->BackspaceChar();
				
				Reply = FReply::Handled();
			}
		}
		break;


		// Tab
	case TCHAR( '\t' ):
		{
			Reply = FReply::Handled();
		}
		break;


		// Newline (Ctrl+Enter), we handle adding new lines via SMultiLineEditableText::OnEnter rather than processing \n characters
	case TCHAR( '\n' ):
		{
			Reply = FReply::Handled();
		}
		break;


		// Swallow OnKeyChar keys that we don't want to be entered into the buffer
	case 1:		// Swallow Ctrl+A, we handle that through OnKeyDown
	case 3:		// Swallow Ctrl+C, we handle that through OnKeyDown
	case 13:	// Swallow Enter, we handle that through OnKeyDown
	case 22:	// Swallow Ctrl+V, we handle that through OnKeyDown
	case 24:	// Swallow Ctrl+X, we handle that through OnKeyDown
	case 25:	// Swallow Ctrl+Y, we handle that through OnKeyDown
	case 26:	// Swallow Ctrl+Z, we handle that through OnKeyDown
	case 27:	// Swallow ESC, we handle that through OnKeyDown
	case 127:	// Swallow CTRL+Backspace, we handle that through OnKeyDown
		Reply = FReply::Handled();
		break;


		// Any other character!
	default:
		{
			// Type the character, but only if it is allowed.
			if (!TextEditor->GetIsReadOnly() && TextEditor->CanTypeCharacter(Character))
			{
				FScopedTextTransaction TextTransaction(TextEditor);
				TextEditor->TypeChar( Character );
				Reply = FReply::Handled();
			}
			else
			{
				Reply = FReply::Unhandled();
			}
		}
		break;

	}


	return Reply;
}