Tuyet,

I think the root problem is that there are two kinds of select elements -- multi-select and single select. We only have one class to support them, and therefore pretty much assume it is multi-select, since the methods you use with it also work for single select -- but sometimes they are less efficient. I'm not sure if the best solution isn't to create two different classes, but this would amount to even more rework then just adding option objects.

In the mean time, i suggest you work directly with the OLE object. Here are a couple things to try:

ie.frame("customizeRemoteContent").select_list(:id, "availableColumnsSelectBox").getOLEObject.selectedIndex = -1 ie.frame("customizeRemoteContent").select_list(:id, "availableColumnsSelectBox").getOLEObject.value = ""

If neither of these work, refer to this for more information regarding the OLE interface:

http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/selectelement/selectelement.asp

Let us know what works for you.

Bret

At 09:35 PM 7/13/2005, Paul Rogers wrote:
"urn:schemas-microsoft-com:office:office" xmlns:w = "urn:schemas-microsoft-com:office:word"> this looks like a perfect situation for Bret new select_list scheme - you could do this

ie.select_list(:name, 's').option(:value, 'v2').clear

So Bret, maybe we should add it soon ?

Paul


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu
Sent: 13 July 2005 19:32
To: '[email protected]'
Subject: [Wtr-general] ClearSelection

How can I clear a selection that was previously selected?
1) Selecting this item works fine
irb(main):012:0> ie.frame("customizeRemoteContent").select_list(:id, "availableC
olumnsSelectBox").select("-Descriptive Data")
=> nil

2) But clearing it seems to not work
irb(main):013:0> ie.frame("customizeRemoteContent").select_list(:id, "availableC
olumnsSelectBox").select("-Descriptive Data").clearSelection
NoMethodError: undefined method `clearSelection' for nil:NilClass
        from (irb):13
        from ¢¾:0

3) This works too but it takes over 20 seconds since my select box has lots of items
so it¡¯s too long to use in a script
ie.frame("customizeRemoteContent").select_list(:id, "availableColumnsSelectBox").clearSelection

That¡¯s why I need to be able to clearSelection for a particular item rather than for the entire select box

Any idea how to make #2 work?
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_____________________
 Bret Pettichord
 www.pettichord.com


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to