RE: [Fxruby-users] Error: FXRbGetRubyObj(this=0x084e7fb8) returns non-Qnil
Status: Inactive
Brought to you by:
lyle
|
From: Daniel S. <da...@pr...> - 2004-03-15 04:15:04
|
It looks to me like calling any of the connect() methods on a treelist
is prone to error (my code was with SEL_DELETED and SEL_INSERTED on a
treelist)
I've edited your tycho.rb file by deleting a bunch of code. I've added
code into two places (marked with -- daniels).
It appears that the pim.main.tree.connect(SEL_COMMAND) is the root
problem. Comment out that section and it exits cleanly.
---------------
require "fox"
require "yaml"
####################################################
include Fox
FillXY =3D LAYOUT_FILL_X|LAYOUT_FILL_Y
Sunken_FillXY =3D FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y
####################################################
class TopicTree < FXTreeList
=20 Index =3D "index.yaml"
=20 def addItemLast(parent,dir,path,title)
=20 #item =3D TopicItem.new(dir,path,title)
=20 # -- daniels
=20 item =3D FXTreeItem.new(title)
=20 super(parent,item)
=20 item
=20 end
=20 def expand
=20 self.expandTree(@treetop)
=20 end
=20 def initialize(contain,root_dir)
=20 tree_opts =3D
FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|
=20 LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|=
=20 TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT
=20 super(contain, 0, nil, 0, tree_opts)
=20 @treetop =3D nil
=20 load(nil,root_dir)
=20 end
=20 def load(parent,root)
=20 current =3D nil
=20 Dir.chdir(root) do
=20 # Load index for this dir
=20 info =3D File.open(Index) {|f| ::YAML.load(f) } # error if not th=
ere
=20 title =3D info[0]['title']
=20 current =3D self.addItemLast(parent,root,Dir.pwd,title)
=20 @treetop =3D current if @treetop.nil?
=20 end
=20 end
end
####################################################
class MyMain < FXMainWindow
=20 attr_reader :right, :tree
=20=20
=20 def initialize(app)
=20 super(app,"Tycho (version #{Tycho::VERSION})",nil,nil,DECOR_ALL)
=20 @rest =3D FXHorizontalFrame.new(self,FillXY)
=20 @split =3D FXSplitter.new(@rest, Sunken_FillXY)
=20 @left =3D FXVerticalFrame.new(@split,Sunken_FillXY, 0,0,0,0, 0,0,0,=
0)=20
=20 @note_widgets =3D []
=20 =20
=20 @tree =3D TopicTree.new(@left,"exper/data")
=20=20
=20 end
=20 def create
=20 super # Do base-class create first
=20 @left.width =3D 1.5*@tree.contentWidth # Make left pane wide enoug=
h
=20 self.height =3D 480
=20 self.width =3D 680
=20 show(PLACEMENT_SCREEN) # Show main window
=20 end
end
####################################################
class Tycho
=20 attr_reader :main, :app
=20 VERSION =3D "0.0.4"
=20 def initialize
=20 super
=20 @app =3D FXApp.new("Tycho","myself")
=20 @app.init(ARGV)
=20 @main =3D MyMain.new(@app)
=20 end
end
####################################################
# "Main"...
pim =3D Tycho.new
pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr|
=20 # -- daniels
=20 puts "This is the problem"
=20 #pim.main.show_notes(ptr.notes)
end
pim.app.create
pim.app.run
#########################################################################=
############
This email has been scanned by MailMarshal, an email content filter.
#########################################################################=
############
|