Lucio Liberi Posted October 30, 2007 Share Posted October 30, 2007 Hello to everyone! This is my first link to the list. My problem is hao to set a text field of a custom object. I wrote the following plugins obj. Procedure Pluto; VAR MyHandle :HANDLE; BEGIN MyHandle:=FSActLayer; SetRField(MyHandle, 'Struct_Pluto', 'Text', 'Hello world!'); Rect(0,-PBoxWidth/2, PLineLength, PBoxWidth/2); END; (* End Procedure Pluto *) Run(Pluto); It does work fine. So after the 2d obj creation, I get 'Hello world!' into the proper field. But I just wrote: Procedure Pippo; VAR MyHandle :HANDLE; BEGIN MyHandle:=FSActLayer; SetRField(MyHandle, 'Struct_Pippo', 'Text', 'Hello world!'); Rect(0,0, PA, PB); END; (* End Procedure Pippo *) Run(Pippo); and it doesn't works, until I do update manually a field value... Is there someone who could help me, please? Thank you. Lucio Quote Link to comment
islandmon Posted October 30, 2007 Share Posted October 30, 2007 FSActLayer is the same HANDLE for 'Struct_Pluto' and 'Struct_Pippo' . Quote Link to comment
Lucio Liberi Posted October 31, 2007 Author Share Posted October 31, 2007 Thank you for your reply. Struct_Pluto and Struct_Pippo are two different plugs... I think I could use the same variable name into different plugs... The problem is, I suppose, that for the Pippo one, I have to do just a click to insert it. Instead of Pluto, I have to trace a square (or a line, is the same...). So, in the case of a drawing obj, the system do update the database object itself during the drawing... Each plug, has three fields, A - B - Text or LineLength - BoxWidth - Text. What I need is to write something into the Text field at the creation time. Just think to an ID number. I have to count the obj I put on the drawing and increment by one... Quote Link to comment
Lucio Liberi Posted October 31, 2007 Author Share Posted October 31, 2007 FIX IT!!! Here's the solution, (ehm...) from wwhelp... VectorScript uses the SetRField() function to write values to parameter records. VectorScript also provides two functions, GetCustomObjectInfo() and GetPluginInfo() which return the information needed by SetRField() to write values to parameter records. Using GetCustomObjectInfo() or GetPluginInfo() with SetRField() is relatively straightforward. When writing a value back to the parameter record of an object instance, first use GetCustomObjectInfo() to obtain information about the object. Once this information has been retrieved, it can be used in conjunction with SetRField() to write the value back to the parameter record. The following example illustrates this technique: BEGIN resultStatus:= GetCustomObjectInfo(objName,objHd,recHd,wallHd); IF resultStatus THEN BEGIN sp_width:= PSPACE_WIDTH; ... ... sp_width:= 5 * sp_width; ... ... SetRField(objHd,GetName(recHd),?Space Width?, Num2StrF(sp_width)); END; END; Now it does works fine!!! Hi. L. 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.