From: Armin Roehrl Date: 2004-02-11T06:38:56+09:00 Subject: Vruby - passing arguments? Hi all, suppose I have my own class MyOwnderDrawButton to draw a red, green, blue, etc. button (see code below). Can I pass an argument when I call addControl to specify the color? Code below. It sounds so simple .. Thank you, Mr. your daily Vruby question. P.S.: When I have finished my current Vruby project, I will write a short online doc on the few things I have learnt :-). #-------------------------------------- require 'vr/vruby' require 'vr/vrcontrol' require 'vr/vrhandler' # (only using- vr/contrib/vrctlcolor) require 'vr/vrowndraw.rb' require 'Win32API' class MyOwnerDrawButton < VROwnerDrawButton DrawFrameControl=Win32API.new("user32","DrawFrameControl",["L","P","I","I"],"I") def drawpushed(left,top,right,bottom,state) rect=[left,top,right,bottom].pack("iiii") DrawFrameControl.call(hdc,rect,4,0x210) c = RGB(0xff,0,0) setPen c setBrush c fillRect(4,4,12,12) end def drawreleased(left,top,right,bottom,state) rect=[left,top,right,bottom].pack("iiii") DrawFrameControl.call(hdc,rect,4,0x10) c = RGB(0,0,0xff) setPen c setBrush c fillRect(1,1,98,48) end end class ARForm < VRForm include VRCtlColor def construct addControl(VRButton, 'lab1', "ta", 100,90,200,100) addControl(MyOwnerDrawButton,"test","OK",10,10,100,50) end end VRLocalScreen.showForm(ARForm, 0, 0, 400, 400) VRLocalScreen.messageloop #---------------------------- ---