OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: roy_043 on May 20, 2011, 05:04:19 AM

Title: Constrain movement of controls?
Post by: roy_043 on May 20, 2011, 05:04:19 AM
Grid spacing 6
control1 top = 5
control2 top = 7

If you select both controls and move them horizontally both will have a new top of 6. Is there a way to constrain the movement to the X direction so that the top values do not change?
Title: Re: Constrain movement of controls?
Post by: owenwengerd on May 20, 2011, 05:22:49 AM
I think there is a feature request for something like this. I think the best solution is to always keep the controls' relative spacing the same when dragging multiple controls, and snap the entire set to the upper-left corner of the selection bounding box.
Title: Re: Constrain movement of controls?
Post by: roy_043 on May 25, 2011, 12:29:42 AM
Thank you Owen for your reply. I am not sure I correctly understand the terms you use:

keep the controls' relative spacing the same
Upper-left point of each control matches a grid point?

snap the entire set to the upper-left corner of the selection bounding box
Each control is a aligned top from top edge of parent and left from left edge of parent?

A simple way to constrain the movement of controls is to use the arrow keys instead of dragging them. It is not a very convenient method though: a 50 pixel shift requires 50 arrow key clicks.
Title: Re: Constrain movement of controls?
Post by: owenwengerd on May 25, 2011, 04:46:42 AM
Quote from: roy_043 on May 25, 2011, 12:29:42 AM
A simple way to constrain the movement of controls is to use the arrow keys instead of dragging them. It is not a very convenient method though: a 50 pixel shift requires 50 arrow key clicks.

Have you tried just setting the grid spacing to <None>?
Title: Re: Constrain movement of controls?
Post by: roy_043 on May 26, 2011, 12:10:05 AM
Quote from: owenwengerd on May 25, 2011, 04:46:42 AM
Have you tried just setting the grid spacing to <None>?
Yes I have. But constraining your hand movement to the X or Y direction is not that easy.
Title: Re: Constrain movement of controls?
Post by: Fred Tomke on May 26, 2011, 12:31:26 AM
Hi,

Quote from: roy_043 on May 25, 2011, 12:29:42 AM
[...] a 50 pixel shift requires 50 arrow key clicks.

A techno song with 120 bpm will help you :)

Fred
Title: Re: Constrain movement of controls?
Post by: roy_043 on May 31, 2011, 04:26:11 AM
Quote from: Fred Tomke on May 26, 2011, 12:31:26 AM
A techno song with 120 bpm will help you :)
This AHK (http://www.autohotkey.com/) script is a little easier on the eardrums (and blood pressure):


#Persistent
#SingleInstance, Force
Menu, Tray, Icon, C:\Program Files\OpenDCL Studio\ENU\Studio.Res.dll
Menu, Tray, NoStandard
Menu, Tray, Add, Exit, Exit
Menu, Tray, Add, ODCL AHK Move, ODCL_AHK_Move
Menu, Tray, Default, ODCL AHK Move
Menu, Tray, Click, 1
Return

ODCL_AHK_Move:
InputBox, UserInput, ODCL AHK Move, Please enter e.g.: X-30 or Y+10, , 220, 115
action := SubStr(UserInput, 1, 2)
repeat := SubStr(UserInput, 3)
if (action = "x+")
  key = {RIGHT}
else if (action = "x-")
  key = {LEFT}
else if (action = "y+")
  key = {DOWN}
else if (action = "y-")
  key = {UP}
IfWinNotActive, OpenDCL Studio, , WinActivate, OpenDCL Studio,
WinWaitActive, OpenDCL Studio,
Loop, %repeat%
  Send, %key%
Return

Exit:
ExitApp


EDIT: Improved code