Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Item Property
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi

Value displayed in combobox is LAB & RAD, but 0 and 1 is getting displayed in msgbox i

Code:
ICount  =  SwfWindow(" ").SwfComboBox("SwfComboBox").GetItemsCount
msgbox ICount (Output is 2)

For i  = 0 to ICount - 1
    SwfWindow(" ").SwfComboBox("SwfComboBox").GetItem (i)
    msgbox i (First Iternation 0 and Second Iternation 1)
Next


Attached Files
.doc   Doc1.doc (Size: 131.5 KB / Downloads: 88)
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
it is obvious. see, in your code you statement 'msgbox i' clearly says to get an output for values of your variable 'i'
and in the for loop i varies from 0 to 1.
so you are getting the values as 0 and 1.
I guess you are trying to get the selected item.
if yes then use GetSelection method.
e.g.
Code:
msgbox SwfWindow(" ").SwfComboBox("SwfComboBox").GetSelection

Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Use this piece of code,

Code:
ICount  =  SwfWindow(" ").SwfComboBox("SwfComboBox").GetItemsCount
msgbox ICount (Output is 2)

For i  = 0 to ICount - 1
itemname =swfWindow(" ").SwfComboBox"SwfComboBox").GetItem (i)
    msgbox itemname
Next

As saket pointed out you are only msgboxing i value then the retireved item value. You have to store it in a variable and then read from it.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
Thanks Saket
I need only the values(LAB & RAD)in the combo box without selecting.
I am using getitem will retrun by index, so first time Lab and second time Rad.
Is my understanding right?
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
@Saket - GetSelection will retrieve the item which is selected ( I suspect if there is a getselection for a swfcombobox..not sure yet.). Getitem will retrieve each item available in the collection.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
Yes,, you are right.
if you dont want to select the item then use a variable to get the value and output that variable, as suggested by Basanth.

Reply
#7
Solved: 10 Years, 9 Months, 1 Week ago
Thanks Basanth & Saket
It works.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot identify the specified item Beginner 0 2,334 06-22-2017, 04:55 PM
Last Post: Beginner
  WinListView set item command Shahino007 0 2,533 10-06-2015, 03:57 PM
Last Post: Shahino007
  Get value of a List view item qtpbegin 4 13,769 08-08-2012, 04:58 PM
Last Post: Deepak_QTP
  Creating ObjectRepository item through VBScript LogicaLInsanity 0 2,381 01-24-2012, 03:08 AM
Last Post: LogicaLInsanity
  Err: Cannot identify the specified item of the object. nikku 2 9,497 08-28-2011, 01:40 AM
Last Post: nikku

Forum Jump:


Users browsing this thread: 1 Guest(s)