Moving a Slate Widget

I’m working on making a moveable window. I want to be able to reposition the slate widget because I am trying to implement drag and drop. This means I need to use SCanvas to be able to use .Position(x,y) to reposition the window. The problem is, I cannot figure out a way to hold onto a reference to SCanvas::FSlot since SCanvas::AddSlot() apparently doesn’t return anything. Here is a snipit of my code:



void SInventory::Construct(const FArguments& InArgs)
{
	FSlateBrush* imageSlateBrush = new FSlateBrush();

	this->OwnerHUD = InArgs._OwnerHUD;
	this->InventoryBackgroundTexture = InArgs._InventoryBackgroundTexture;

	//Prevent construction more than once.
	if (myIsConstructed == false)
	{
		//Convert our UTexture2D to an FSlateBrush.
		imageSlateBrush->SetResourceObject(InventoryBackgroundTexture.Get());

		//Set our slate brush as the background for the widget.
		myInventoryBackgroundImage->SetImage(imageSlateBrush);

		SCanvas::FSlot temp = myInventoryCanvas->AddSlot()
			.Position(FVector2D(myXPosition, myYPosition))
			.Size(FVector2D(myWidth, myHeight))
			.AttachWidget(myInventoryBackgroundImage);


		ChildSlot
			.HAlign(EHorizontalAlignment::HAlign_Center)
			.VAlign(EVerticalAlignment::VAlign_Center)
			
				SAssignNew(myInventoryCanvas, SCanvas)
			];

		myIsConstructed = true;
	}
}


All I am trying to get working is a canvas that has a background image to be able to be dragged and dropped.


myInventoryCanvas->AddSlot()
.Expose(canvas_slot)