るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.120秒)
トップページ > クエリ:i[x] > クエリ:class[x] > クエリ:handler=[x]

別のキーワード

  1. argf.class lines
  2. argf.class each_line
  3. argf.class each
  4. class new
  5. argf.class readline

ライブラリ

クラス

検索結果

WIN32OLE_EVENT#handler=(obj) -> () (21112.0)

イベント処理を実行するオブジェクトを登録します。

...thod_missingが呼ばれます。イベン
ト名は大文字小文字を区別するため、正確な記述が必要です。

@param obj イベントに対応するメソッドを持つオブジェクト。イベント受信を
解除するにはnilを指定します。

class
IeHand...
...ler
def initialize
@completed = false
end
attr_reader :completed
def onDocumentComplete(disp, uri)
disp.document.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}"
end
@completed = true
end
def method_missing(id, *args)...
...vent=#{id.to_s}, args=#{args.inspect}"
end
end

i
e = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
event.handler = IeHandler.new
i
e.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if event.handler.completed
WIN32OLE...

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (3112.0)

型が持つソースインターフェイスを取得します。

...fがCoClass(コンポーネントクラス)
の場合、そのクラスがサポートするデフォルトのソースインターフェイス(イ
ベントの通知元となるインターフェイス)を返します。

@return デフォルトのソースインターフェイスをWIN32OL...
...イスを持
たない場合は空配列を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
tobj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]

WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、...
...o
define_method("on#{m.name}") do |*arg|
i
f arg[0] == "ページが表示されました"
@completed = true
end
puts "#{Time.now}: #{m.name} was called"
p arg
end
end
end
evt = WIN32OLE_EVENT.new(ctl)
evt.handler = WebEvent.new
ctl.navigate2 'htt...