The Moved action of Dot has a Set Size action uses this expression:
[[LVAR1.height + DragY]]
- Where LVAR1 points to the “Stretch_block” widget
- You can also use Target.height to refer to the target of the action without the LVAR1 local variable. This makes it easier to code and more extensible.
- The DragY variable would equal 0 (zero) when the Dot widget is moved without a drag
- So, moving Dot with a click on the background rectangle widget results in no change:
(Current height + 0)
If you change the math in your expression, then any time (and by any means) the dot is moved, the height of “Stretch_block” gets set based on the location of “Dot”:
[[This.top - Target.top - 20]]
- “This” refers to the widget calling the action, so the “Dot” widget
- “Target” refers to the recipient of the action, so the “Stretch_block” widget
- “20” is the number of pixels between these two widgets (as you set in your .rp file), in other words, the margin space between them
Also, if you only want to change the height of a widget, you can leave the width field blank. This is easier and more flexible/extensible–for example, if you later change the width of “Stretch_block” or set it to fit to contents, etc. you won’t have to go back and update the width value (from 339 to whatever.)