I am attempting to learn FXRuby, and I’m running into a small problem,
and I’m not sure if what I’m trying to do is inappropriate in FOX, or
if it’s an FXRuby thing, or if I’m just missing the big picture.
I am trying to create an application where the actual layout of the widgets
on the screen is not known at “initialize” time but rather is dynamically
updated based on the things that the user does:
If I call the “draw_display” method from within initialize, then the program
draws everything as it should be. But if I select the File/Open menu, which
calls draw_display, it does not draw the FXTreeList on my screen. Can someone
help me understand what I am failing to understand?
I would not have asked this question here, but I ransacked all of the examples
that I could with FXRuby, and none of them seem to do the precise thing I am
trying to do here, which makes me wonder if maybe I’m not supposed to be doing
this kind of thing in FOX…
Graciously,
Jacob
#— snip here —#
require 'fox’
include Fox
class MainWindow < FXMainWindow
def draw_display
@tree = FXTreeList.new(@group1, 0, nil, 0,
(FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|
LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|
TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|
TREELIST_EXTENDEDSELECT))
@one = @tree.addItemLast(nil, “One”, nil, nil)
@two = @tree.addItemLast(nil, “Two”, nil, nil)
@three = @tree.addItemLast(nil, “Three”, nil, nil)
1.upto(30) {|x|
@tree.addItemLast(@one, “Item 1-#{x}”, nil, nil)
}
end
def initialize(app)
super(app, “Main Window”, nil, nil, DECOR_ALL, 0, 0, 900, 600)
filemenu = FXMenuPane.new(self)
FXMenuCommand.new(filemenu, "Open\tCtl-O").connect(SEL_COMMAND) {
draw_display
}
menubar = FXMenubar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
FXMenuTitle.new(menubar, "&File", nil, filemenu)
@splitter = FXSplitter.new(self, (LAYOUT_SIDE_TOP|LAYOUT_FILL_X|
LAYOUT_FILL_Y|SPLITTER_REVERSED|SPLITTER_TRACKING))
@group1 = FXVerticalFrame.new(@splitter,
FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,
0,0,0,0, 0,0,0,0)
end
def create
super
show(PLACEMENT_SCREEN)
end
end
if FILE == $0
$application = FXApp.new(“Main”, “FoxTest”)
$application.init(ARGV)
MainWindow.new($application)
$application.create
$application.run
end
#— snip here —#
···
–
jnews@epicsol.org Violations of McQ flagrantly “sponsored” by…
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----