callum.adams11 Posted September 22, 2017 Share Posted September 22, 2017 Im having no luck finding a solution to this... I have a script \/ \/ Procedure SymbolDistance; Var X1,Y1,X2,Y2, Dist: Real; S1, S2: String; H1, H2, H3: Handle; B1: Boolean; Begin PushAttrs; B1:=GetCustomObjectInfo(S1, H1, H2, H3); GetSymLoc(H1,X1,Y1); Symbol(pSymbol,0,0,0); GetSymLoc(GetObject(pTee),X2,Y2); Dist:=Distance(X1,Y1,X2,Y2); S2:=Num2StrF(Dist); SetRField(H1, pRecord, pField, S2); PopAttrs; ResetObject(H1); END; Run(SymbolDistance); Basically a Point Object tool, that inserts a symbol > measures a distance > puts it in a new symbols record field.. The object doesn't take the value once inserted. Though when moved will update the value in the Object info record field window. BUT wont show the value in the text that is linked to the record field.. Any thoughts? Quote Link to comment
JBenghiat Posted September 22, 2017 Share Posted September 22, 2017 You have a couple of methods for displaying text going at once. If you're coding a plug-in object, you code just create the text object over the symbol, eliminating the need for linking text to a record. If you want to used linked text, then the value you provide needs to be to a record attached to the symbol instance inside the PIO, not to the PIO itself. Think of the PIO as a container, like a symbol or group. After inserting the symbol, get a handle to the symbol instance inside the PIO: hSymbol := LNewObject; Now, set the record value for hSymbol, not H1. You may also need to reset the symbol instance for the data to refresh: ResetObject(hSymbol); This also means that if you need to make use of other values stored in the record attached to the PIO, you need to manage those manually -- they will not link to any objects inside the PIO. A better approach might be to use more PIO parameters for your data. Also, you might want to add some error checking. For example, check that GetObject(pTee) doesn't return a nil handle. HTH, Josh 1 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.