how to set gtk2 combo box entry place

Discussion in 'Ruby' started by shawn bright, Mar 5, 2007.

  1. shawn bright

    shawn bright Guest

    OK,
    i am using ruby-gnome2 to develop a gui app.
    I have a combobox that i create with Gtk.ComboBox.new
    this is so i can populate it with append_text() and prepend_text()

    my question is, i need to be able to set it to a certain value.
    like if I have a list of items that i have used to append text to this combo,
    apple, 0
    orange, 1
    pear, 2
    grapes, 3

    and another function selects say grapes, how do i set the combobox to
    show that selection automatically ?

    does this make sense?

    thanks for any help,
    sk
     
    shawn bright, Mar 5, 2007
    #1
    1. Advertising

  2. On Tue, 6 Mar 2007 05:11:13 +0900
    "shawn bright" <> wrote:

    > OK,
    > i am using ruby-gnome2 to develop a gui app.
    > I have a combobox that i create with Gtk.ComboBox.new
    > this is so i can populate it with append_text() and prepend_text()
    >
    > my question is, i need to be able to set it to a certain value.
    > like if I have a list of items that i have used to append text to this combo,
    > apple, 0
    > orange, 1
    > pear, 2
    > grapes, 3
    >
    > and another function selects say grapes, how do i set the combobox to
    > show that selection automatically ?
    >


    widget.set_active(3)

    or

    widget.active=3

    (assuming 3 == grapes ...)

    -jonathan
     
    Jonathan Hudson, Mar 5, 2007
    #2
    1. Advertising

  3. shawn bright

    shawn bright Guest

    cool, thanks very much !
    sk

    On 3/5/07, Jonathan Hudson <> wrote:
    > On Tue, 6 Mar 2007 05:11:13 +0900
    > "shawn bright" <> wrote:
    >
    > > OK,
    > > i am using ruby-gnome2 to develop a gui app.
    > > I have a combobox that i create with Gtk.ComboBox.new
    > > this is so i can populate it with append_text() and prepend_text()
    > >
    > > my question is, i need to be able to set it to a certain value.
    > > like if I have a list of items that i have used to append text to this combo,
    > > apple, 0
    > > orange, 1
    > > pear, 2
    > > grapes, 3
    > >
    > > and another function selects say grapes, how do i set the combobox to
    > > show that selection automatically ?
    > >

    >
    > widget.set_active(3)
    >
    > or
    >
    > widget.active=3
    >
    > (assuming 3 == grapes ...)
    >
    > -jonathan
    >
    >
     
    shawn bright, Mar 5, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig G
    Replies:
    3
    Views:
    3,011
    =?Utf-8?B?TGVlIEg=?=
    Jan 16, 2005
  2. Randall Parker

    How to make first combo box entry blank?

    Randall Parker, Oct 31, 2005, in forum: ASP .Net
    Replies:
    13
    Views:
    10,957
    paintycan
    Sep 10, 2006
  3. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    604
    Bob Barrows [MVP]
    Nov 16, 2005
  4. prameela
    Replies:
    0
    Views:
    97
    prameela
    Apr 10, 2006
  5. SM
    Replies:
    2
    Views:
    381
Loading...

Share This Page