Assembly Posted October 11, 2010 Share Posted October 11, 2010 (edited) I'm trying to store strings larger than 255 Char somewhere in my PIO. Function Reference states: Retrieving or Assigning Strings to Record Fields VectorScript also allows you to set and retrieve STRING values greater than 255 characters long contained in record fields via the use of CHAR arrays. The VectorScript API functions GetRField() and SetRField() support the use of a CHAR array in place of a STRING value. However when I create a Record Format with a text field type. This input is limited to 255 Char. How can does one create a Record Format that can hold more than 255 Char?. Edited October 11, 2010 by Assembly Quote Link to comment
Miguel Barrera Posted October 11, 2010 Share Posted October 11, 2010 You need to define a variable with a char array to store and retrieve the values as defined in: PROCEDURE SetRField(h:HANDLE; record:STRING; field:STRING; value:DYNARRAY[] OF CHAR); VAR objHandle: HANDLE; recName,fldName: STRING; strVal: DYNARRAY[] OF CHAR; BEGIN .... SetRField(objHandle,recName,fldName,strVal); .... END; Most likely is that the text editor for default values accepts only str255 types but the record field can hold more than 255 characters. Why would you need to enter a default value? I leave text fields for storage with blank defaults because the values will be assigned and retrieved by the script. Quote Link to comment
Assembly Posted October 12, 2010 Author Share Posted October 12, 2010 Please click on paste bin for extended code with what I'm doing. This code can be included in a PIO. The PIO has a button that runs a dialog built with DB5. A simple large text box. The dialog uses TextThis:DYNARRAY[] of CHAR to allow entry for text. I would like the default text to be the text already in the object. I'm using TextThis to do that on line 236. CreateEditTextBox (dialog1, kContent, TextThis, 100, 15); I need to be able to get the text from the textbox into TextThis. From the Function reference. The VectorScript API functions GetRField() and SetRField() support the use of a CHAR array in place of a STRING value. So I've tried to create a record to insert the text to. New:=GetCustomObjectInfo(ObjectNameit,ObjectHandit,RecordHandit,WallHandit); .... NewField('Text','Hold','',4,0); SetRecord(ObjectHandit,'text'); SetRField(ObjectHandit, 'Text','Hold',TextThis); .... Prior to the DialogCall: .... TextThis:=GetRField(ObjectHandit,'Text','Hold'); .... I can't get more than the 255 CHAR to work in this way. When a record is created outside of VS again I can't add more than 255 Char to it thus not sure how to use SetRField() to hold a string longer than 255 as the function ref indicates that you can?. http://pastebin.com/sC7BGv2Y I'm just learning about event enabled PIO's. Maybe I'm doing something wrong there?. Quote Link to comment
maarten. Posted October 12, 2010 Share Posted October 12, 2010 Try to clean out your script first. Remove all things that aren't necessary before you post it, it will take us less time to see what you're doing, cause now i have no idea what your script does (sorry, don't have the time to dig in it for a long time). Also, it will be less hard for yourself to locate the error. I guess that you somewhere convert your DynArray of Char to a String and therefor loose the everything after 255 chars. BTW, why don't you use a parameter to store the info in? That way you don't need to create an external record. Here's an example that works (272 chr). It's a point pio with one invisible Parameter "__Par". Oke, it's a quite ridiculous example but it just shows that it does work to store more then 255 chars in a record. PROCEDURE Voorbeeld; VAR bool : BOOLEAN; PioName : STRING; PioHand : HANDLE; PioRecord : HANDLE; PioWall : HANDLE; Long : DYNARRAY of CHAR; BEGIN IF GetCustomObjectInfo(PioName,PioHand,PioRecord,PioWall) THEN BEGIN Long:=ConCat('00xxxxxxx10xxxxxxxx20xxxxxxxx30xxxxxxxx40xxxxxxxx50xxxxxxxx60xxxxxxxx70xxxxxxxx80xxxxxxxx90xxxxxxxx','100xxxxxxx110xxxxxxx120xxxxxxx130xxxxxxx140xxxxxxx150xxxxxxx160xxxxxxx170xxxxxxx180xxxxxxx190xxxxxxx200xxxxxxx210xxxxxxx220xxxxxxx230xxxxxxx240xxxxxxx250xxxxxxx260xxxxxxx270'); Message(Len(Long)); SetRField(PioHand,PioName,'__Par',Long); CreateText(GetRField(PioHand,PioName,'__Par')); END; END; RUN(Voorbeeld); 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.