Ejemplo n.º 1
0
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 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;
}