tags:

views:

215

answers:

1

I set background image for a button by:

bg_pixmap[NORMAL] = "img.png"

but most of the times the image is offset with certain x, y when:

  • there is padding around
  • there is adjacent widgets at left/top
  • align the button 0.5, 0.5 of an alignment container of larger size
  • ...

how can I specify the background image to alway start from 0, 0 of the button?


EDIT

it seems bg_pixmap is always tiling start from 0, 0 of the window ( but shown only in the button area )....

but when I use bg_pixmap on widgets not has state changes (only NORMAL image is shown), the image is aligned correctly... (e.g. drawing area, event box, etc...)


WORKAROUND

I worked around this and make an "image button" works with rc style file:

  • add GtkButton inside an EventBox
  • EventBox -> Visible Window = Yes ( No won't make it work )

but who can explain this?

A: 

Looks that Gdk::Window::set_back_pixmap is the function you are looking for. Point is the parent_relative boolean that change the tiling starting point.

C. F.

C. Forest