LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-05-2010, 01:16 PM   #1
robuxbiz
LQ Newbie
 
Registered: Jun 2010
Posts: 4

Rep: Reputation: 0
[ruby][gtk2] Style Property - How to change?


Posted by Robux Biz (robux) on 05.06.2010 19:39
Hi everybody!

I can see style property:

btn = Gtk::Button.new
puts btn.style_get_property('image-spacing') # "2"

But how can I change the value to "0"?
 
Old 06-05-2010, 02:02 PM   #2
robuxbiz
LQ Newbie
 
Registered: Jun 2010
Posts: 4

Original Poster
Rep: Reputation: 0
I did that:
Code:
   class ClsBtn < Gtk::Button
     type_register
         install_style_property(GLib::Param::Int.new('image-spacing',
         'image-spacing', '', 0, 10000, 0,
         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 becames "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)

Last edited by robuxbiz; 06-05-2010 at 02:42 PM.
 
Old 06-06-2010, 02:55 AM   #3
robuxbiz
LQ Newbie
 
Registered: Jun 2010
Posts: 4

Original Poster
Rep: Reputation: 0
I did that:

Code:
  style = closebtn.modifier_style 
  style.xthickness = 0 
  style.ythickness = 0 
  closebtn.modify_style(style)
But fields are still exist. Any else ideas?
 
Old 06-06-2010, 04:46 AM   #4
robuxbiz
LQ Newbie
 
Registered: Jun 2010
Posts: 4

Original Poster
Rep: Reputation: 0
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
 
  


Reply

Tags
ruby


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: "Intellectual Property" a Violation of Real Property LXer Syndicated Linux News 1 11-11-2009 05:39 AM
ruby/gtk2 drawingarea Komakino Programming 3 07-06-2006 10:01 PM
Reverting GTK2 open/save dialog box to old (GTK1) style wirawan0 Linux - Software 1 02-23-2006 01:44 PM
how to change mandrake style menu to kde style menu msalimane Mandriva 1 12-07-2004 01:16 PM
How do you change the file Property from Read Only to .... Charlie Chan Linux - Newbie 1 05-16-2004 12:52 PM


All times are GMT -5. The time now is 11:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration