Why does SilkTest not return blank lines when using the GetMultiSelText() method?

0 Likes

This behaviour is as-designed in that all blank lines are discarded when using either the GetMultiText() or the GetMultiSelText() methods. One way of working around this problem is to use the new method detailed below; this both selects and returns the selected text in a single method. This new method can also be used in conjunction with the article "Why does SilkTest not return blank lines when using the GetMultiSelText() method?". It requires three integer parameters; the line to start selecting on, the column to start selecting at and the number of characters (including spaces and blank lines) to be selected.

[-] winclass TextField : TextField
[ ]
[-] LIST OF STRING NewGetMultiSelText (integer iStartLine, integer iStartCol, integer iNoChars)
[ ] integer i=1
[ ] integer iRow=iStartLine
[ ] integer iCol=iStartCol
[ ] integer iChars=iNoChars
[ ]
[ ] //Set some sensible defaults
[ ] if(!iRow)
[ ] iRow=1
[ ] if(!iCol)
[ ] iCol=1
[ ] if(!iChars)
[ ] iChars=1
[ ]
[ ] this.Typekeys("")
[ ] for i=1 to iRow-1
[ ] this.Typekeys("")
[ ] for i=1 to iCol-1
[ ] this.Typekeys("")
[ ] for i=1 to iChars
[ ] this.Typekeys("")
[ ] this.Typekeys("")
[ ] return Clipboard.GetText()


The screenshot below shows a test run against the sample application supplied with SilkTest2008.
The sample application is under

Start | Programs | Borland | SilkTest | Sample Applications | Win32 | Test Application

[-] testcase GetMultiSelTextTest() appstate none
[ ] print(TextField1.TheMultipleLineTextField.NewGetMultiSelText(3,2,20))

 

See also KB Why does SilkTest not return blank lines when using the GetMultiSelText() method?

Comment List
Related
Recommended