Professional Web Applications Themes

VRuby; set color and background of a text label (VRStatic) - Ruby

Hi, how do I set the color and the background of a VRStatic control? I tried: -- require 'vr/vruby' require "vr/vrcontrol" frm=VRLocalScreen.newform def frm.construct self.caption= "VisualuRuby Sample1" addControl(VRStatic, "label1","This is Static",200,50,200,40) #label1.setcolor(RGB(0xff,0xff,0xff)) p label1.methods.grep(/olor/) label1.textColor=RGB(0xff,0xff,0xff) end frm.create frm.show VRLocalScreen.messageloop --- and get: sample.rb:11:in `textColor=': Not in WM_PAINT event handling (StandardError) from sample.rb:11:in `construct' from c:/ruby/lib/ruby/site_ruby/1.8/vr/vruby.rb:508:in `create' from sample.rb:14 Thanks for your help, -A....

  1. #1

    Default VRuby; set color and background of a text label (VRStatic)

    Hi,

    how do I set the color and the background of a
    VRStatic control?

    I tried:
    --
    require 'vr/vruby'
    require "vr/vrcontrol"

    frm=VRLocalScreen.newform

    def frm.construct
    self.caption= "VisualuRuby Sample1"
    addControl(VRStatic, "label1","This is Static",200,50,200,40)
    #label1.setcolor(RGB(0xff,0xff,0xff))
    p label1.methods.grep(/olor/)
    label1.textColor=RGB(0xff,0xff,0xff)
    end

    frm.create
    frm.show
    VRLocalScreen.messageloop
    ---
    and get:

    sample.rb:11:in `textColor=': Not in WM_PAINT event handling (StandardError)
    from sample.rb:11:in `construct'
    from c:/ruby/lib/ruby/site_ruby/1.8/vr/vruby.rb:508:in `create'
    from sample.rb:14

    Thanks for your help,
    -A.
    Armin Guest

  2. #2

    Default Re: VRuby; set color and background of a text label (VRStatic)


    "Armin Roehrl" wrote: 

    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




    daz Guest

  3. #3

    Default Re: VRuby; set color and background of a text label (VRStatic)

    daz, thanks a lot!

    My modified code below does not change the color
    of the text.
    If I uncomment the # in MyForm the color changes.
    What can I do so that the color-change in a VRPanel works?

    ----

    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.3*unit ,0.2,4.75*unit,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


     
    >
    >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
    >
    >
    >
    >
    >
    >
    >
    >
    >[/ref]



    Armin Guest

Similar Threads

  1. set background color of selected text in textarea
    By ganesh in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: July 2nd, 12:26 PM
  2. FORM - TEXT FIELD Background Color
    By CyrusB in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 28th, 06:19 AM
  3. Background Color change on a SINGLE line of text.
    By Délon webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: July 25th, 02:45 PM
  4. Text tool - text goes white, background changes color
    By Terry Boyles in forum Adobe Photoshop Elements
    Replies: 4
    Last Post: July 8th, 07:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139