WhoCanDo Posted February 10, 2016 Share Posted February 10, 2016 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?? Quote Link to comment
twk Posted February 10, 2016 Share Posted February 10, 2016 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 Quote Link to comment
WhoCanDo Posted February 10, 2016 Author Share Posted February 10, 2016 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); Quote Link to comment
twk Posted February 11, 2016 Share Posted February 11, 2016 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 Quote Link to comment
WhoCanDo Posted February 11, 2016 Author Share Posted February 11, 2016 (edited) Good job Tui, HMove(hW1, BorderWdth/2 - HWidth (hW1), BorderHght/2) works a treat. Regards Edited February 11, 2016 by WhoCanDo Quote Link to comment
Recommended Posts
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.