[Fxruby-users] Creating new frames
Status: Inactive
Brought to you by:
lyle
From: Phil S. <ps...@oz...> - 2003-10-08 12:55:12
|
I want to create different entry fields depending upon which button is selected. I would like to do this by calling a function (see example below, pressing <Add> should create one label and one text entry box). This does not work and I thought it was because it was created but hidden, however adding a .show had no effect. If someone could enlighten me I would appreciate it. #!/usr/bin/env ruby require 'fox' include Fox class Test < FXMainWindow def initialize(app) super(app, "Test", nil, nil, DECOR_ALL, 0, 0, 640, 480, 0, 0) body = FXHorizontalFrame.new(self, LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH ) topbuttons=FXHorizontalFrame.new(body, LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 20, 20, 20, 20) FXButton.new(topbuttons, "Add").connect(SEL_COMMAND) {add(body) } FXButton.new(topbuttons, "&Quit", nil, app, FXApp::ID_QUIT) end def add(body) FXLabel.new(body,"text 1") FXTextField.new(body,numcolumns=20) body.show end def create super show(PLACEMENT_SCREEN) end end application = FXApp.new("Test", "FoxTest") Test.new(application) application.create application.run |