# Style Property - How to change?

**URL:** <https://www.ruby-forum.com/t/style-property-how-to-change/189703>\
**Category:** Ruby-Gnome 2\
**Created:** [June 5, 2010, 7:39pm UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703 "2010-06-05T19:39:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robux](https://www.ruby-forum.com/u/robux)\
**Post date:** [June 5, 2010, 7:39pm UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703/1 "2010-06-05T19:39:55Z")

</div>

Hi everybody!

I can see style property:

btn = Gtk::Button.new  
puts btn.style\_get\_property(‘image-spacing’) # “2”

But how can change the value?

---

<div class="post-metadata">

**Author:** ![robux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robux](https://www.ruby-forum.com/u/robux)\
**Post date:** [June 5, 2010, 9:00pm UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703/2 "2010-06-05T21:00:13Z")

</div>

I did that:  
class ClsBtn \< Gtk::Button  
type\_register  
install\_style\_property(GLib::Param::Int.new(‘image-spacing’,  
‘image-spacing’,  
‘’, 0, 10000, 5,  
GLib::Param::READABLE|GLib::Param::WRITABLE))  
end  
closebtn = ClsBtn.new  
image = Gtk::Image.new(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)  
closebtn.add(image)  
p closebtn.style\_get\_property(‘image-spacing’)  
Property became “0”,  
but border around image is still big (not equals 0)  
How can I to decrease the button? (The button is needed for Notebook  
tabs)

---

<div class="post-metadata">

**Author:** ![robux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robux](https://www.ruby-forum.com/u/robux)\
**Post date:** [June 5, 2010, 9:45pm UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703/3 "2010-06-05T21:45:38Z")

</div>

> ```
> '', 0, 10000, 5, 
> 
> ```

It should read as:

‘’, 0, 10000, 0,

I have tried to play with parameter 🙂

---

<div class="post-metadata">

**Author:** ![robux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robux](https://www.ruby-forum.com/u/robux)\
**Post date:** [June 6, 2010, 9:56am UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703/4 "2010-06-06T09:56:55Z")

</div>

I did that:

` style = closebtn.modifier_style
  style.xthickness = 0
  style.ythickness = 0
  closebtn.modify_style(style) `

But fields are still exist. Any else ideas?

---

<div class="post-metadata">

**Author:** ![robux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f05b48/32.png) [@robux](https://www.ruby-forum.com/u/robux)\
**Post date:** [June 6, 2010, 11:47am UTC](https://www.ruby-forum.com/t/style-property-how-to-change/189703/5 "2010-06-06T11:47:33Z")

</div>

I find solution in Geany source code:

[CODE] label\_box = Gtk::HBox.new(false, 0)  
label = Gtk::Label.new(‘Page1’)  
label\_box.pack\_start(label, false, false, 0)

```
btn = Gtk::Button.new
btn.relief = Gtk::RELIEF_NONE
btn.focus_on_click = false
style = btn.modifier_style
style.xthickness = 0
style.ythickness = 0
btn.modify_style(style)
btn.set_tooltip_text("Close page1")
wim,him = Gtk::IconSize.lookup(Gtk::IconSize::MENU)
btn.set_size_request(wim+2,him+2)
btn.signal_connect('clicked') do
  $notebook.remove_page($notebook.children.index(treeview))
  store.clear
  label_box.destroy
  treeview.destroy
end

image = Gtk::Image.new(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)
btn.add(image)

align = Gtk::Alignment.new(1.0, 0.0, 0.0, 0.0)
align.add(btn)
label_box.pack_start(align, false, false, 0)

label_box.spacing = 3
label_box.show_all

page = $notebook.append_page(treeview, label_box)
treeview.show_all
$notebook.page = $notebook.n_pages-1 [/CODE]
```
