Re: Custom Widgets




Hi,

On 09/10/2016 02:00 PM, aitor_czr <aitor_czr gnuinos org> wrote:
Hi again,

On 09/09/2016 06:56 PM, aitor_czr wrote:
> Hi all,
>
> This is my first post in the list...
>
> I'm a devuan nonofficial developer (and gnuinos), and i'm building 
> some applications in gtkmm. One of them is a graphical interface for 
> simple-netaid, developed by Edward Bartolo. Here you are a demo:
>
> www.gnuinos.org/simple-netaid-gtk3/snetaid
>
> As you can see, there is a first application scanning the available 
> active wifis. This is a multithread proccess against blocking the spinner.
>
> Well..., i'm trying to apply some custom widgets to the project. I had 
> a look at the following example in the Gnome Developer's website:
>
> https://developer.gnome.org/gtkmm-tutorial/stable/sec-custom-widgets.html.en
>
> and tried to simplify the example to the case of a custom widget 
> containing only a button. Here you are the code:
>
> wget https://gnuinos.org/custom-widget.tar.bz2
>
> The question is that if i set to *true* the method:
>
> set_has_window(false);
>
> in the CustomWidget class, then the button is not shown. On the other 
> hand, if i set it to *false*, i get the following bug:
>
>
>
> (customwidget:18925): Gtk-CRITICAL **: gtk_box_pack: assertion 
> 'gtk_widget_get_parent (child) == NULL' failed
> **
> Gtk:ERROR:/build/gtk+3.0-b165l9/gtk+3.0-3.14.5/./gtk/gtkwidget.c:12230:gtk_widget_real_realize: 
> assertion failed: (!gtk_widget_get_has_window (widget))
> Aborted
>
>
>
> Any hints?
>
> Thanks in advance,
>
>   Aitor.
I need to add the following functions:

virtual Gtk::SizeRequestMode get_request_mode_vfunc() const;
virtual void get_preferred_width_vfunc(int& minimum_width, int& 
natural_width) const;
virtual void get_preferred_height_for_width_vfunc(int width, int& 
minimum_height, int& natural_height) const;
virtual void get_preferred_height_vfunc(int& minimum_height, int& 
natural_height) const;
virtual void get_preferred_width_for_height_vfunc(int height, int& 
minimum_width, int& natural_width) const;
virtual void on_size_allocate(Gtk::Allocation& allocation);
virtual void on_map();
virtual void on_unmap();
virtual void on_realize();
virtual void on_unrealize();

Trying again :)

Cheers,

   Aitor.

Solved it...

I'll share the code in gitlab, when it's up and running

Thanks,

  Aitor.





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