Thread: I need help with GTK3 treeviews, and paneviews

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    28

    I need help with GTK3 treeviews, and paneviews

    I know this forum doesn't specialize in GTK, or any specific gui tool kit for that matter, however, this is the best forum I can find when it comes to actually getting answers, I already posted this question on the GTK forums, however there are much fewer people on those forums, so I'm going to ask here as well. Here's the link to my question: View topic - I need help with treeviews, and paneviews

    I am working on an application in C with GTK3, in my app I have a layout like Rhythmbox, with a treeview on the left, on the right top 2 treeviews then right bottom 1 treeview, and they are all in paned views, so one big horrizontal paned view, with treeview on left, the right pane has a vertical paned view, in the top pane is another horizontal paned view with a treeview in each, then the bottom pane has a treeview. ALL of the treeviews are inside a scrolledwindow, so that the treeviews will scroll. Now the issue I'm having is I can't get anything to style correctly, the sizes are all jacked up, can anyone make a simple example of multiple treeviews in scrolled windows in paneviews like what I have? If need be I can post some of my code, I don't want to post too much because my app is too big right now to post the whole thing. I should note that when it comes to size I have everything default right now, I didn't set any sizes for anything except the main window, and I'm just not sure if I should be using size requests or what, when I've used glade in the past with python I never had this issue, but I'm trying to write my own GTK code this time. I've searched for tutorials for what I'm talking about, and I can't find anything, especially for C.

    I really appreciate any help anyone can give me.

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    For this sort of thing I'd say step 1 for any toolkit is to make a mockup. Sketch it on paper and then use a tool to make a simple electronic version. I've used the Meesoft Diagram Designer for this in the past and it works fine. Other tools are for Linux like Dia. You might have better luck implementing it and/or asking for help if you do this. For example, you can then easily compare your mockup to what is actually appearing in your app and evaluate how good it is.

    Did you look at the demo directory in the GTK distribution? As a non-GTK user I was curious and installed it and found the demo programs easy to understand. The ones that demonstrate the widgets you mentioned are: panes.c and tree_store.c. As step 2 you could use these as a guide and make a small demo program which looks the way you want. Work on integrating into the rest of your app as step 3.

  3. #3
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    in my app I have a layout like Rhythmbox
    can anyone make a simple example of multiple treeviews in scrolled windows in paneviews like what I have
    Well, if Rhythmbox uses GTK for that, then it would be a good idea to grep through its source code. The best way to learn libraries that don't provide many examples is to read through code that uses them.

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    28
    I was thinking of looking through Rhythmbox's source, see if I can figure out how they implement it, and I like c99tutorial's idea too. And yeah, I've looked through all the available demos for treeviews, I know how to use them, but all the demos are for simple use, once you add scrolling and put it in a paneview it gets all jacked up, and I just need to figure out how to make it get the correct size. Thanks for the help guys, this really is the best forum for programming help

  5. #5
    Registered User
    Join Date
    Sep 2012
    Posts
    28
    Well, looking through Rhythmbox's source didn't exactly help, the way they've written it is either scattered, or just way above my level, it's to hard to find how they put together the treeviews, so I'm thinking I'm going to try c99tutorial's solution, if I figure this out I'm going to post a little tutorial to make it easier for others.

  6. #6
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    I've never looked at the Rhythmbox source code so I wouldn't know for sure. Fortunately, there are many programs that use GTK+ that you could take a look at (GTK+ - Wikipedia, the free encyclopedia). The only one I've really looked at is Transmission, whose code struck me as rather clean and simple to learn from. A quick search seems to indicate that they use treeviews for a few things as well, so you might like to take a look at that. Another music player that uses GTK+ (although it's loaded as a plugin, rather than being used in the core of the program) is deadbeef, which also seems to use treeviews. So I guess there's a wide variety of programs you could look at.

  7. #7
    Registered User
    Join Date
    Sep 2012
    Posts
    28
    Well, I discovered my issue was actually in the grid layout that I used to place everything in the window, which I don't think I mentioned before, I changed the GtkGrid to a GtkBox with a vertical layout, and set the menu bar's fill and expand properties to FALSE, and it fixed my problem, now I just need to figure out why I can never have any luck with grid layouts, the grid layouts never seem to let the children expand or fill, which they are supposed to do by default.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. image lists, icons and treeviews
    By bennyandthejets in forum Windows Programming
    Replies: 8
    Last Post: 01-10-2003, 08:15 AM
  2. Icon colour formats and TreeViews
    By SMurf in forum Windows Programming
    Replies: 1
    Last Post: 06-03-2002, 04:51 AM

Tags for this Thread