Thread: [Fxruby-users] How do you get the width of a wdiget?
Status: Inactive
Brought to you by:
lyle
From: Rich <ri...@li...> - 2004-01-08 03:04:56
|
When I output the 'width' of a widget I get '1'... I'm assuming that's = because it's autosized - but then how can I tell how big it is at any = time during runtime? I looked through the archives at SourceForge, but none of the subject = lines seemed to match. Thanks for any help with such a simple question! -Rich |
From: Rich <ri...@li...> - 2004-01-08 06:38:01
|
I think I answered my own question - I was asking for the width before = the window had been 'drawn' (is that the right term?)... so I got '1'. If I asked for the width after it was drawn, then I got the more = sensible answer... -Rich |
From: Rich <ri...@li...> - 2004-01-08 06:46:09
|
I'm trying to insert my own FXTextField right after the directory drop = down in the first FXHorizontalFrame... but I've only found the = 'children()' method as the way to navigate through the existing = structure... and that returns an FXWindow... reparent and linkAfter = require an FXComposite type as the parameter... Here's the two different NON-working code attempts: localVF=3DFXVerticalFrame.new(contentHF,LAYOUT_FILL_X|LAYOUT_FILL_Y) lfs=3DFXFileSelector.new(localVF,nil,0,LAYOUT_FILL_X|LAYOUT_FILL_Y) ldTF=3DFXTextField.new(localVF,20,nil,0,LAYOUT_FILL_X) ldTF.reparent(lfs.children()[0]) ...and a different approach... localVF=3DFXVerticalFrame.new(contentHF,LAYOUT_FILL_X|LAYOUT_FILL_Y) lfs=3DFXFileSelector.new(localVF,nil,0,LAYOUT_FILL_X|LAYOUT_FILL_Y) ldTF=3DFXTextField.new(lfs.children()[0],20,nil,0,LAYOUT_FILL_X) ldTF.linkAfter(lfs.children()[0].children()[3]) What are my options? Is there an easy/easier way to 'insert' something = into an existing widget like the FXFileSelector? -Rich |
From: Rich <ri...@li...> - 2004-01-08 07:10:00
|
Here's the code: require 'fox' include Fox theApp=3DFXApp.new mainwin=3DFXMainWindow.new(theApp,"Test") puts FXTextField.new(mainwin,20).getClassName() theApp.create mainwin.show(PLACEMENT_SCREEN) theApp.run -Rich |
From: Joel V. <vj...@PA...> - 2004-01-08 07:20:49
|
Rich wrote: > Here's the code: > > require 'fox' > include Fox > theApp=FXApp.new > mainwin=FXMainWindow.new(theApp,"Test") > puts FXTextField.new(mainwin,20).getClassName() > theApp.create > mainwin.show(PLACEMENT_SCREEN) > theApp.run I dunno (maybe it has something to do with the way C++ classes are wrapped), but puts FXTextField.new(mainwin,20).class.name behaves in an unsurprising way. Hope that helps... |
From: Lyle J. <jl...@cf...> - 2004-01-08 16:10:56
|
Rich wrote: > puts FXTextField.new(mainwin,20).getClassName() It's returning the name of the underlying C++ class. There's no reason for this function to even be exposed to the Ruby interface, just an oversight on my part. If you need to know the Class of the Ruby object you've got, just use the standard Object#class instead. |
From: Lyle J. <jl...@cf...> - 2004-01-09 16:27:17
|
Rich wrote: > I'm trying to insert my own FXTextField right after the directory drop > down in the first FXHorizontalFrame... but I've only found the > 'children()' method as the way to navigate through the existing > structure... and that returns an FXWindow... reparent and linkAfter > require an FXComposite type as the parameter... <snip code examples> > What are my options? Is there an easy/easier way to 'insert' something > into an existing widget like the FXFileSelector? The approaches that you're trying are correct, but there is a problem with the return values for FXWindow#children. The first child widget for the FXFileSelector is supposed to be an FXHorizontalFrame but it's being returned to you as an FXWindow instance instead. I know what's wrong, but I don't think there's a workaround for FXRuby-1.0.27. I have added this to the bug list and it should be fixed in the next release. |
From: Rich <ri...@li...> - 2004-01-10 04:18:51
|
Thanks a ton for your response... I'm really impressed with FOX - until now I haven't really had much hope of ever being able to code a GUI... this rocks!! -Rich ----- Original Message ----- From: "Lyle Johnson" <jl...@cf...> To: <ri...@li...> Cc: <fxr...@li...> Sent: Friday, January 09, 2004 9:26 AM Subject: Re: [Fxruby-users] reparent/linkAfter in FXFileSelector widget > Rich wrote: > > > I'm trying to insert my own FXTextField right after the directory drop > > down in the first FXHorizontalFrame... but I've only found the > > 'children()' method as the way to navigate through the existing > > structure... and that returns an FXWindow... reparent and linkAfter > > require an FXComposite type as the parameter... > > <snip code examples> > > > What are my options? Is there an easy/easier way to 'insert' something > > into an existing widget like the FXFileSelector? > > The approaches that you're trying are correct, but there is a problem > with the return values for FXWindow#children. The first child widget for > the FXFileSelector is supposed to be an FXHorizontalFrame but it's being > returned to you as an FXWindow instance instead. I know what's wrong, > but I don't think there's a workaround for FXRuby-1.0.27. I have added > this to the bug list and it should be fixed in the next release. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |