Some simple question

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

2011/4/1 hendra kusuma [email protected]:

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(‘toto’) works
Gtk::Label#set_markup(‘toto’) does not work
(Is it a bug??)

  1. How to differentiate color in treeview row (odd grey, even white or vice
    versa) ?

http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-renderer-bold

  1. 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 ?

  1. How to right align column in treeview? also center-align?

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk::CellRendererText#alignment%3D


Vincent C.

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::FontSelectionDialog

and a color selection dialog…
http://ruby-gnome2.sourceforge.jp/it/hiki.cgi?Gtk::ColorSelectionDialog

…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[#{info}])

  1. 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

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

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

Vincent C. wrote in post #990422:

My tests:
Gtk::Label#set_markup(‘toto’) works
Gtk::Label#set_markup(‘toto’) 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[blargh])

Gtk::Label#set_markup(%Q[blargh])

http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup

-j

On Sat, Apr 2, 2011 at 11:27 AM, Kouhei S. [email protected] wrote:

Gtk::Label#set_markup(‘toto’) works

Gtk::Label#set_markup(%Q[blargh])

http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup

Use Pango::SCALE for it:

Gtk::Label#set_markup(“<span size="#{32 * Pango::SCALE}">toto”)

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
:slight_smile:
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 :smiley:

Thanks guys

On Sat, Apr 2, 2011 at 11:43 AM, hendra kusuma
[email protected]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 :smiley:

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?

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Some simple question” on Sat, 02 Apr 2011
05:04:40 +0200,
jake kaiden [email protected] wrote:

that by using a partial font_description, though… both of the
following work:

Gtk::Label#set_markup(%Q[blargh])

Gtk::Label#set_markup(%Q[blargh])

http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup

Use Pango::SCALE for it:

Gtk::Label#set_markup(“<span size="#{32 *
Pango::SCALE}">toto”)

Thanks,

kou