First of all, you would not be able to see the dynamic panel, “Box” resize, other than to see that its contents (the one gray rectangle) would appear to move with the Slider as you dragged it (because by default dynamic panels have a transparent fill.) But, you can directly resize the gray rectangle inside it and since the dynamic panel is set to “Fit to Content” then it’s size will change with the rectangle’s size.
Secondly, you don’t have a local variable defined for LVAR1 in your Set Size action. If you click Add Local Variable in the fx editor and point LVAR1 to the widget, “Box” (which I’ve renamed to “Box Panel”) then you can use its location to calculate the new width of the rectangle widget (which I’ve named “Box”). Here is the algorithm I use in the updated .rp file below:
[[ LVAR1.right - This.left - (This.width/2) ]]
Finally, I added some boundaries to limit the drag. Otherwise, you would be able to move the slider past the box itself, the box would disappear and the slider just moving around aimlessly. I somewhat arbitrarily used the width of the slider, but you can easily change the boundaries to whatever you need.
resize container.rp (51.3 KB)