Re: Gtk3 Scrolled Window's horizontal scrollbar not working properly



OK I've finally figured out what's triggering this.

In my Gtk2 version of this class, I was grabbing each GtkTreeViewColumn and going:

$column->set_sizing( "fixed" );

To be honest, I'm not even sure why I was doing this. I must have had a reason at one point. Anyway, I've commented this out, and everything works perfectly.

I'm not sure if this is a bug of not, and if it is, if it's with Gtk2 or Gtk3. It's different behaviour anyway, and my gut says that setting 'fixed' sizing should not break scrolling horizontally.

Dan

On Wed, Dec 25, 2013 at 2:10 PM, Daniel Kasak <d j kasak dk gmail com> wrote:
Here's the current project. I've bundled the as-yet-unreleased Gtk3::Ex::DBI::Datasheet, which does most of the work regarding the treeview. In this little app, it's not doing *that* much though - sets up the columns & renderers. I use Gtk3::Builder to lay out the GUI. I pass a the treeview into Gtk3::Ex::Datasheet::DBI and it sets it all up. Not really much else to say, other than at least in regards to Gtk2, I do mostly know what I'm doing ;) I create treeviews like this all the time in Gtk2. Anyway, there is no viewport in my builder file. The treeview is sitting directly in the scrolled window.

Unpack the tarball into your home folder. It will look for it's database in ~/.powercom. I've included a database. You should be able to run it by cd-ing into .powercom and running:


By default, if you don't define column definitions ( ie in this example app ), Gtk3::Ex::DBI::Datasheet will set them up with what it thinks are reasonable defaults. If you resize the window, the columns will also resize. I've also tried just now defining fixed-width columns. This doesn't help. To do this, add the 'fields' key in powercom::viewer:

    $self->{readings} = Gtk3::Ex::DBI::Datasheet->new(
        {
            dbh             => $self->{globals}->{db},
            sql             => {
#                                    select          => "id, reading_datetime, panel_1_voltage, accumulated_energy",
                                    select          => "*"
                                  , from            => "readings"
                                  , order_by        => "id"
                               },
            treeview        => $self->{form}->get_object( "readings_datasheet" ),
            fields          => [
                                    {
                                        name        => "id",
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "serial_number"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "reading_datetime"
                                      , x_absolute   => 100
                                    }
                                  , {
                                        name        => "heat_sink_temperature"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "panel_1_volage"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "panel_1_dc_voltage"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "working_hours"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "operating_mode"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "tmp_f_value"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "pv_1_f_value"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "gfci_f_value"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "fault_code_high"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "fault_code_low"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "line_current"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "line_voltage"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "ac_frequency"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "ac_power"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "zac"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "accumulated_energy"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "gfci_f_value_volts"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "gfci_f_value_hz"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "gz_f_value_ohm"
                                      , x_absolute  => 100
                                    }
                                  , {
                                        name        => "gfci_f_value"
                                      , x_absolute  => 100
                                    }
                               ],
        }
    );

By the way, Gtk3::Ex::DBI::Datasheet is not yet complete. I have to rewrite all the dialogs, and then do lots of testing.

If this looks too much for people to look into ( admittedly there's quite a bit going on under the covers ), I can try to produce a cut-down version with the same issue.

Dan


On Tue, Dec 24, 2013 at 8:58 PM, zentara <zzmiloschxx gmail com> wrote:
On Tue, 24 Dec 2013 09:02:44 +1100
Daniel Kasak <d j kasak dk gmail com> wrote:

>I've just noticed something strange. In Gtk3, my scrolled windows aren't
>detecting the width of a treeview properly.
>
>If I set their Horizontal Scrollbar Policy to 'automatic' ( I'm using
>Glade, by the way ), I never get a scrollbar, and I can't access things
>which don't fit horizontally inside the treeview. If I set the policy to
>'always', I get a scrollbar, but it acts like everything fits ... ie
>scrollbar covers the entire horizontal area, and doesn't allow scrolling.

>Does anyone know why this would be? I can try to build a simple example app
>if that's needed. At the moment, this is app is using the Gtk3 port of my
>DBI Datasheet class - it's showing values I've pulled from a solar inverter.

Hi,
 I think you need to post a minimal code example so we can see
how you are building the widgets. FWIW, you should not use a viewport
with a TextView.  Without seeing the code, the following is a likely
culprit.

This is wrong:
 my $sw = Gtk2::ScrolledWindow->new;
 $sw->add_with_viewport( $self->{TextView} );

TextView is a natively-scrollable widget, so adding with a viewport actually
breaks some of the built-in sizing and scrolling logic.

It should be
$sw->add ($self->{TextView});

Otherwise, post some code.

0m,
zentaraa



_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]