Jump to content
Developer Wiki and Function Reference Links ×

Using ", ', or () in a Popup window


DCarpenter

Recommended Posts

I've created a PIO that has a popup window in the Object Info Palette where the user can select from a handful of different symbols to use within the PIO.  Below are a few lines of the script that are giving me problems:

 

  IF PSymObj='6'' Round w/ 2ppl' THEN BEGIN        [Checks to see if the Popup window in the Obj.Info.Palette = '6'' Round w/ 2ppl']
  SymbolName:=('Table 72" round-2ppl (sv)');          [Sets string variable]
  sysbeep;                                                                       [The beep tells me if the script even enters into this IF/THEN statement]
  DefDist:=132";                                                              [Sets REAL variable]
  END;

 

When I run this script, I've haven't been able to get the script to accept that the value (PSymObj='6'' Round w/ 2ppl' ) is true, and then executes the THEN part.  The only thing I can imagine is that the '' or the / in the name are causing the problems.  Has anyone else experienced this problem?  When PSymObj='Chair (sv)' it runs fine.  Any thoughts?

 

Link to comment

It is probably the " (double quote) mark that is causing the problems. I don't think there is an easy way in Vectorscript to work around the problem other than change the symbol names so they do not contain single or double quotes (' or ") since these are used to delimit string values, when the parser encounters them it thinks the string is done and then tries to go to the next step and the rest of what is in the string does not make sense as a command.

 

Yes, most of us have encountered this at one time or another if we have been around Vectorscript long enough.

Link to comment

If you're using VS, the only character that should give you an issue is a single quote, which you can escape by placing two single quotes together: distanceVar := '1''-2"'

Especially if you're not getting any compiler errors, I would double check the value of your pull-down and make sure you have the string correct and that you don't have any trailing spaces

 

 -Josh

Link to comment

Josh is right if you are hard coding the strings that you can use multiple single quotes to "escape" and get what you want. I personally prefer in that kind of case to construct the stringing something like:

 

DBCrit := Concat('=Database(((L=  ', chr(39), Lname ,chr(39),  ' )&(T=Symbol) ))');

The chr(39) converts to an actual in line quote mark before and after the Lname.

I find it much easier to read than trying to decide if you have two single quotes or something else.

 

I also don't think you can do that in a PIO field, especially one where you are dealing with user entered data.

 

Link to comment

Thanks guys.  I didn't think that using single quotes or double quotes were that big of a deal in the list of options in a popup window, but apparently it is.  I have some older PIO that still have single and double quotes in popup list but they still work fine.  It stinks when the rule doesn't apply across all PIO's.

 

Thanks for your help,

Dave

Link to comment

Actually, you can use quotes in as pull-down options.  You just have to be careful about matching them.  And double quotes shouldn't be an issue--they are not a special character in VS.  If you move to Python, that's another story, and you can actually get into trouble with unescaped quotation marks in a text field.

I actually think you're just not matching the string exactly in the IF statement.  If I had to guess, the spaces don't match.  Try copying and pasting the pull-down value into your script and see if that makes a difference.  You can also run Message(PSymObj) just to confirm that the stored string isn't being truncated, but I don't think that's the issue.

 

-Josh

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...