mikeconner Posted April 11, 2003 Share Posted April 11, 2003 I just upgraded to VW 10 and a script that worked in VW 9 is giving me a problem. It uses a custom dialog to present a list of choices to the user; the choices are retrieved from a worksheet. Everything seems to work ok except that the choices listed in the dialog are garbage charcaters. In debugging, the string array used to store the choices for presented lists the proper strings, but the strings presented to the user by the dialog are garbage, e.g. 2?? (should be Millersburg). If selected, the garbage is returned and the script fails. Any help on what's happening. Mac OS X, VW 10.1. The dialog portions of the script are: { Dialog definition function subroutine } FUNCTION Define_Pickquad : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Choose Quad Map',True,'OK','Cancel'); CreateListBox(dialogID,6,16,4); SetFirstLayoutItem(dialogID,6); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(6,'Choose quad map'); Define_Pickquad := dialogID; END; { Dialog driver function subroutine } PROCEDURE Drive_Pickquad(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN {populate quad list} for r:=1 to nq do InsertChoice(6,r,quadstr[r]); END; { user selected OK button } 1:BEGIN GetSelChoice(6,0,dvi,mapname) END; { user selected Cancel button } 2:BEGIN nq:=0; END; 6:BEGIN END; END; END; { main body of script } Quote Link to comment
ccroft Posted April 12, 2003 Share Posted April 12, 2003 Could it be this: "In modern dialogs, InsertChoice indices have to begin at zero, and then increment from there. If you don't insert a choice at the zero slot,nothing will show up in the list. If you miss an index in a sequence, nothing will show up after the missing index." Taken from a post by Charles Chandler (Nemetschek guy) on the v-script list. So I guess r must be set to 0?. Never tried a for loop starting at 0.... the script he was helping with used repeat until EOF and there's no mention of version. Maybe it's a new rule. Quote Link to comment
mikeconner Posted April 14, 2003 Author Share Posted April 14, 2003 Yes, that was the problem; someone on the vscript list suggested the same fix (changing the insertchoice counter to r-1 from r) and it worked. I haven't checked to see if the insertchoice index requirements changed from VW 9 to 10 or it just got pickier about it in VW 10. At least it was a quick and easy fix. 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.