RE: [Fxruby-users] Newbie question about making own drawables
Status: Inactive
Brought to you by:
lyle
|
From: Will M. <wi...@co...> - 2003-11-26 05:00:29
|
Joel VanderWerf wrote:
> > Will Merrell wrote:
> > the documentation and examples are so scant
> > that it is really hard to figure out, at least in my case.
>
> Arg, that's my fault.
Hey, don't beat yourself up, I knew your code was pretty alpha level. You
made it clear that it isn't done yet. And I *DID* figure it out. I am just
glad you wrote something that solves my problem and works well. Thanks!
> I will soon upload FoxTails 0.2, which is 1.8-friendly
> and has a tree browser widget. Maybe I'll have some
> time to document better...
That will be great, although, at this point its really Observable that I am
most working with at the moment. Once I get the current stuff working I may
use Foxtails more.
BTW any idea when you will release it?
> (The tree browser is like the other FoxTails widgets
> in that it allows multiple views and automatically
> syncs between model and view.)
Sounds great
> In the meantime, pls. feel free to ask questions,
> either here or to me directly.
If I could figure out what the questions are I'll ask them ;^)
As for documentation, I have some suggestions. The part I had the most
trouble with (still do for that matter) is figuring out how to work
observable things in other objects like windows. For example, if a value in
that window over there changes how do I find out about it and react to it
over here in this window. Specfically, how do I write a when_var for a
different object. None of the examples seemed to cover this case. To work it
out I wrote a little test program that I will include below. Some better
documentation in this area would help a lot.
===================== begin include ============================
#!/usr/bin/env ruby
require 'foxtails'
include Fox
include FoxTails
class OutputWindow < FXMainWindow
observable :mydata
def initialize(app, projName)
createWindow(app, projName)
end
def createWindow(app, projName)
@app = app
@outputdlg = FXDialogBox.new(app, projName, DECOR_ALL, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0)
outputText = FTTextField.new(@outputdlg, 20, self, :mydata)
outputText.dynamic = true
end
def create
@outputdlg.create
@outputdlg.position(200, 30, 150, 20)
@outputdlg.show(PLACEMENT_DEFAULT)
end
end
class TestWindow < FXMainWindow
observable :outp, :locdata
def initialize(*args)
super
inputText = FTTextField.new(self, 20, self, :locdata)
inputText.dynamic = true
outputText = FTTextField.new(self, 20, self, :locdata)
outputText.dynamic = true
end
def create
super
position(0, 30, 150, 60)
show(PLACEMENT_DEFAULT)
@outp = OutputWindow.new(self, "Output")
@outp.create
@outp.when_mydata CHANGES do
self.locdata = @outp.mydata
end
when_locdata CHANGES do
@outp.mydata = @locdata
end
end
end
class TestApp < FTApp
def initialize
super("Test", "TEST")
TestWindow.new(self, "Test")
end
end
TestApp.new.run
====================== end include =============================
|