[fxruby-users] FXText and FXDataTarget

kwicher kwicher at gmail.com
Mon Dec 29 19:34:50 EST 2008


Hi,

I'd like to ask if it is possible to control the length of the text
displayed in FXText via the FXDataTarget object?
I tried something like that but it did not work:

require "rubygems"
require "fox16"
include Fox
class MyProject < FXMainWindow
  def initialize (app, title)
    super(app,title, :opts=>DECOR_ALL^(DECOR_SHRINKABLE|
DECOR_STRETCHABLE|DECOR_RESIZE)|
LAYOUT_EXPLICIT,:width=>400,:height=>300)
     @target=FXDataTarget.new("jkjkjk") do |cmd|
      cmd.connect(SEL_CHANGED) do |sender, sel, data|
                 if data.length>10
                    FXApp.instance.beep
                    sender.value=data[0..9]
                 end

      end
    end

    @text=FXText.new
(self,:x=>2, :y=>2,:width=>216, :height=>60,:target =>
@target, :selector => FXDataTarget::ID_VALUE,:opts=>LAYOUT_EXPLICIT)

  end
  def create
    super
    show(PLACEMENT_SCREEN)
  end
end
app = FXApp.new
MyProject.new(app, "test")
app.create
app.run

thanks

Krzys


More information about the fxruby-users mailing list