diff --git a/Content/LinacLab/MyMyUserWidget.uasset b/Content/LinacLab/MyMyUserWidget.uasset index d500bac..feb2a24 100644 --- a/Content/LinacLab/MyMyUserWidget.uasset +++ b/Content/LinacLab/MyMyUserWidget.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:11e8514b18320c3d2e6322ab8b495a14b54a7ffd72d4eda797735de5348f750a -size 121786 +oid sha256:d66709ef9fbfc4c0e7d50f3c62dc930beedccdccd53b8367b2897c2f62a00ba3 +size 132543 diff --git a/Source/MyProject/Private/MagicFloatInput.cpp b/Source/MyProject/Private/MagicFloatInput.cpp index 9613d23..d0c4f04 100644 --- a/Source/MyProject/Private/MagicFloatInput.cpp +++ b/Source/MyProject/Private/MagicFloatInput.cpp @@ -15,9 +15,11 @@ void UMagicFloatInput::HandleOnTextCommitted( x = FCString::Atod(*inText.ToString()); SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x))); - HandleMagicFloatsMangledEvent(); -} - -void UMagicFloatInput::HandleMagicFloatsMangledEvent() { - OnMagicFloatsMangled.ExecuteIfBound(); + if (myVerifier != nullptr) { + if (sourceInput->GetText().EqualTo(GetText())) { + myVerifier->SetText(FText::FromString("VERIFIED")); + } else { + myVerifier->SetText(FText()); + } + } } diff --git a/Source/MyProject/Private/VerifierTextBlock.cpp b/Source/MyProject/Private/VerifierTextBlock.cpp deleted file mode 100644 index 5f18f59..0000000 --- a/Source/MyProject/Private/VerifierTextBlock.cpp +++ /dev/null @@ -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 - ); - } -} diff --git a/Source/MyProject/Public/MagicFloatInput.h b/Source/MyProject/Public/MagicFloatInput.h index 7ac7c17..b72c5d2 100644 --- a/Source/MyProject/Public/MagicFloatInput.h +++ b/Source/MyProject/Public/MagicFloatInput.h @@ -7,8 +7,6 @@ #include #include "MagicFloatInput.generated.h" -DECLARE_DELEGATE(FOnMagicFloatsMangledDelegate); - /** * */ @@ -27,9 +25,4 @@ class MYPROJECT_API UMagicFloatInput : public UEditableTextBox { UPROPERTY(EditAnywhere) UTextBlock * myVerifier; - - UFUNCTION() - void HandleMagicFloatsMangledEvent(); - - FOnMagicFloatsMangledDelegate OnMagicFloatsMangled; }; diff --git a/Source/MyProject/Public/VerifierTextBlock.h b/Source/MyProject/Public/VerifierTextBlock.h deleted file mode 100644 index 35b55c2..0000000 --- a/Source/MyProject/Public/VerifierTextBlock.h +++ /dev/null @@ -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; -};