Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Gtkmm: Notebook problems..

  1. #11
    Join Date
    Mar 2008
    Location
    Ireland
    Beans
    810
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Gtkmm: Notebook problems..

    @r-senior:

    So I created my close button in glade by doing the following:

    Put a grid of 1 row and 2 columns. Put a label in the left and a small button on the right.

    In order to create new tabs I will need to achieve the same in code.

    Although I have no experience of Python I will try to describe what you need to do.

    1. Create a Notebook to hold our tabs.
    2. Create a method to do the following:

    Create a label.
    Create a button - use the stock close icon or do a custom icon if you wish.
    Pack them into a Grid or h:box with the label first, then the button you defined earlier.

    3. Connect signals to your button to close the current selected tab when clicked.

    I found some code which seems to do the trick for Python! Check it out!

    http://www.eurion.net/python-snippet...%20button.html
    Projects: PhotoFiltre LX | Xwii | URT-2D | TTM

  2. #12
    Join Date
    Mar 2008
    Location
    Ireland
    Beans
    810
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Gtkmm: Notebook problems..

    Can anyone see anything wrong with this?

    Code:
            Gtk::Viewport *view
    	refBuilder->get_widget("viewport1", view);
    	
    	Gtk::Notebook *replace;
    	refBuilder->get_widget("notebook", replace);
      
    	view->remove(*replace);
      
    	view->attach(m_Notebook);
    I am attempting to replace the existing notebook in glade with a code built one.

    Here are the error messages:

    main.cc: In member function ‘Gtk::Window* mainWindow::init()’:
    main.cc:103:2: error: expected initializer before ‘refBuilder’
    main.cc:108:23: error: no matching function for call to ‘Gtk::Viewport::remove(Gtk::Notebook&)’
    main.cc:108:23: note: candidate is:
    /usr/include/gtkmm-3.0/gtkmm/bin.h:140:8: note: void Gtk::Bin::remove()
    /usr/include/gtkmm-3.0/gtkmm/bin.h:140:8: note: candidate expects 0 arguments, 1 provided
    main.cc:110:8: error: ‘class Gtk::Viewport’ has no member named ‘attach’
    So from what I understand Viewports don't have a call for attach or remove.. so how can I achieve what I want to do?
    Projects: PhotoFiltre LX | Xwii | URT-2D | TTM

  3. #13
    Join Date
    Apr 2005
    Location
    Hampshire, UK
    Beans
    1,274

    Re: Gtkmm: Notebook problems..

    Quote Originally Posted by fallenshadow View Post
    Can anyone see anything wrong with
    There's no semicolon after

    Code:
            Gtk::Viewport *view
    for a start

  4. #14
    Join Date
    Mar 2008
    Location
    Ireland
    Beans
    810
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Gtkmm: Notebook problems..

    Wow thats yet another clumsy mistake!

    Reduced the errors by 1 because of that!

    main.cc: In member function ‘Gtk::Window* mainWindow::init()’:
    main.cc:108:23: error: no matching function for call to ‘Gtk::Viewport::remove(Gtk::Notebook&)’
    main.cc:108:23: note: candidate is:
    /usr/include/gtkmm-3.0/gtkmm/bin.h:140:8: note: void Gtk::Bin::remove()
    /usr/include/gtkmm-3.0/gtkmm/bin.h:140:8: note: candidate expects 0 arguments, 1 provided
    main.cc:110:8: error: ‘class Gtk::Viewport’ has no member named ‘attach’
    Projects: PhotoFiltre LX | Xwii | URT-2D | TTM

  5. #15
    Join Date
    Dec 2007
    Location
    Gainesville, Florida
    Beans
    Hidden!
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Gtkmm: Notebook problems..

    I assume you want to add a notebook object with code. In your glade file remove the parent of the notebook which is a GtkViewport. (right click on the notebook object then select remove parent) Then you can use hbox1 as your container for the notebook. Add scrollable viewports to the individual notebook pages if you need them. Making the notebook itself scrollable is not necessary.
    Last edited by pbrane; July 9th, 2012 at 10:35 PM.

  6. #16
    Join Date
    Mar 2008
    Location
    Ireland
    Beans
    810
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Gtkmm: Notebook problems..

    Thanks! I surprisingly got it done myself!

    Yeah I don't know why I had the notebook inside a viewport, I think I meant to have a viewport inside a notebook page, not the other way around!
    Projects: PhotoFiltre LX | Xwii | URT-2D | TTM

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •