Dear all Sorry to ask this, I know I can find some of answers in doc if I dig deeper But I'm tight on schedule, So please reply if you are willing to 1. How to change font size in label and entry widget ? 2. How to differentiate color in treeview row (odd grey, even white or vice versa) ? 3. How to make anything typed on entry become uppercase ? 4. How to right align column in treeview? also center-align? I'm making a POS program and it's been partially implemented (at my own store) that's why I need this fast Regards, Hendra
on 2011-04-01 14:47

on 2011-04-01 18:31

2011/4/1 hendra kusuma <penguinroad@gmail.com>: > Dear all > > Sorry to ask this, I know I can find some of answers in doc if I dig deeper > But I'm tight on schedule, So please reply if you are willing to > > 1. How to change font size in label and entry widget ? Take a look at http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk::Label My tests: Gtk::Label#set_markup('<span size="x-large">toto</span>') works Gtk::Label#set_markup('<span size="32">toto</span>') does not work (Is it a bug??) > 2. How to differentiate color in treeview row (odd grey, even white or vice > versa) ? http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-tre... > 3. How to make anything typed on entry become uppercase ? You can convert entry text to uppercase when it is activated. Or do you really need to convert each letter when it is typed ? > 4. How to right align column in treeview? also center-align? http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk::Ce... > > > -- Vincent Carmona
on 2011-04-01 21:06
hendra kusuma wrote in post #990384: > 1. How to change font size in label and entry widget ? it's easy enough to implement a file chooser dialog where you can choose the font and size... http://ruby-gnome2.sourceforge.jp/de/hiki.cgi?Gtk:... and a color selection dialog... http://ruby-gnome2.sourceforge.jp/it/hiki.cgi?Gtk:... ...and then use them in your pango markup.... for example: def fontSelect d = Gtk::FontSelectionDialog.new d.set_font_name(@font) if @font != nil response = d.run if response == Gtk::Dialog::RESPONSE_OK @font = d.font_name # fontdesc = Pango::FontDescription.new(@font) # @fontBtn.modify_font(fontdesc) # # @fontBtn.set_label(@font) # these are specific to my app end d.destroy end #fontSelect def fontColorSelect d = Gtk::ColorSelectionDialog.new sel = d.colorsel # sel.set_previous_color(@fC) # sel.set_current_color(@fC) sel.set_has_palette(true) response = d.run if response == Gtk::Dialog::RESPONSE_OK @fR = sel.current_color.red @fG = sel.current_color.green @fB = sel.current_color.blue @fC = Gdk::Color.new(@fR, @fG, @fB) @fColor = @fC.to_s @fcsample.modify_bg(Gtk::STATE_NORMAL, @fC) end d.destroy end #fontColorSelect ## and then later... info = "blargh" @infoTxt.set_markup(%Q[<span font_desc="#{@font}" foreground="#{@fColor}">#{info}</span>]) > 3. How to make anything typed on entry become uppercase ? entry = Gtk::Enty.new # do whatever you're going to do... entry.editing_done entrytext = entry.text.upcase -j
on 2011-04-02 03:34

Dear all, Thanks for replying Those markup are good. But I thing that's only applicable to label (or am I missing something here?) How about font size for entry? Thanks for number 3 I would like to convert each letter when it is typed I'm checking all your suggestion now Thanks
on 2011-04-02 04:16
hi hendra -
>How about font size for entry? Thanks
a quick look at "Gtk::Entry.instance_methods" shows me a #modify_font
method... not sure, but this would probably look something like
Gtk::Entry#modify_font(Gtk::STATE_NORMAL,##myfont##)
where ##myfont## is a font_description with family and size specified
(all simplified with the FontSelectionDialog...)
as for number 3, why do you need to convert while typing? do you have
background processes running based on each letter? you can convert it
to uppercase with a simple String#upcase immediately after entering
it...
good luck -
-j
on 2011-04-02 05:04
Vincent Carmona wrote in post #990422: > My tests: > Gtk::Label#set_markup('<span size="x-large">toto</span>') works > Gtk::Label#set_markup('<span size="32">toto</span>') does not work > (Is it a bug??) > pango markup for some reason specifies font size in 1024's of a point (no clue why...) making "32" much to small to show. you can sidestep that by using a partial font_description, though... both of the following work: Gtk::Label#set_markup(%Q[<span size="12800">blargh</span>]) Gtk::Label#set_markup(%Q[<span font_desc="Sans Italic 12">blargh</span>]) http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup -j
on 2011-04-02 05:28

Hi, In <de9bbf47e7183925250632450c985856@ruby-forum.com> "Re: [ruby-gnome2-devel-en] Some simple question" on Sat, 02 Apr 2011 05:04:40 +0200, jake kaiden <ruby-forum-incoming@andreas-s.net> wrote: > that by using a partial font_description, though... both of the > following work: > > Gtk::Label#set_markup(%Q[<span size="12800">blargh</span>]) > > Gtk::Label#set_markup(%Q[<span font_desc="Sans Italic > 12">blargh</span>]) > > http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup Use Pango::SCALE for it: Gtk::Label#set_markup("<span size=\"#{32 * Pango::SCALE}\">toto</span>") Thanks, -- kou
on 2011-04-02 05:44

On Sat, Apr 2, 2011 at 11:27 AM, Kouhei Sutou <kou@cozmixng.org> wrote: > >> Gtk::Label#set_markup('<span size="x-large">toto</span>') works > > > > Gtk::Label#set_markup(%Q[<span font_desc="Sans Italic > > 12">blargh</span>]) > > > > http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup > > Use Pango::SCALE for it: > > Gtk::Label#set_markup("<span size=\"#{32 * Pango::SCALE}\">toto</span>") > This whole panga thing is new to me, never touch it before. Thanks It will run on windows right? I make the code on ubuntu but must deploy on windows as for number 3, this is a matter of taste my old version using delphi behave like that so users want it that way :) and no, that entry don't process any other thing also for treeview cell coloring I already use rules hint. on linux it gives me grid, but it doesn't show on windows. I wonder why. Other suggestion? on treeview column right-alignment, anyone care to give example? right now I really appreciate anything I can copy paste :D Thanks guys
on 2011-04-02 16:23

On Sat, Apr 2, 2011 at 11:43 AM, hendra kusuma <penguinroad@gmail.com>wrote: >> >> > that by using a partial font_description, though... both of the >> > and no, that entry don't process any other thing > > also for treeview cell coloring I already use rules hint. on linux it gives > me grid, but it doesn't show on windows. I wonder why. Other suggestion? > > on treeview column right-alignment, anyone care to give example? > right now I really appreciate anything I can copy paste :D > Pango ALIGN_RIGHT not working found how to right-align column in treeview on google cell_renderer.xalign = 1.0 This works, but what is this?