Why Isn't This Working? Follow

0
Avatar
Legacy Poster

Okay, so I have a field on my main label named "InchSize". This field holds an event control script that throws an InputBox at the user upon print start. The user should enter a number (3, 4, or 5). Then, the Data Entry Form has a radio button list that is populated by VB script using the following script:

[code]if (Format.Objects("InchSize").Value = "3") then
Value = "3” X 100’ Perf" + vbCr + "3” X 100’ W/Filter" + vbCr + "3” X 100’ NP" + vbCr + "3” X 100’ Fine Slot"
Elseif (Format.Objects("InchSize").Value = "4") then
Value = "4” X 100’ Perf" + vbCr + "4” X 100’ W/Filter" + vbCr + "4” X 100’ NP" + vbCr + "4” X 100’ Fine Slot" + vbCr + "4” X 100’ Knife Slot"
Else
Value = "No Size Selected"
end if[/code]

However, no matter what I put in the input box, I either get "No Size Selected" or a script error if I try to change the .Value checks to numbers rather than strings.

File is attached. Any reason why this isn't working? I already kinda promised a customer that it would work after seeing that radio button lists could be VB scripted. It would be bad if I can't figure it out. lol.

[attachment=235:Scripted Radio Buttons.btw]

6 comments

0
Avatar
Legacy Poster
Comment actions Permalink

On a related note, even if I set the [i]InchSize[/i] field to embedded data and change it by hand, the radio button list appears to lag behind by one print. For example, if I had the value at 3 and printed, then change the value to 4 and print, the radio list will still be using values from the 3'' list. However, if I print again, now it shows the 4'' list. This behavior does not copy when used with a drop-down list. However, a drop-down list still doesn't appear compatible with my above situation (using a scripted inputbox for the value of [i]InchSize[/i]).
0
Avatar
Legacy Poster
Comment actions Permalink

Well, the customer needs these formats to get going, so for now I'm going to provide the customer with 4 different documents for his 4 different prompts. I'd still like to figure this out though so changes don't have to be made 4 times across labels. What is the purpose of a VB generated prompt if it does not respond to user input? Maybe if I were more fluent in other languages I could write an external app that takes advantage of that feature?
0
Avatar
Fernando Ramos Miracle
Moderator
Comment actions Permalink

Hello nRyder,

Thanks for your post.

I've been going through your BarTender document and I've noticed the following (I've also applied all my suggestions in the attached example):

1. Regarding your VB Script in the radio button list:

a. You should source the objects on the label using the "Format.NamedSubStrings("InchSize").Value" method instead of the "Format.Objects("InchSize").Value" method. Note that you will find a list of the named substrings present on your label in the Script Assistant Category section under the "Share Data Sources" option. By double clicking on the named substring you'll add a call for it in the script.

b. In order to add a list of items to the radio button list object you need to follow this structure: "value1" vbCr "value2" vbCr... In your case, you've added quotes inside each of your text values invalidating this structure. The following structure does work (removed the second quotes for each number):

[color="#008000"]"3 X 100’ Perf" + vbCr + "3 X 100’ W/Filter" + vbCr + "3 X 100’ NP" + vbCr + "3 X 100’ Fine Slot"[/color]

If you wish to add quotes inside the text section (you want them to be printed) you'll need to use the Chr() function and append it to the text values: [color="#008000"]Chr(24) & "3" & " 100’ Perf"[/color] would print [color="#008000"]"3" 100’ Perf.[/color]

2. Regarding your label object with VB Script containing the InputBox:

a. You've formatted that object to add two decimal values to the result. If you then hope to identify it on your prompt dialog's VB Script as single digit text values you'll need to remove this setting. You can remove it entering the object properties (InchSize), select the data source and under the "Data Type" tab choose "Text" as the type of data.

b. As this object is a VB script you won't be able to source the data coming from the InputBox using this same object. To solve this you'll need to create another Embedded data text object and use the VB script to load the answer for the InputBox on that new object. On my example I've named this new object InchSize2 and source if from your code in the prompt dialog. The code use in the InchSize object's VB Script is as follows (in the Functions and Subs event I've created an "Imput" variable):

[i]Input = InputBox("3, 4, 5")
Format.NamedSubStrings("InchSize2").Value = Input[/i]

Please take a look at my attached example and edit to adjust it to your needs.

Regards,

Fernando Ramos Miracle
0
Avatar
Legacy Poster
Comment actions Permalink

I need to look at your example more in-depth, and try it on v10 SR1 - since the displayed prompt seems to still lag one print behind, but maybe that was a bug fixed in SR1.

However, other than that, it seems to be working much better. Again, I need to go through it a little more detailed to understand what you did differently. Thank you for your time on this.

edit: Related to issue 2a, that must have been just a leftover from something I was testing. My original layout had it as standard "text", which you switched back to. Thanks for catching that though.
0
Avatar
Legacy Poster
Comment actions Permalink

Alright, SR1 does not seem to fix the issue where the radio button list lags behind by one print. For example, I print using the value 3 in the inputbox, then print using 4, and the list from 3 remains in the prompt. Then I print with 5, and the list from 4 remains, etc.

This behavior does NOT happen with a dropdown box or list box. However, a list box annoyingly re-sizes itself based on the *previous* list size for some reason. Even if I go into the position and lock it. It looks like the only usable function at this point is dropdown list, but I look forward to the radio button issue being resolved.

Thanks again for the help on the other issues.
0
Avatar
Fernando Ramos Miracle
Moderator
Comment actions Permalink

This issue has been definitively solved on our next service release (BarTender v10 SR2) although I still don't know exactly when it will be released (hopefully later this year).

Please sign in to leave a comment.