Origin Version (Select Help-->About Origin): 7.5 SR5 Operating System: Win2k
Hello everybody,
currently I'm trying to manipulate the size and position of GraphObjects programmatically. First I tried the Top/Left/Width/Height data fields. But this works only for Top/Left and not for Width/Height since the latter two are readonly. So I switched to the X/Y/DX/DY data fields. However they are using scale units instead of pixels. Since I want to rescale a GraphObject depending of the size of some GraphObjects on another layer, I run into problems the very moment the scale of the layers differs.
Is there maybe a function that converts scale units of a specific layer in pixels or something similar?
quote:But this works only for Top/Left and not for Width/Height since the latter two are readonly.
I see that's correct but it's odd since the corresponding LabTalk properties are read/write. If the graph object is in the active layer you can do things like this (assuming a rectangle for illustration)...
using Rect = LabTalk.Rect; Rect.Top = 10; Rect.Left = 10; Rect.Width = 1000; Rect.Height = 500;
Interestingly the code behaves differently depending on whether it is run from a script window or from OriginC using LT_execute. In the latter case resizing the rectangle changes the position of the upper left corner. However, setting first "Width" and "Height" and then "Top" and "Left" solves the problem.