Blank line in drop down list on resetting

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Blank line in drop down list on resetting

Post by kpassaur » Tue Jan 26, 2010 4:07 pm

I have a drop down list, actully four of them. When I refresh them it appears to disregard the first row which is blank. If I start it with someting that has text in it instead of a blank line "CRLF" it works correctly. Or least appears to. So I tried adding a space and it failed. Below is a portion of the script:

oSub>FolderandFileNameIndex

SRT>FolderandFileNameIndex
Let>blankline=
Let>option1=%blankline%%CRLF%Zone 1%CRLF%Zone 2
Let>DIALOG1.FOLDER1.ITEMS.TEXT=%option1%
Let>DIALOG1.FOLDER2.ITEMS.TEXT=%option1%
Let>DIALOG1.FILENAME1.ITEMS.TEXT=%option1%
Let>DIALOG1.FILENAME2.ITEMS.TEXT=%option1%


If>%SN1%=
Let>DIALOG1.Folder1.ITEMINDEX=0
Endif
If>%SN1%=Zone 1
Let>DIALOG1.Folder1.ITEMINDEX=1
Endif
If>%SN15=Zone 2
Let>DIALOG1.Folder1.ITEMINDEX=2
Endif
If>%SN2%=
Let>DIALOG1.Folder2.ITEMINDEX=0
Endif
If>%SN2%=Zone 1
Let>DIALOG1.Folder2.ITEMINDEX=1
Endif
If>%SN2%=Zone 2
Let>DIALOG1.Folder2.ITEMINDEX=2
Endif


Here you will see I tried to use blankline (normally I just use %CRLF%) but that fails However, it works when it is first loaded and if I change blankline to blankline=test it will work as well. The item index comes back correctly it is as if there are only two items in it. (Zone 1 and Zone 2) The carriage return and line feed are missing.

Any ideas?

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Tue Jan 26, 2010 11:59 pm

Hi kpassaur,

If you could post the whole script that would be helpful but I took a crack at it anyways to see if this is what you are going for.

Code: Select all

let>blankline=
let>defaultoption=%blankline%%CRLF%Zone 1%CRLF%Zone 2
Dialog>dialog1
   Caption=
   Width=445
   Height=250
   Top=508
   Left=1711
   ComboBox=folder1,19,21,145,%defaultoption%
   ComboBox=folder2,22,61,145,%defaultoption%
   ComboBox=filename1,25,99,145,%defaultoption%
   ComboBox=filename2,31,138,145,%defaultoption%
EndDialog>dialog1

show>dialog1
That will load the dialog with a blank line.

Is that what you are trying to do?

-Josh

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

load with blank line

Post by kpassaur » Wed Jan 27, 2010 8:19 am

Yes, what happens is it loads correctly the first time. The script calls another compiled script, reads some information etc. (it is a very large script) and updates a dialog. (the dialog that contains this). When it reloads the index value is correct; however, the blank line is not there, so it will be moved to the next value. So "Zone 1" becomes index value 0 instead of one.

The part that is confusing me is that if I replace the %CRLF% with a value such as "test" it works correctly.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Jan 27, 2010 3:17 pm

The part that is confusing me is that if I replace the %CRLF% with a value such as "test" it works correctly.
What happens if you put the system variable %SPACE% in the first line?

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Wed Jan 27, 2010 7:49 pm

ok here is a modified version of my earlier post, it basically updates the first combobox when you click the updatedialog button. It also resets the index value and retains the empty line. I know this is a gross oversimplification of your script but maybe this will help.

Code: Select all


let>blankline=
let>defaultoption=%blankline%%CRLF%Zone 1%CRLF%Zone 2
let>newoption=%blankline%%CRLF%Zone 31%CRLF%Zone 342
Dialog>dialog1
   Caption=
   Width=445
   Height=250
   Top=141
   Left=59
   ComboBox=folder1,19,21,145,%defaultoption%
   ComboBox=folder2,22,61,145,%defaultoption%
   ComboBox=filename1,25,99,145,%defaultoption%
   ComboBox=filename2,31,138,145,%defaultoption%
   Button=update,270,45,75,25,5
EndDialog>dialog1

show>dialog1

label>actionloop
GetDialogAction>dialog1,r
if>r=5
gosub>updatedialog
endif
goto>actionloop


srt>updatedialog

let>dialog1.folder1.items.text=%newoption%
let>dialog1.folder1.itemindex=-1
resetdialogaction>dialog1
END>updatedialog
-Josh

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts