Simple question...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple question...

Chris Moller-3

...but I can't figure it out:  How do I make a tiny little button, like 10x10 pixels,  gtk_widget_set_size_request (button, 10, 10); doesn't work.  gtk_widget_size_allocate (GtkWidget *widget,    GtkAllocation *allocation); doesn't work.  ( can't make anything work using CSS.  Nothing seems to work.


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Michael Gratton
On Sat, Jun 30, 2018 at 12:38 PM, Chris Moller <[hidden email]>
wrote:
> ...but I can't figure it out:  How do I make a tiny little button,
> like 10x10 pixels,  gtk_widget_set_size_request (button, 10, 10);
> doesn't work.  gtk_widget_size_allocate (GtkWidget *widget,    
> GtkAllocation *allocation); doesn't work.  ( can't make anything work
> using CSS.  Nothing seems to work.

A GtkButton is a container with a single child (see:
<https://developer.gnome.org/gtk3/stable/GtkButton.html#GtkButton.object-hierarchy>),
so you need to make its child's size less than 10px and then reduce the
button's margin, border and padding right down as well.

But you really shouldn't do that, unless you're writing an app only
yourself will use. :)

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Chris Moller-3

Thanks. 

I'm writing a complex-number spinbutton widget that needs two sets of up/down buttons, and the default buttons are just too bloody huge.

Chris


On 29/06/18 22:55, Michael Gratton wrote:
On Sat, Jun 30, 2018 at 12:38 PM, Chris Moller [hidden email] wrote:
...but I can't figure it out:  How do I make a tiny little button, like 10x10 pixels,  gtk_widget_set_size_request (button, 10, 10); doesn't work.  gtk_widget_size_allocate (GtkWidget *widget,    GtkAllocation *allocation); doesn't work.  ( can't make anything work using CSS.  Nothing seems to work.

A GtkButton is a container with a single child (see: <https://developer.gnome.org/gtk3/stable/GtkButton.html#GtkButton.object-hierarchy>), so you need to make its child's size less than 10px and then reduce the button's margin, border and padding right down as well.

But you really shouldn't do that, unless you're writing an app only yourself will use. :)

//Mike



_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Michael Gratton
On Sat, Jun 30, 2018 at 11:58 PM, Chris Moller <[hidden email]>
wrote:
> I'm writing a complex-number spinbutton widget that needs two sets of
> up/down buttons, and the default buttons are just too bloody huge.
>

Fair enough, but the reason why GTK spin buttons are as large as normal
buttons is because they need to be easy to hit for the kinds of quick
adjustments people usually want to make when they use the mouse in that
situation.

An alternative to using tiny buttons might be to use a popover with two
spin buttons, or a composite widget with two GtkEntries, one for the
real part and one for the imaginary, and a single set of buttons to
adjust either depending on which is focused?

Just making some suggestions, of course.

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Stefan Salewski-2
In reply to this post by Chris Moller-3
On Fri, 2018-06-29 at 22:38 -0400, Chris Moller wrote:
> ...but I can't figure it out:  How do I make a tiny little button,
> like 10x10 pixels,  gtk_widget_set_size_request (button, 10, 10);
> doesn't work.  gtk_widget_size_allocate (GtkWidget *widget,  
> GtkAllocation *allocation); doesn't work.  ( can't make anything work
> using CSS.  Nothing seems to work.
>

Yes, it really should be possible to make tiny buttons -- and to some
degree it is possible, gedit for example has multiple tabs, and each
tab has a tiny close button. I have copied that gedit code once and got
it working, was my Ruby code that time. But that gedit code has changed
multiple times, so it may be necessary to copy most recent version. And
of course it may not work for all widgets unfortunately.

Of course, generally widgets should be NOT tiny, we all know that.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Chris Moller-3

My counter-example, and my inspiration, is GIMP.  When you have a control-intensive things going on--the Dodge/Burn tool, for example, has eight spinbuttons, and 24 buttons of other types all in one sub-panel, and that doesn't even include the 50 or so buttons on other panels--you just don't have room for big, user-friendly, buttons, especially when you're working with images that need huge windows just to see the details.

I've rambled on about this before, but this is my big complaint with GTK these days: a lot of the flexibility has been taken away or it requires a lot of hacking to get back.  Yeah, cramped GIMP-style controls aren't pretty, and they might be harder to use, but sometimes they're necessary--and all my apps are highly control-intensive and the big controls don't leave me enough room to deal with the images I'm trying to do things with.

Chris


On 01/07/18 10:06, Stefan Salewski wrote:
On Fri, 2018-06-29 at 22:38 -0400, Chris Moller wrote:
...but I can't figure it out:  How do I make a tiny little button,
like 10x10 pixels,  gtk_widget_set_size_request (button, 10, 10);
doesn't work.  gtk_widget_size_allocate (GtkWidget *widget,   
GtkAllocation *allocation); doesn't work.  ( can't make anything work
using CSS.  Nothing seems to work.

Yes, it really should be possible to make tiny buttons -- and to some
degree it is possible, gedit for example has multiple tabs, and each
tab has a tiny close button. I have copied that gedit code once and got
it working, was my Ruby code that time. But that gedit code has changed
multiple times, so it may be necessary to copy most recent version. And
of course it may not work for all widgets unfortunately.

Of course, generally widgets should be NOT tiny, we all know that.




_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list