Re: [Fxruby-users] New tab item not visible via block
Status: Inactive
Brought to you by:
lyle
From: Rich <ri...@li...> - 2004-06-17 18:40:38
|
Are you instantiating Objects without 'show'ing them? Everything that is instantiated before the MainWindow is shown will be shown along with the MainWindow. Anything else that is created while the application is running needs to be manually shown. -Richard ----- Original Message ----- From: "Duane Johnson" <dua...@gm...> To: <fxr...@li...> Sent: Thursday, June 17, 2004 11:42 AM Subject: [Fxruby-users] New tab item not visible via block > I have an FXTabBook object to which I'm adding pairs of FXTabItem and > FXFrame. This works perfectly until I try to add a pair from within a > menu item message block. In other words, I want to be able to click > "New" in the file menu and have a new tab item with its contents > appear. The trouble is that although the code is being executed, the > FXTabItem is not appearing. > > Here is the code (simplest case): > > <pre> > require 'fox' > require 'fox/colors' > > include Fox > > class PlayTextMainWindow < FXMainWindow > def initialize(app) > # Call the base class initialize() first > super(app, "PlayText", nil, nil, DECOR_ALL, 0, 0, 800, 600) > > # Menu bar, along the top > menubar = FXMenubar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) > > # Separator > FXHorizontalSeparator.new(self, > LAYOUT_SIDE_TOP|LAYOUT_FILL_X|SEPARATOR_GROOVE) > > $editorTabs = FXTabBook.new( self, nil, 0, > LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP) > > # NOTE: This call to addEditor WORKS > addEditor( "New" ) > > # File menu > filemenu = FXMenuPane.new(self) > FXMenuCommand.new(filemenu, "&New\tCtl-N\tNew Text > Window.").connect(SEL_COMMAND) do > # NOTE: This call to addEditor is made, but a new tab DOES NOT appear! > addEditor( "test", "", true ) > end > FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application.", nil, > getApp(), FXApp::ID_QUIT) > FXMenuTitle.new(menubar, "&File", nil, filemenu) > end > > def addEditor( title, filename="", focus=true ) > ti = FXTabItem.new( $editorTabs, title, nil, > LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_LEFT ) > > p title > # Play text window > frame = FXHorizontalFrame.new( $editorTabs, > LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_LINE ) > editor = FXText.new( frame, nil, 0, > TEXT_WORDWRAP|LAYOUT_FILL_X|LAYOUT_FILL_Y) > if( focus ) > $currentTextWindow = editor > $currentTextWindow.setFocus() > end > end > > def create > super > show(PLACEMENT_SCREEN) > end > end > > if __FILE__ == $0 > application = FXApp.new("PlayText", "(C)2004 Duane Johnson") > stw = PlayTextMainWindow.new( application ) > stw.enable > > # NOTE: This call to addEditor WORKS > stw.addEditor( "duane", "", true ) > > application.create > application.run > end > </pre> > > I'd love to have some ideas on where I can modify this. Thanks! > > Duane Johnson > > > ------------------------------------------------------- > This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference > Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer > Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA > REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |