Re: gtkmm-list Digest, Vol 159, Issue 6



Hi All,

I am getting message like this after stop debugging. "gtkmm-CRITICAL **: gtkmm: object `Product_Combo' not found in GtkBuilder file." Please help.

Thanks
Deepak

Quoting gtkmm-list-request gnome org:

Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

   1. Transparent Window (deepak bhujangachar harvelsystems com)
   2. Re: Transparent Window (Daniel Boles)
   3. Accessing combo box text (deepak bhujangachar harvelsystems com)
   4. Re: Accessing combo box text (Daniel Boles)
   5. Re: Accessing combo box text
      (deepak bhujangachar harvelsystems com)
   6. Re: Accessing combo box text (Daniel Boles)
   7. Re: Returning sigc::signal by value from a const method?
      (Daniel Boles)


----------------------------------------------------------------------

Message: 1
Date: Sat, 22 Jul 2017 09:35:49 +0530
From: deepak bhujangachar harvelsystems com
To: gtkmm-list gnome org
Subject: Transparent Window
Message-ID:
        <20170722093549 Horde Vc2S-ews1agwhBJS-9ZTXmy harvelsystems com>
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes

Hi All,

I am trying to create transparent window in gtkmm3.0 but I am failing.
I created the GUI window using Glade 3.0. Can you please provide me
the hint in creating transparent window and buttons.

Thanks
Deepak




------------------------------

Message: 2
Date: Sat, 22 Jul 2017 08:01:30 +0100
From: Daniel Boles <dboles src gmail com>
To: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Transparent Window
Message-ID:
        <CAKChMKNEXgJwvM=0UZZhqh4A76Gh3wtqOP1TyP=WO8tT2s+xaQ mail gmail com>
Content-Type: text/plain; charset="utf-8"

"I am failing" How? What did you try? What was the error? You are failing
to give any useful info when making posts asking for help... They have all
been very vague so far.

Transparency is just another thing that is best done on the CSS side, using
opacity on the relevant node (check the GTK+ dev docs for the node names)
and possibly only there; I may be wrong but haven't heard of any other way
to do it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20170722/5907868e/attachment.html>

------------------------------

Message: 3
Date: Sat, 22 Jul 2017 14:09:22 +0530
From: deepak bhujangachar harvelsystems com
To: gtkmm-list gnome org
Subject: Accessing combo box text
Message-ID:
        <20170722140922 Horde h6brK6hJgD24lcDgScnwfdW harvelsystems com>
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes


Hi All,

I am using Glade 3.0 and GTKMM. I am trying to access Combo box text
and id. I am failing in it. I pasted a code I did. Please help in
accessing Combo box attributes.

//This is the signal

if(m_Combo1)
{
    m_Combo1->signal_changed().connect( sigc::mem_fun(*this,
&mainWindow::combo_product_changed));
}

//Trying to access ID

void mainWindow::combo_product_changed()
{
   int product = m_Combo1->get_active_row_number();
   std::cout << "Row = " << product << std::endl;
}

Thanks
Deepak




------------------------------

Message: 4
Date: Sat, 22 Jul 2017 10:03:30 +0100
From: Daniel Boles <dboles src gmail com>
To: deepak bhujangachar harvelsystems com
Cc: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Accessing combo box text
Message-ID:
        <CAKChMKOwZci=cX-fhEzYNKM1FF4qznS_wgxKAJNZt0xRyE35Mg mail gmail com>
Content-Type: text/plain; charset="utf-8"

You are failing how? What is the error? Please, try to post questions that
give readers a bare minimum of info to work with.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20170722/1d51e104/attachment.html>

------------------------------

Message: 5
Date: Sat, 22 Jul 2017 14:58:19 +0530
From: deepak bhujangachar harvelsystems com
To: Daniel Boles <dboles src gmail com>
Cc: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Accessing combo box text
Message-ID:
        <20170722145819 Horde vlgSUENbSVwnPIKtD8b_dqb harvelsystems com>
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes

Sir,

Here I am not getting any errors. But I am unable to print the row
number in the Console. I followed the steps as in documentation. I am
posting code again with .cpp and .h files. Do I need to instantiate
entry also. Please help.

derived_window.h

#ifndef DERIVED_LOGIN_SCREEN_H_
#define DERIVED_LOGIN_SCREEN_H_

#include <gtkmm.h>
#include <gtkmm-3.0/gtkmm/liststore.h>
#include <gtkmm-3.0/gtkmm/combobox.h>

class mainWindow : public Gtk::Window
{
public:
   mainWindow(BaseObjectType* cobject, const
Glib::RefPtr<Gtk::Builder>& refGlade);
   virtual ~mainWindow();

protected:
   void combo_product_changed();
   void combo_variant_changed();

   Glib::RefPtr<Gtk::Builder> m_refGlade;
   Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
   Gtk::ComboBox* m_Combo1;
   Gtk::ComboBox* m_Combo2;
};

#endif /* DERIVED_LOGIN_SCREEN_H_ */

#include "derived_login_screen.h"
#include <gtkmm.h>
#include <iostream>
#include <gtkmm-3.0/gtkmm/box.h>
#include <gtkmm-3.0/gtkmm/window.h>

derived_window.cpp

mainWindow::mainWindow(BaseObjectType* cobject, const
Glib::RefPtr<Gtk::Builder>& refGlade)
: Gtk::Window(cobject),
   m_refGlade(refGlade),
   m_Combo1(nullptr), m_Combo2(nullptr)
{
   //Get the Glade-instantiated Button, and connect a signal handler:
   m_refGlade->get_widget("Product_Combo", m_Combo1);  // widget names
   m_refGlade->get_widget("Variant_Combo", m_Combo2);

  if(m_Combo1)
  {
    m_Combo1->signal_changed().connect( sigc::mem_fun(*this,
&mainWindow::combo_product_changed));
  }

  if(m_Combo2)
  {
    m_Combo2->signal_changed().connect( sigc::mem_fun(*this,
&mainWindow::combo_variant_changed));
  }

     show_all_children();

}

mainWindow::~mainWindow()
{
   //Dtor
}

void mainWindow::combo_product_changed()
{
       int product = m_Combo1->get_active_row_number();
       std::cout << "Combo changed: " << product << std::endl;
}

Thanks
Deepak

Quoting Daniel Boles <dboles src gmail com>:

You are failing how? What is the error? Please, try to post questions that
give readers a bare minimum of info to work with.





------------------------------

Message: 6
Date: Sat, 22 Jul 2017 10:36:47 +0100
From: Daniel Boles <dboles src gmail com>
Cc: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Accessing combo box text
Message-ID:
        <CAKChMKPXX39_LqGFjjf7ncYhXDYZDdcNxVyJvkOAHkpwC6WgGA mail gmail com>
Content-Type: text/plain; charset="utf-8"

You only connect the signal handler that does the print, if the Builder
returned a non-null pointer. Have you checked whether the Builder actually
returns a non-null pointer, i.e. successfully looks up the widget with name
Product_Combo to m_combo!?

I would recommend, as always, assert()ing that all points are non-nullptr
before dereferencing them, and if possible compiling with UBsan so that it
can often catch that if you don't.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20170722/b75c4258/attachment.html>

------------------------------

Message: 7
Date: Sat, 22 Jul 2017 10:58:20 +0100
From: Daniel Boles <dboles src gmail com>
To: gtkmm-list <gtkmm-list gnome org>
Subject: Re: Returning sigc::signal by value from a const method?
Message-ID:
        <CAKChMKO26mXz_wWp3351dGO=RH5GNn-HhNVVs3X2ciNp_BaM-Q mail gmail com>
Content-Type: text/plain; charset="utf-8"

As an aside, since realising that providing any form of full access to a
signal gives external users the ability to emit() it, clear() it, etc. - I
am considering moving to a model whereby I only expose signals via a method
like this:

sigc::connection signal_whatever_connect(signal_whatever_type slot);

This involves quite a bit of boilerplate, albeit not all that much worse
than what we have to write to implement a (pointless) by-reference or
-value getter anyway.


However, it got me wondering. Has anyone ever come up with a better way to
only allow users to connect() to signals and nothing more, or at least a
way to reduce the required boilerplate of my proposed mechanism somehow?

I did find an old thread where IIRC Murray talked about how he would like
to see access control on signals, FWIW! That may have changed in the
meantime, whether through opinion or just practicality.

I guess it could be done, but with smoe huge API changes; e.g. I imagine we
could return a base class that does not have the modifying methods from our
own objects, while using a derived class that does provide them internally.


At the end of the day, the real question is whether the work of providing
access control would be justifiably better than just requiring users to
encapsulate signals for themselves; I suspect the answer might be no. Still
interested in any thoughts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20170722/efd4f632/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


------------------------------

End of gtkmm-list Digest, Vol 159, Issue 6
******************************************





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]