[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Maximizing an MDI child window in a FXRuby application

Stephan Kämper

11/1/2003 2:15:00 PM

Hi all,

I'm trying to figure out how to write a small application that's just capable of displaying some
text in child windows. (I reduced the "mditest.rbw" script that comes with FXRuby to show the
problem I have).

My problem is:
If I run the script below and maximize the chlid window, there's no way to resize it.
The three widgets on the top right (child) window corner will dissaprear (The "under score",
"square" and "X" icons to minimize, close and maximize the window).

# Originally written on this config:
# Ruby version: 1.8.0 / 2003-08-04
# Dave & Andy's 1-click-installer
# with the latest FXRuby added to it
#
# System type: i386-mswin32
# FXRuby Version: 1.0.27
# FOX Version: 1.0.46

require "fox"
require "fox/responder"
include Fox

class Bb < FXMainWindow

include Responder

def initialize( app )

super( app, "Bare Bones...", nil, nil, DECOR_ALL, 0, 0, 500, 400, 0, 0 )
menubar = createMenu
@mdiclient = FXMDIClient.new( self, LAYOUT_FILL_X | LAYOUT_FILL_Y )
mdichild = createTestWindow( 10, 10, 400, 300 )
@mdiclient.setActiveChild( mdichild )

end

def createMenu
menuBar = FXMenubar.new( self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X )
fileMenu = FXMenuPane.new( self )
FXMenuCommand.new( fileMenu, "&Quit", nil, app, FXApp::ID_QUIT )
FXMenuTitle.new( menuBar, "&File", nil, fileMenu )
return menuBar
end

# Create a new MDI child window
def createTestWindow( x, y, w, h )
mdichild = FXMDIChild.new(@mdiclient, "Child", nil, nil, 0, x, y, w, h )
scrollwindow = FXScrollWindow.new( mdichild, 0 )
text = FXText.new( scrollwindow, mdichild, LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100 )
text.text = "A Rose is a rose is a rose.\n\n Gertrude Stein"
mdichild
end

def Bb.run
application = FXApp.new( "Bare bones ...", "Stephan Kämper" )
application.init( ARGV )
main = Bb.new( application )
application.create()
main.show( PLACEMENT_SCREEN )
application.run()
end
end

if __FILE__ == $0
Bb.run
end

2 Answers

Lyle Johnson

11/1/2003 9:19:00 PM

0

Stephan Kämper wrote:

> I'm trying to figure out how to write a small application that's just
> capable of displaying some text in child windows. (I reduced the
> "mditest.rbw" script that comes with FXRuby to show the problem I have).
>
> My problem is:
> If I run the script below and maximize the chlid window, there's no way
> to resize it.
> The three widgets on the top right (child) window corner will dissaprear
> (The "under score", "square" and "X" icons to minimize, close and
> maximize the window).

Well, the short answer is, compare your reduced program to the original
mditest.rbw example and figure out what you took out ;)

But here's a hint: look at the section of the original mditest.rb
example program that begins with the comment "MDI buttons in menu..."
and copy the code that creates any of the buttons that you're interested
in. In your case, it sounds like you want to add an FXMDIDeleteButton,
FXMDIRestoreButton and FXMDIMinimizeButton to the main menu bar.

Stephan Kämper

11/1/2003 9:58:00 PM

0


Lyle Johnson wrote:
> Well, the short answer is, compare your reduced program to the original
> mditest.rbw example and figure out what you took out ;)
>

Oh dear. Being able to read is such a Good Thing. ;-) Perhaps it should actually do it. Blush...
(Now that I _have_ read it, I actually understand what the comment says... )

Thanks Lyle!


Happy Rubying


StePhan