working float verification
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.
@ -15,9 +15,11 @@ 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)));
|
||||||
HandleMagicFloatsMangledEvent();
|
if (myVerifier != nullptr) {
|
||||||
}
|
if (sourceInput->GetText().EqualTo(GetText())) {
|
||||||
|
myVerifier->SetText(FText::FromString("VERIFIED"));
|
||||||
void UMagicFloatInput::HandleMagicFloatsMangledEvent() {
|
} else {
|
||||||
OnMagicFloatsMangled.ExecuteIfBound();
|
myVerifier->SetText(FText());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#include "VerifierTextBlock.h"
|
|
||||||
|
|
||||||
void UVerifierTextBlock::NativeOnInitialized() {
|
|
||||||
if (destInput != nullptr) {
|
|
||||||
destInput->OnMagicFloatsMangled.BindUObject(
|
|
||||||
this,
|
|
||||||
&UVerifierTextBlock::verifyFloats
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,8 +7,6 @@
|
|||||||
#include <Components/TextBlock.h>
|
#include <Components/TextBlock.h>
|
||||||
#include "MagicFloatInput.generated.h"
|
#include "MagicFloatInput.generated.h"
|
||||||
|
|
||||||
DECLARE_DELEGATE(FOnMagicFloatsMangledDelegate);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -27,9 +25,4 @@ class MYPROJECT_API UMagicFloatInput : public UEditableTextBox {
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
UTextBlock * myVerifier;
|
UTextBlock * myVerifier;
|
||||||
|
|
||||||
UFUNCTION()
|
|
||||||
void HandleMagicFloatsMangledEvent();
|
|
||||||
|
|
||||||
FOnMagicFloatsMangledDelegate OnMagicFloatsMangled;
|
|
||||||
};
|
};
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "Components/TextBlock.h"
|
|
||||||
#include "MagicFloatInput.h"
|
|
||||||
#include "VerifierTextBlock.generated.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
UCLASS()
|
|
||||||
class MYPROJECT_API UVerifierTextBlock : public UTextBlock {
|
|
||||||
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
|
||||||
UTextBlock * sourceInput;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
|
||||||
UMagicFloatInput * destInput;
|
|
||||||
|
|
||||||
void verifyFloats();
|
|
||||||
|
|
||||||
void BeginPlay() override;
|
|
||||||
};
|
|
Reference in New Issue
Block a user