[ANN] foxGUIb - Interactive Fox GUI Builder and Code Generator

  • Thread starter henon (meinrad recheis)
  • Start date
H

henon (meinrad recheis)

I get:

% ruby -I .:./FX:./gui foxGUIb.rbw
./FX/fxbase.rb:487: undefined superclass `FXScintilla' (TypeError)
from ./__FX__.rb:6:in `require'
from ./__FX__.rb:6
from foxGUIb.rbw:12:in `require'
from foxGUIb.rbw:12

Where do I get FXScintilla?
class FXScintilla is part of FXRuby and therefore i don't understand the
error message.

i encountered similar errors with one specific ruby version (don't
remember which one) and worked around by changing to a annother ruby
version. maybe it's a bug in your ruby version.

btw my current version is quite old ;)
ruby 1.8.2 (2004-06-29) [i386-mswin32] <<

- henon
 
J

Jim Weirich

Michael Neumann said:
That doesn't work with RubyGems! [...]

If I remove both "s.autorequire" and "s.require_paths" from it's
gemspec, and add 'ext/fox12.so' to the "s.files" list, then it works!
Seems to be a RubyGems bug!

No sorry. It does not work. It loads the gem, but not the fox12.so.

Michael,

Are you talking about the FxRuby gem? What platform are you on? If you
can send a quick snippet that demonstrates the failure, I'll look over any
rubygems issues.
 
M

Michael Neumann

Jim said:
Michael Neumann said:

That doesn't work with RubyGems! [...]

If I remove both "s.autorequire" and "s.require_paths" from it's
gemspec, and add 'ext/fox12.so' to the "s.files" list, then it works!
Seems to be a RubyGems bug!

No sorry. It does not work. It loads the gem, but not the fox12.so.


Michael,

Are you talking about the FxRuby gem? What platform are you on? If you
can send a quick snippet that demonstrates the failure, I'll look over any
rubygems issues.

Platform: DragonFlyBSD (FreeBSD 4.x).
ruby 1.8.2 (2004-12-22) [i386-dragonfly1.1]
gem --version 0.8.4
gem list
fxruby (1.2.2)
...
LoadError: No such file to load -- fox12
from
/home/mneumann/Programs/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:26:in
`require'
from (irb):2


That's all I can tell for now.

Regards,

Michael
 
M

Mark Smith

Martin DeMello said the following on 1/5/2005 2:28 PM:
FWIW, it doesn't currently work with 1.2 - I got the following (after
changing all 'require fox' to 'require fox12') :

$ ruby foxGUIb.rbw
./FX/fxbase.rb:386: uninitialized constant Fox::FXMenubar (NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `r

Looks familiar. Had the same problem this week when playing with my own
XML viewer (with REXML). To solve this one, change all FXMenubar
constants to FXMenuBar (also change FXTreelist to FXTreeList).

Further, the docs for FXTreeList aren't right, so I guess Lyle still has
a few more loose ends to tie up. [XTreeList(p, nvis, tgt=nil, sel=0...]
Try to enter an integer for nvis, and get a type error--it only accepts
'nil' for the second parm, and an integer for seletor--but I can't get
it to recognize the selector to pass to an 'onCmd' method.

--
Regards,

Mark Smith mailto:mas.lists[at]cox.net
================================================================
A: Yes.
Q: Are you sure?
================================================================
 
M

Mark Smith

Mark Smith said the following on 1/5/2005 6:11 PM:
Looks familiar. Had the same problem this week when playing with my own
XML viewer (with REXML). To solve this one, change all FXMenubar
constants to FXMenuBar (also change FXTreelist to FXTreeList).

ERROR -- FXTreeList is the same constant -- it was FXTooltip that needs
to be FXToolTip [sorry]

--
Regards,

Mark Smith mailto:mas.lists[at]cox.net
================================================================
A: Yes.
Q: Are you sure?
================================================================
 
L

Laurent Julliard

henon said:
Thanks for pointing this out. foxGUIb is currently based on FXRuby
1.0.29. I did never test it with FXRuby 1.2.2.

Porting to the new FXRuby version is one of the next big tasks for me.
- henon

Actually it's not that big a task. I went through the same migration
for the FreeRIDE application some time ago and, although FreeRIDE is
quite a large application, it only took more a few hours of work to
make the necessary changes.

The best thing to is to go through Lyle Johnson's excellent document
step by step and apply the changes as described. (see
http://www.knology.net/~lyle/fox/1.2/WhatsNew.html-toc.html)

And by the way, having foxGUIb ported to FOX 1.2 would be a good start
for a tighter integration with the FreeRIDE Ruby IDE. That would be
really
cool!

Laurent
 
T

tony summerfelt

this isn't bad. i need to get a interface up and running quickly, and
this tool seems to be the quickest way in combination with the one
click installer.

i'm porting my blogging app to ruby and one of the major pieces
missing is the gui. i'm trying to recreate the my tkblog interface:

http://home.cogeco.ca/~tsummerfelt1/downloads/tkblog.jpg

i could use ruby/tk, but it would be a manual port. i thought i
would try a gui builder...

i came -><- this close to actually getting something working, without
knowing any fxruby at all. i couldn't get the buttons aligned the way
like the screenshot shows, but i was only working with it a minute or
two...

http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
H

Hidetoshi NAGAI

Hi,

From: tony summerfelt <[email protected]>
Subject: Re: [ANN] foxGUIb - Interactive Fox GUI Builder and Code Generator
Date: Sun, 9 Jan 2005 03:45:40 +0900
Message-ID: said:
i could use ruby/tk, but it would be a manual port.

Ruby/Tk can load Tcl/Tk script files.
So, one of the easiest way is to extract the GUI part of your script
and load it into Ruby/Tk.
 
H

Hidetoshi NAGAI

Hi,

From: tony summerfelt <[email protected]>
Subject: Interactive Fox GUI Builder and Code Generator
Date: Mon, 10 Jan 2005 03:44:52 +0900
Message-ID: <[email protected]>
i did not know that...has anybody done this and liked the results?
for me that's a good short term solution.

However, you must decide how to get information from your GUI.
The following is a sample of using Tcl/Tk's 'rolodex' demo.
Please attend that Ruby/Tk creates widget objects automatically
when refers the widgets.

# Of course, you can create a widget object for a widget
# (that already exists) by your method call.
# e.g. TkEntry.new:)widgetname=>'.frame.entry1', :without_creating=>true)

----------------------------------------------------------
$ /usr/local/bin/irb -r tk
irb(main):001:0> Tk.load_tclscript('rolodex')
=> ""
irb(main):002:0> Thread.new{Tk.mainloop}
=> #<Thread:0x40308768 sleep>
irb(main):003:0> TkWinfo.children(Tk.root)
=> [#<TkFrame:0x402f08c0 @path=".frame", @colormap=nil, @classname="Frame", @visual=nil, @db_class=TkFrame, @container=nil>, #<TkFrame:0x402ed9f4 @path=".buttons", @colormap=nil, @classname="Frame", @visual=nil, @db_class=TkFrame, @container=nil>, #<TkFrame:0x402ed3f0 @path=".menu", @colormap=nil, @classname="Frame", @visual=nil, @db_class=TkFrame, @container=nil>]
irb(main):004:0> TkWinfo.children(Tk.root).size
=> 3
irb(main):005:0> f = TkWinfo.children(Tk.root)[0]
=> #<TkFrame:0x402f08c0 @path=".frame", @colormap=nil, @classname="Frame", @visual=nil, @db_class=TkFrame, @container=nil>
irb(main):006:0> TkWinfo.children(f)
=> [#<TkLabel:0x402e496c @path=".frame.label1">, #<TkEntry:0x4021f600 @path=".frame.entry1">, #<TkLabel:0x4021d51c @path=".frame.label2">, #<TkEntry:0x4021b578 @path=".frame.entry2">, #<TkLabel:0x40219750 @path=".frame.label3">, #<TkEntry:0x4021810c @path=".frame.entry3">, #<TkLabel:0x40217a90 @path=".frame.label4">, #<TkEntry:0x402174dc @path=".frame.entry4">, #<TkLabel:0x40216d20 @path=".frame.label5">, #<TkEntry:0x40215a38 @path=".frame.entry5">, #<TkLabel:0x402147a0 @path=".frame.label6">, #<TkEntry:0x402128b0 @path=".frame.entry6">, #<TkLabel:0x40211140 @path=".frame.label7">, #<TkEntry:0x4020fc3c @path=".frame.entry7">]
irb(main):007:0> TkWinfo.children(f)[1].insert:)end, 'asdf')
=> #<TkEntry:0x4021f600 @path=".frame.entry1">
irb(main):008:0> e = TkWinfo.children(f)[1]
=> #<TkEntry:0x4021f600 @path=".frame.entry1">
irb(main):009:0> e.insert:)end, 'qwer')
=> #<TkEntry:0x4021f600 @path=".frame.entry1">
irb(main):010:0> e.value
=> "asdfqwer"
irb(main):011:0>
 
T

tony summerfelt

However, you must decide how to get information from your GUI.

all i need to do is process tk buttons (which button was clicked) ,
and get the text from a text widget...
irb(main):001:0> Tk.load_tclscript('rolodex')

i just tried a loading a test.tcl via irb and it ran ok...

the following didn't work though, in it's own file:

require 'tk'
Tk.load_tclscript('test.tcl')

i get:

test.rb:3: undefined method `load_tclscript' for Tk:Module
(NoMethodError)

what's interesting is that a ruby application can have ruby or tcl as
a scripting language....
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
H

Hidetoshi NAGAI

Hi,

From: tony summerfelt <[email protected]>
Subject: calling tcl/tk scripts from ruby
Date: Tue, 11 Jan 2005 04:41:55 +0900
Message-ID: said:
i just tried a loading a test.tcl via irb and it ran ok...

the following didn't work though, in it's own file:

require 'tk'
Tk.load_tclscript('test.tcl')

i get:

test.rb:3: undefined method `load_tclscript' for Tk:Module
(NoMethodError)

Oh, sorry! That is one of many new features of Ruby1.8.2.
The definition of the method is very simple.
--------------------------------------------------------
def Tk.load_tclscript(file, enc=nil)
if enc
# TCL_VERSION >= 8.5
tk_call('source', '-encoding', enc, file)
else
tk_call('source', file)
end
end
 
H

Hidetoshi NAGAI

Hi,

From: tony summerfelt <[email protected]>
Subject: Re: calling tcl/tk scripts from ruby
Date: Tue, 11 Jan 2005 12:10:05 +0900
Message-ID: said:
thanks...that worked...the gui exited immediately, so i'll have to
play around with interacting with the gui, but i like this idea of
creating the gui code in pure tcl/tk...

Did you call Tk.mainloop after loading Tcl script?
e.g.
 
T

tony summerfelt

Did you call Tk.mainloop after loading Tcl script?

smacks head...yeah, got it...

there's a bit of a logistics problem. usuall tk callbacks are defined
within the creation of the widget...

for example:

button .b -text "Quit" -command {proc_quit}
pack .b

am i wasting my time working with this? each button would have an
associated -command {proc} attached to it that would ideally be passed
to the ruby program.

and i think i asked this before but does using tk of any form within
ruby exclude the use of regular ruby threading?
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
 
H

Hidetoshi NAGAI

Hi,

From: tony summerfelt <[email protected]>
Subject: Re: calling tcl/tk scripts from ruby
Date: Tue, 11 Jan 2005 13:20:27 +0900
Message-ID: said:
there's a bit of a logistics problem. usuall tk callbacks are defined
within the creation of the widget...

for example:

button .b -text "Quit" -command {proc_quit}
pack .b

am i wasting my time working with this? each button would have an
associated -command {proc} attached to it that would ideally be passed
to the ruby program.

Hmm...
In the procedure, if you have values that should be passed to ruby,
the values must be able to accessed in global space, because a button
widget's command option doesn't return a value.

# If you don't have such values, your script will work properly
# without editing.

When the procedure set the values to global variables,
you can access the variables with TkVarAccess.new(varname).
And you can trace or wait the TkVarAccess object.

If you want to call the Tk procedure and additional Ruby operation,
you can wrap the Tk procedure by a Ruby's procedure.

# Then, you can get the return value of the Tk procedure.

For example,
( ... after loading your example ... )
b = TkButton.new:)widgetname=>'.b', :without_creating=>true)
cmd = b.command # get the current command option's value
b.command{ret = Tk.ip_eval(cmd); p ['ruby', ret]}

You can also use 'ruby' (or 'ruby_cmd' on Ruby-1.8.2) on the Tk.
tcltklib adds them to the Tk interpreter.
'ruby script' calls Ruby API: rb_eval_string(script).
'ruby_cmd receiver method ?arg ...?' calls 'receiver.method(arg, ...)'.
However, the receiver must be a module or a class or a constant or
a global variable.

Maybe, one of those ways helps you ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top