···
require ‘vr/vruby’
require ‘vr/vrhandler’
require ‘vr/vrdialog’
require ‘vr/vrcomctl’
require ‘vr/rscutil’
require 'vr/vrlayout
class Adresse < VRPanel
include VRMenuUseable
include VRGridLayoutManager
include WStyle
include WConst
include VRMessageParentRelayer
include VRStdControlContainer
include VRCtlColor
def construct
unit=10.0/9.0
self.setDimension(2,2)
addControl(VRStatic, “fn”, “Firma:”, 1, 1, 10, 10)
addControl(VRStatic, “firmenName”, “Müller GmbH”, 14, 1, 20, 10)
addCtlColor(@firmenName)
@firmenName.setTextColor(RGB(200,0,0))
@firmenName.setBkColor(RGB(255,224,208))
end
end
module MyForm
include VRMenuUseable
include VRGridLayoutManager
include WStyle
include WConst
include VRCtlColor
def construct
unit=10.0/9.0
setDimension(10,10)
addControl(Adresse, “panel”,“p”, 0.1+1.3unit ,0.2,4.75unit,3)
#addControl(VRStatic, “fn”, “Firma:”, 1, 1, 10, 10)
#addControl(VRStatic, “firmenName”, “Müller GmbH”, 5, 1, 20, 10)
#addCtlColor(@firmenName)
#@firmenName.setTextColor(RGB(200,0,0))
#@firmenName.setBkColor(RGB(255,224,208))
end
end
frm=VRLocalScreen.newform
frm.extend MyForm
frm.create.show
VRLocalScreen.messageloop
exit
Thank you,
-A
“Armin Roehrl” wrote:
Hi,
how do I set the color and the background of a
VRStatic control?
Hi Armin,
This uses vrctlcolor.rb which you should have in your vr/contrib folder.
(VRuby is for Windows only)
#----------------------------
require ‘vr/vruby’
require ‘vr/vrcontrol’
require ‘vr/vrhandler’ # (only using- vr/contrib/vrctlcolor)
class ARForm < VRForm
include VRCtlColor
def construct
self.caption= “Example - Colored VRStatic”
addControl(VRStatic, ‘lab1’, “Static Text\n… continued”, 100,50,200,80)
addCtlColor(@lab1)
@lab1.setTextColor(RGB(200,0,0))
@lab1.setBkColor(RGB(255,224,208))
end
end
VRLocalScreen.showForm(ARForm, 0, 0, 400, 400)
VRLocalScreen.messageloop
#----------------------------
daz