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 8015217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:11:30+00:00 2026-06-04T20:11:30+00:00

this is how I currently initialize the Tree view from the glade file (Removed

  • 0

this is how I currently initialize the Tree view from the glade file (Removed the uninteresting parts)

tree_view <- xmlGetWidget xml castToTreeView "tree_view"

To make it easy, how could I add a new entry to the tree_view using the text from an already filled text field?

text <- get text_field entryText

May someone help me?

Thanks

  • 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-06-04T20:11:33+00:00Added an answer on June 4, 2026 at 8:11 pm

    From your description, I assume that you have a tree view, but haven’t set it up properly.
    A GTK tree view is worth nothing if you don’t connect it to several other widgets.

    • A tree model, which holds the data to be displayed in the tree view. The tree model can either be a list store, which stores data as a list, or a tree store, which stores the data as a tree, with nodes containing children. In your case, you’d probably need to create a ListStore:

      store <- listStoreNew String
      

      Tree models can store data of any type, including complex custom data types.

    • A tree view column for each piece of data to be shown. In this case, we just need one column because we want to display one string per row:

      column <- treeViewColumnNew
      
    • The tree view column must know what data to show and how to display it (as text, as a tick box, as a picture…) So we need a cell renderer. The cell renderer will get a piece of data from each row in the tree model and show it in the given column. For displaying text, a CellRendererText is needed. There are other types of cell renderers for showing data in other forms (for instance CellRendererToggle for True/False values).

      -- Create a cell renderer for displaying text
      cell <- cellRendererTextNew
      -- Add the cell renderer to the column. A column may display one or more
      -- pieces of data; just pack the cell renderers into the column
      cellLayoutPackStart column cell True
      -- Let the cell renderer know where it has to get the data from
      -- (in this case, the only element of each row). Note that we
      -- want to display some text
      cellLayoutSetAttributes column cell store $ \row -> [ cellText := row ]
      

    Next, insert the column into the tree view. If you don’t do this, the column won’t be shown!

        -- Insert the column into the tree view
        _ <- treeViewAppendColumn tree_view column
        -- Optional: Give a header/title to the column
        treeViewColumnSetTitle column "My data"
    

    And last but not least: connect the tree view to the tree model:

        treeViewSetModel tree_view store
    

    Now you should see an empty column in your tree view.
    See the documentation of the gtk package at http://hackage.haskell.org/package/gtk to learn how to insert, remove and get data to/from a tree model (listStoreAppend, listStoreRemove, listStoreGetValue etc.)

    Note that every tree model has a type and can only work with data of that type (but you can use any data type, even your own, so you can indeed store and show rows of complex data provided you set up every tree view column correctly). Otherwise you will get a type error when compiling the program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To create and initialize an array with another array I currently do this: void
This is currently my htacess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond
I have data from a CD or Record currently setup like this: class Release
I currently initialize my web site navigation during bootstrap. I initialize anywhere from 1
I have created a Base-Controller from which all the controllers inherit. Currently this controller
I have something like this currently: <div class = className style = position: absolute;
this is currently my code byte[] bytes = { 0x42, 0x1c, 00, 00 };
This program currently inputs an image of a coin, thresholds it, binarizes it, and
There is currently this Prototype code that does a PUT: new Ajax.Request(someUrl, { method:
I don't think this is currently possible or if it's even a good idea,

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.