Basic C++ Dialog Box Issue

Hi there,

I am certainly not familiar with C++ programming but I have managed to fumble myself through making a very basic plugin.

The issue I am having, however, is that I have a dialog box pop up on pressing a button in the editor. There are two variables that can be edited in that dialog box and upon pressing “Ok” those values are meant to be saved to a text file.

However, when changing the values they immediately revert to their previous values when the text box loses focus/pressing “Ok”. Additionally, the saved values are seemingly random numbers. Eg. - 1082130432 1082130432.

image

Here are two snippets of code that I believe are relevant:

        [
            SNew(SNumericEntryBox<int32>)
                .Value(ResolutionX)
                .OnValueChanged_Lambda([&](int32 NewValue) { ResolutionX = NewValue; })
        ]
        [
            SNew(SButton)
                .Text(FText::FromString(TEXT("OK")))

                // Before closing the window, save ResolutionX and ResolutionY
                .OnClicked_Lambda([Window, this, &ResolutionX, &ResolutionY]() -> FReply {
                SaveResolutionSettings(ResolutionX, ResolutionY);
                Window->RequestDestroyWindow();
                return FReply::Handled();
                    })
        ]

I know that this is probably a simple issue but I’m finding it hard to find relevant information

Thanks in advance!