Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 306089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:26:05+00:00 2026-05-12T07:26:05+00:00

I am trying to make a multiple-select listbox in glade/ruby program and I am

  • 0

I am trying to make a multiple-select listbox in glade/ruby program and I am wondering how I go about doing this, like what element I add to the window and the corresponding example code I can use. I was looking at GTKList but it says it is deprecated now, and also I don’t know how to get it working in ruby. GTK List docs say to use TreeView, but I have no idea how to set that up.

Just to be clear, I would like something like this, where the user can select multiple entries:

alt text http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/OutputPreselectListBox.JPG

Thanks for the help guys! I am really desperate on this question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:26:06+00:00Added an answer on May 12, 2026 at 7:26 am

    Basically, you have to use GtkTreeView and set its “model” property to a GtkListStore that contains your data.
    GtkTreeView manages selection with GtkTreeSelection class. Use gtk_tree_view_get_selection (or whatever it is mapped to in ruby-gtk) to get the GtkTreeSelection. And set the selection mode to “multiple”.

    Here’s an example in Python. In Ruby/Gtk it should be similar.

    import pygtk
    pygtk.require('2.0')
    import gtk
    import gobject
    
    
    w = gtk.Window()
    w.connect('destroy', lambda w:gtk.main_quit())
    
    l = gtk.ListStore(gobject.TYPE_STRING)
    
    l.append(('Vinz',))
    l.append(('Jhen',))
    l.append(('Chris',))
    l.append(('Shynne',))
    
    treeview = gtk.TreeView()
    treeview.set_model(l)
    
    column = gtk.TreeViewColumn()
    cell = gtk.CellRendererText()
    column.pack_start(cell)
    column.add_attribute(cell,'text',0)
    treeview.append_column(column)
    
    treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
    
    def print_selected(treeselection):
        (model,pathlist)=treeselection.get_selected_rows()
        print pathlist
    
    treeview.get_selection().connect('changed',lambda s: print_selected(s))
    
    w.add(treeview)
    
    w.show_all()
    
    gtk.main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 143k
  • Answers 143k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do you have any error in some error log ?… May 12, 2026 at 8:32 am
  • Editorial Team
    Editorial Team added an answer If you want to set the timeout to 20 minutes,… May 12, 2026 at 8:32 am
  • Editorial Team
    Editorial Team added an answer To release the view from your controller, use: self.view =… May 12, 2026 at 8:32 am

Related Questions

I am brand new in the world of Wpf, and am thinking it's time
Thanks for reading this. I imagine this is really a javascript question, and my
See the code below. If I initialize more than one entity context, then I
I need to count the number of elements in an XML file that have
I am trying to create hyperlinks using XML information and XSLT templates. Here is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.