Stephan Sonnenschein Posted September 25, 2005 Share Posted September 25, 2005 Starting with the location of one selected CustomObject I want to get a handle to another CustomObject which is close to this object and do something with that object. Imagine to a for instance a Pipe System where I bring to objects close to each other (via underlying grid). After they are positioned this way they should interact with their neighbour (change some RecordFields). I thought GetClosestPt() would be the right approach but when I tested the example from the function refence I didn't get any reaction when I clicked (=GetPt()) near a simple rect. Also the Debugger shows that no objhandle is identified. 1) Does anybody know how to use this function correctly? PROCEDURE GetClosestPtExample; VAR obj :HANDLE; ptX, ptY :REAL; index :INTEGER; containedObj :LONGINT; BEGIN {$Debug} GetPt(ptX, ptY); GetClosestPt(obj, ptX, ptY, index, containedObj); SetPenFore(obj, 65535, 0, 0); END; RUN(GetClosestPtExample); 2) If this function doesn't work. Has anybody an alternative solution for my problem? Quote Link to comment
Bruce Pittard Posted September 28, 2005 Share Posted September 28, 2005 Try sending the parent object to the back first then select closest point. I have also been trying something similar to this but it gets tricky when both PIO's use the same code - therefore when one finds it's child object the child object becomes the parent and thus finds the original parent (confusing i know) what needs to be done in this case is somehow setting a flag on each object (like an invisible field) to say that it's been done. Please let me know if this helps, it might help my tool along. Quote Link to comment
islandmon Posted October 1, 2005 Share Posted October 1, 2005 It seems that your initial condition GetPt(ptX,ptY) = 'null'. 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.