most of therac ui done
This commit is contained in:
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
Binary file not shown.
@ -6,6 +6,8 @@ void UMagicFloatInput::HandleOnTextCommitted(
|
|||||||
FText const & inText,
|
FText const & inText,
|
||||||
ETextCommit::Type inCommitMethod
|
ETextCommit::Type inCommitMethod
|
||||||
) {
|
) {
|
||||||
|
if (inCommitMethod == ETextCommit::OnEnter) {
|
||||||
|
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
if (inText.IsEmptyOrWhitespace()) {
|
if (inText.IsEmptyOrWhitespace()) {
|
||||||
if (sourceInput != nullptr) {
|
if (sourceInput != nullptr) {
|
||||||
@ -15,6 +17,14 @@ void UMagicFloatInput::HandleOnTextCommitted(
|
|||||||
x = FCString::Atod(*inText.ToString());
|
x = FCString::Atod(*inText.ToString());
|
||||||
|
|
||||||
SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x)));
|
SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x)));
|
||||||
|
if (next != nullptr) {
|
||||||
|
next->SetFocus();
|
||||||
|
next->SetKeyboardFocus();
|
||||||
|
} else if (cmdInput != nullptr) {
|
||||||
|
cmdInput->SetFocus();
|
||||||
|
cmdInput->SetKeyboardFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (myVerifier != nullptr) {
|
if (myVerifier != nullptr) {
|
||||||
if (sourceInput->GetText().EqualTo(GetText())) {
|
if (sourceInput->GetText().EqualTo(GetText())) {
|
||||||
myVerifier->SetText(FText::FromString("VERIFIED"));
|
myVerifier->SetText(FText::FromString("VERIFIED"));
|
||||||
|
@ -4,7 +4,13 @@
|
|||||||
#include <Logging/StructuredLog.h>
|
#include <Logging/StructuredLog.h>
|
||||||
|
|
||||||
void UModeInputTextBox::HandleOnTextChanged(FText const & inText) {
|
void UModeInputTextBox::HandleOnTextChanged(FText const & inText) {
|
||||||
Text = Text.GetEmpty();
|
/*
|
||||||
|
if (GetText().IsEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SetText(FText());
|
||||||
|
*/
|
||||||
|
Text = FText();
|
||||||
auto & s = inText.ToString();
|
auto & s = inText.ToString();
|
||||||
// UE_LOGFMT(LogTemp, Warning, "kill me {inText}", s);
|
// UE_LOGFMT(LogTemp, Warning, "kill me {inText}", s);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ bool UMyUserWidget::AllVerified() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UMyUserWidget::NativeOnInitialized() {
|
void UMyUserWidget::NativeOnInitialized() {
|
||||||
|
// commandInput->SetClearKeyboardFocusOnCommit(false);
|
||||||
auto ps = StaticCast<AMyPlayerState *>(GetOwningPlayerState());
|
auto ps = StaticCast<AMyPlayerState *>(GetOwningPlayerState());
|
||||||
if (ps == nullptr)
|
if (ps == nullptr)
|
||||||
return;
|
return;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Components/EditableTextBox.h"
|
#include "Components/EditableTextBox.h"
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include <Components/TextBlock.h>
|
#include <Components/TextBlock.h>
|
||||||
|
#include <ModeInputTextBox.h>
|
||||||
#include "MagicFloatInput.generated.h"
|
#include "MagicFloatInput.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,14 +16,18 @@ class MYPROJECT_API UMagicFloatInput : public UEditableTextBox {
|
|||||||
|
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
void HandleOnTextCommitted(
|
void HandleOnTextCommitted(FText const & Text, ETextCommit::Type CommitMethod)
|
||||||
FText const & Text,
|
override;
|
||||||
ETextCommit::Type CommitMethod
|
|
||||||
) override;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
UTextBlock * sourceInput;
|
UTextBlock * sourceInput;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
UTextBlock * myVerifier;
|
UTextBlock * myVerifier;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
UMagicFloatInput * next;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere)
|
||||||
|
UModeInputTextBox * cmdInput;
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include <Components/TextBlock.h>
|
#include <Components/TextBlock.h>
|
||||||
|
#include <ModeInputTextBox.h>
|
||||||
#include "MyUserWidget.generated.h"
|
#include "MyUserWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,4 +77,8 @@ class MYPROJECT_API UMyUserWidget : public UUserWidget {
|
|||||||
bool AllVerified();
|
bool AllVerified();
|
||||||
|
|
||||||
void NativeOnInitialized() override;
|
void NativeOnInitialized() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(meta = (BindWidget), BlueprintReadWrite)
|
||||||
|
UModeInputTextBox * commandInput;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user