Skip to content

Instantly share code, notes, and snippets.

@mattn
Created June 8, 2009 04:13
Show Gist options
  • Save mattn/125612 to your computer and use it in GitHub Desktop.
Save mattn/125612 to your computer and use it in GitHub Desktop.
require 'vr/vrcomctl'
require 'vr/vrlayout'
$confs = []
IO.popen("ipconfig /all","r"){|f|
conf=nil
f.each_line{|n|
n=n.rstrip
if n =~ /^ /
$confs.last << n
elsif n.size > 0
$confs << [n]
end
}
$confs << conf if conf
}
module WIPConfForm
include VRResizeable
def construct
self.caption = "IP config"
addControl VRListbox,"tab",""
addControl VRText, "msg", "",0,0,0,0,WStyle::WS_VSCROLL
@tab.setListStrings $confs.map{|f| f.first }
@tab.select( 0 )
@k1=VRVertTwoPaneFrame.new(@tab,@msg).setup(self)
tab_selchanged
@tab.focus
end
def tab_selchanged
@msg.text = $confs[@tab.selectedIndex].join("\r\n")
end
def self_resize(w,h)
@k1.move 0,0,w,h
end
end
form = VRLocalScreen.newform
form.extend WIPConfForm
form.move 0,0, 400,300
form.create.show
VRLocalScreen.messageloop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment