Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
listbox entry
#2
CB_ and other control functions are not used with controls in web pages. Use html element or accessible object functions.

Accessible object functions probably will not work here. Html element functions currently cannot select combobox items by text. Use this function:

Function Htm_CbSelect
Code:
Copy      Help
function MSHTML.IHTMLElement&el VARIANT'item ;;Selects combobox item. item can be item index (0-based) or text (exact or with *).
if(!el) end ES_INIT

MSHTML.IHTMLSelectElement elsel=+el
int index

sel item.vt
,case VT_I4
,index=item
,if(index>=elsel.length) end "item not found"
,
,case VT_BSTR
,str s(item) ss c
,c.lpstr=wild_compile(s 1 0 0)
,MSHTML.IHTMLOptionElement elop
,index=-1
,foreach elop elsel
,,ss=elop.text
,,if(c) if(!wild_matchi(c ss ss.len)) continue
,,else if(ss~s=0) continue
,,index=elop.index; goto g1
,end "item not found"
,
,case else end ES_BADARG
;g1
if(index=elsel.selectedIndex) ret
elsel.selectedIndex=index

err+ end _error

#if (IEVER>=0x532)
MSHTML.IHTMLElement3 e=+elsel
e.FireEvent("onchange")
err+
#endif

Example
Code:
Copy      Help
MSHTML.IHTMLElement el=htm("SELECT" "menu1" "" " Internet Explorer" 0 0 0x221)
Htm_CbSelect(el "04-Apr-2005*")


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)