Jump to content
Developer Wiki and Function Reference Links ×

Moving a Worksheet


WhoCanDo

Recommended Posts

I placed a worksheet on my drawing using ..

hW := CreateWSImage (GetObject ('Schedule'), 0, 0);

I would like to place it as follows ..

hW := CreateWSImage (GetObject ('Schedule'), 200 - (Width of WS), 200);

which will be inside the drawing border at the top right.

Since the WS reference point is top left then I need to move it Width(WS) to the left of the border.

How do I work out the width of the WS??

Link to comment

Haven't tried this, but maybe have a look at

http://developer.vectorworks.net/index.php/VS:GetWSPlacement

PROCEDURE GetWSPlacement(
            worksheet    :HANDLE;
            VAR top      :INTEGER;
            VAR left     :INTEGER;
            VAR bottom   :INTEGER;
            VAR right    :INTEGER);

worksheet		HANDLE		Handle to worksheet.
top		INTEGER		X-coordinate of top left corner of worksheet window.
left		INTEGER		Y-coordinate of top left corner of worksheet window.
bottom		INTEGER		X-coordinate of bottom right corner of worksheet window.
right		INTEGER		Y-coordinate of bottom right corner of worksheet window.

Calculate width from those variables.

Then HMove(handle_to_worksheet, width, 0) ?

or After it's placed you could maybe use HWidth(handle_to_worksheet) to get width

Cheers

Tui

Link to comment

With much hope I tried the idea twk but alas to no avail.

GetWSPlacement is another non-operational function.

procedure test;

var

hW1 : handle;

t1, l1, b1, r1 : real;

begin

hW1 := CreateWS ('testWS', 5, 5);

hW1 := CreateWSImage (GetObject ('testWS'), 0, 0);

GetWSPlacement (hW1, t1, l1, b1, r1);

Message (t1, ' ', l1, ' ', b1, ' ', r1);

SelectObj ((T = 56));

Relative;

MoveObjs (l1 - r1, 100, false, false);

Absolute;

end;

run (test);

Link to comment

My Bad, the description in the Wiki says :

Returns the on-screen location of the referenced worksheets' window.

Which looks like it is the window of the worksheet when opened. Not sure why you'd ever need to know that.

However in your script above, you can get the width of the placed worksheet by using HWidth.

widthPlacedWS := HWidth(hW1)

then use this to move your placed worksheet using HMove

HMove(hW1, widthPlacedWS, 0)

hth

Tui

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...