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