[fxruby-users] foxGUIb - Matrix doesn't display elements on same row

Paul Carvalho tester.paul at gmail.com
Tue Mar 23 23:18:00 EDT 2010


I am having some trouble trying to display a 2x2 Matrix correctly that was
created in FoxGUIb.

Here's what I did:
- in foxGUIb, I created: mainWindow > matrix1 (2 columns, 2 rows) > added 4
objects (button1, label1, button2, label2)
- I want it to look something like this:
-----
[ button1 ] [ label 1          ]
[ button2 ] [ label 2          ]
-----
(where the label fields fill up the remaining column space on the right)

- I modified both label field properties (i.e. in the same column on the
right) to include LAYOUT_FILL_COLUMN (and ..FILL_ROW, and ..FILL_X)
=> it looks correct in foxGUIb.

- I saved it and generated the Ruby code, but when I run it, it looks like
this:
-----
[ button1 ]
[ label 1  ]
[ button2 ]
[ label 2  ]
-----
(which is not what I want)

I've tried playing around with the layoutHints settings for each object in
the matrix but I just can't seem to get it to display in a 2x2 layout when I
run the Ruby code.  It keeps showing up as a 1x4 matrix.

Any suggestions?  I've attached the auto-generated code below for a sample
app that shows this problem.

Paul.


# -- Start --
# source generated by foxGUIb 1.0.0

class MainWindow
    def initialize( parent)
        construct_widget_tree( parent)
        init if respond_to? 'init'
    end

    def construct_widget_tree( parent)
        @topwin=
        FX::MainWindow.new(parent){|w|
            @mainWindow=w
            w.wdg_name='mainWindow'
            w.width=399
            w.shown=true
            w.y=456
            w.height=147
            w.title="Matrix test"
            w.x=17
            FX::Matrix.new(@mainWindow){|w|
                @matrix1=w
                w.wdg_name='matrix1'
                w.numRows=2
                w.frameStyle=12288
                w.width=399
                w.height=147
                w.matrixStyle=131072
                w.numColumns=2
                FX::Button.new(@matrix1){|w|
                    @button1=w
                    w.wdg_name='button1'
                    w.text="Button 1"
                    w.width=100
                    w.y=5
                    w.height=21
                    w.layoutHints=256
                    w.x=5
                }
                FX::Label.new(@matrix1){|w|
                    @label1=w
                    w.wdg_name='label1'
                    w.text="Label 1"
                    w.frameStyle=12288
                    w.width=285
                    w.y=5
                    w.height=19
                    w.layoutHints=1027
                    w.x=109
                    w.justify=32768
                }
                FX::Button.new(@matrix1){|w|
                    @button2=w
                    w.wdg_name='button2'
                    w.text="Button 2"
                    w.width=100
                    w.y=30
                    w.height=21
                    w.layoutHints=256
                    w.x=5
                }
                FX::Label.new(@matrix1){|w|
                    @label2=w
                    w.wdg_name='label2'
                    w.text="Label 2"
                    w.frameStyle=12288
                    w.width=285
                    w.y=30
                    w.height=19
                    w.layoutHints=1027
                    w.x=109
                    w.justify=32768
                }
            }
        }
    end
    attr_reader :topwin
    attr_reader :mainWindow
    attr_reader :matrix1
    attr_reader :button1
    attr_reader :label1
    attr_reader :button2
    attr_reader :label2
end

#unit test
if __FILE__==$0
    require 'libGUIb16'
    app=FX::App.new
    w=MainWindow.new app
    w.topwin.show(Fox::PLACEMENT_SCREEN)
    app.create
    app.run
end

# -- End --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100323/6477d990/attachment.html>


More information about the fxruby-users mailing list