Create  Edit  Diff  Phillro Industries  Index  Search  Changes  History  Source  RSS  Note  wikifarm  Login

control.rb

Phi::CommX → control.rb

http://www.moriq.com/apollo/ext/comm/Phi/CommX.html

http://www.moriq.com/apollo/ext/comm/Phi/control.rb

require 'phi'
include Phi
require 'comm'
require 'dialogs'

form = Form.new :form1, $0
btn = Button.new form, :button1, 'send'
btn.align = Phi::AL_CLIENT

comm = CommX.new
comm.open

form.on_close = proc do |sender, action|
  print "close action=#{action}\n"
  comm.close
end

btn.on_click = proc do |sender|
  print "send\n"
  comm.send '00RD0001'

  buf = ' ' * 10
  len = comm.receive(buf)
  print "recv len=#{len}\n"
  if len == 10
    Phi.message_dlg '正常終了'
  else
    Phi.message_dlg '異常終了'
  end
end

form.show
Phi.mainloop
Last modified:2005/04/05 11:13:16
Keyword(s):
References:[Phi::CommX]