Re: when we can delete a class derived from Gtk::Window or others

2022-02-20 Thread aitor

Hi Klaus,

On 19/2/22 13:00, Klaus  wrote:


I tested you example and it works whenever the user closes the windows in the 
reverse
order from creation.

That it seems to work is known. The question is, is it the allowed way
to do this? If the Gtk::Window class performs more actions after hide()
and access data for the current class, the code has undefined behavior,
even if it works in the moment. I simply could not find any
documentation which gives me an idea what the window class perform on
close action.

BTW: Overriding the unrealize() function compiles ( override gives no
error message from the compiler ) but the function will never be called.
Nice bug! The signal handler manually connected via connect() works. Wow:-)


But, what happens if the user closes the parent window first?

All the given example is only a stupid example to give an idea what I
need to do. That in case of unordered closes something may hang is not
the problem. The question to answer is only for the current window and
delete. All interactions in the example code are not in focus here.


I was going to suggest you something like this:

https://www.gnuinos.org/gtkmm/simple.cc  
<https://www.gnuinos.org/gtkmm/simple.cc>

Hope this helps :)

Aitor.


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


Re: when we can delete a class derived from Gtk::Window or others

2022-02-17 Thread aitor

Hi Klaus,

On 17/2/22 13:00, Klaus Rudolph  wrote:


I want to create some windows on demand with "new". If the user closes
the window, when I can call delete on that class derived from
Gtk::Dialog or Gtk::Window?



void on_hide() override
  {
  std::cout << "Hide event" << std::endl;
  delete this;// is it safe to delete our self here?
  }


I tested you example and it works whenever the user closes the windows in the 
reverse
order from creation. But, what happens if the user closes the parent window 
first?
In that case, the destructor of the child window won't be called and this isn't 
safe
because you are using raw pointers instead of smart pointers.

On the other hand, bear in mind that new windows can be created from both the 
parent
and the child all over again. Therefore, I guess that you should use a weak 
pointer
together with a shared one to keep track of the nodes in the tree.

My2Cents,

Aitor.



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


Re: Support service

2022-02-16 Thread aitor

Hi,

On 16/2/22 13:00, Kjell Ahlstedt  wrote:


I suspect that it's not trivial. You can try to ask the
GTK developers onhttps://discourse.gnome.org/c/platform/core. Gtkmm is
just a C++ wrapper around most of GTK.


I should ask you to improve the support.

This is free and open software. You don't pay. No one is responsible for
any support. Users of gtkmm can help each other. One user can answer
another user's questions.


I've built my way most of the examples of the gtkmm programming tutorial,
and all of them worked for me. But the drug and drop example isn't in the
list so far. On the other hand, I admit that I didn't give a try to gtk4
because the existing .deb packages are still in the unstable repository
of debian (sid). Hence, I'll need to upgrade my system or build my own images
of the unstable/testing branch. Once I have done this, I'll try to get the
DnD example working. I hope that it'll be within a few days.

Cheers,

Aitor.

 

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


Re: Ten years with gtkmm, glibmm and other mm modules

2021-02-10 Thread aitor
Sorry, I forgot to rectify the title in the *Subject*, a common issue 
related to my mail client.


On 11/2/21 0:03, aitor wrote:


Hi Kjell,

On 10/2/21 13:00,

Kjell Ahlstedt  wrote:
In the future I intend to spend less time on mm modules than I've 
done the last few years. An opportunity for other C++ programmers to 
enter.


Thanks a lot for your great efforts and tenacity. Honestly, I've found 
in the mm modules what i was looking for, over other gui toolkits. So 
close to C++...


Congrats to all the development team and keep up the good work!

Aitor.

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


Re: gtkmm-list Digest, Vol 201, Issue 3

2021-02-10 Thread aitor

Hi Kjell,

On 10/2/21 13:00,

Kjell Ahlstedt  wrote:
In the future I intend to spend less time on mm modules than I've done 
the last few years. An opportunity for other C++ programmers to enter.


Thanks a lot for your great efforts and tenacity. Honestly, I've found 
in the mm modules what i was looking for, over other gui toolkits. So 
close to C++...


Congrats to all the development team and keep up the good work!

Aitor.


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


Re: Help on Gtk::Layout and Gtk::ScrolledWindow

2020-08-23 Thread aitor

Dear Joseph,

On 23/8/20 14:00, josephenry  wrote:

This is a small example to make it work (compile it with g++ gtk_layout.cpp -o 
gtk_layout `pkg-config gtkmm-3.0 --cflags --libs`):


Some servers like, for example, "Debian Paste" gives you the possibility 
of sharing your code in a more readable way:


https://paste.debian.net/1160914/

Cheers :)

Aitor.


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


Re: Please help (core dump)

2020-07-28 Thread aitor

Hi,

On 27/7/20 14:00, Carlo Wood  wrote:

Hi aitor,

thank you so much for your examples!
I will definitely study them in depth as soon as I get
my current problem resolved of how to add a 'Mode' to
my menu having a separate Gtk::Builder (aka, how to
combine multiple Gtk::Builder objects into a single
menu). Or, alternatively, I could have just a single
Gtk::Builder object, but then I still need to be
able to somehow add a Gio::SimpleActionGroup to my
menu.

It seems that your approach is entirely different:
you have a MenuBar class that deals with everything
related to the menu. From an object oriented point
of view that makes a lot of sense. You're not using
Gtk::Builder at all, but - instead of using an xml
string - hardcode the menu into the constructor of
myMenuBar.



Yes, Gtk::Builder is cool, but the other point of view simplifies 
dynamic changes because
you can define an iterator which can be used for the addition/removal of 
the items in the

menu.



For some reason you're passing `*this` to every
sigc::mem_fun - aka*all*  `on_menu_*` menu callbacks
are member functions of myMenuBar. I'd prefer it
if I could use callbacks that are member functions
of several different objects (namely those that
they operate on). I suppose I can do that by passing
a pointer to all those objects to the constructor
of myMenuBar. Currently you pass only a WindowMain*,
for the on_menu_mode_quit method.

Why are you using the construct of passing this WindowMain*
as an argument to myMenuBar::on_menu_mode_quit?
Wouldn't it be possible, and make more sense, to do:

 m_QuitItem->signal_activate().connect (
 sigc::mem_fun(*caller, ::on_menu_mode_quit)
 );

?



The sort answer: Yes, you are write! It makes more sense in the other 
way around, so i left the

callbackas follows:

m_QuitItem->signal_activate().connect (
            sigc::mem_fun(*caller, ::hide)
);

Indeed, i was doing something similar in the callback of the status icon 
of my new
network manager. I still didn't finish it, but shortly i'll share the 
code here in the mailing list.

Anyway, I can give you a link to the backend so far:

https://git.devuan.org/aitor_czr/libnetaid

Thanks for your constructive correctness :)

Aitor.





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


Re: Please help

2020-07-26 Thread aitor

Hi again,

On 26/7/20 14:00, aitor_czr  wrote:

In the next examples i'll explain how to add an icon factory for your
custom stock icons and how to add the toolbar to

the project. They'll be uploaded to the following link:

https://www.gnuinos.org/Gtkmm%20Examples/

Hope this helps,


Finally, I added the toolbar with the custom icons:

https://www.gnuinos.org/Gtkmm%20Examples/Example_4/

Quote.- The SeparatorToolItem at the left of the last item is missing in 
Gtkmm3:


https://www.gnuinos.org/Gtkmm%20Examples/Example_4/screenshot.png

This separator only appears in Gtkmm-2.4 ...

Cheers,

Aitor.


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


Re: Please help (core dump)

2020-07-26 Thread aitor

Hi Carlo,

On 25/7/20 15:35, Carlo Wood wrote:

Hi Aitor,

is this gtkmm3? For example, Gtk::VBox is deprecated,
I'm using Gtk::Grid.



Yes, it is. Have a look at the "pkg_check_modules" in the configuration 
of CMake. I'm using the deprecated VBox because this
code is taken froma network manager project, which i'd like to be 
compatible with goth gtkmm-2.24 and gtkmm-3.24.




Currently my application just core dumps:(.
The backtrace is:

Thread 1 "tstcpp" received signal SIGSEGV, Segmentation fault.
0x76bc29c6 in g_action_map_add_action () from /usr/lib/libgio-2.0.so.0
(gdb) bt
#0  0x76bc29c6 in g_action_map_add_action () at /usr/lib/libgio-2.0.so.0
#1  0x778cc541 in Gio::ActionMap::add_action(Glib::ustring const&) () 
at /usr/lib/libgiomm-2.4.so.1
#2  0x778cc65e in Gio::ActionMap::add_action(Glib::ustring const&, 
sigc::slot const&) ()
 at /usr/lib/libgiomm-2.4.so.1
#3  0x55573871 in LinuxChessboardWidget::LinuxChessboardWidget(Gtk::Window*, 
Glib::RefPtr) (this=
 0x563bd928, drawable=0x563bd8a0, promotion=..., __in_chrg=, __vtt_parm=)
 at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
#4  0x5557b68b in LinuxChessWindow::LinuxChessWindow() (this=0x563bd8a0, 
__in_chrg=, __vtt_parm=)
 at /home/carlo/projects/cwchessboard/cwchessboard/LinuxChessWindow.cxx:4
#5  0x5556e473 in LinuxChessApplication::create_window() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:160
#6  0x5556e3ed in LinuxChessApplication::on_activate() 
(this=0x555f6230) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessApplication.cxx:155
#7  0x778bbc2c in 
Gio::Application_Class::activate_callback(_GApplication*) () at 
/usr/lib/libgiomm-2.4.so.1
#8  0x7694480a in g_signal_emit_valist () at 
/usr/lib/libgobject-2.0.so.0
#9  0x76944980 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#10 0x76bbea89 in  () at /usr/lib/libgio-2.0.so.0
#11 0x778bba8a in Gio::Application::local_command_line_vfunc(char**&, 
int&) () at /usr/lib/libgiomm-2.4.so.1
#12 0x778bbe51 in 
Gio::Application_Class::local_command_line_vfunc_callback(_GApplication*, 
char***, int*) () at /usr/lib/libgiomm-2.4.so.1
#13 0x76bbec0a in g_application_run () at /usr/lib/libgio-2.0.so.0
#14 0x5557a928 in main(int, char**) (argc=1, argv=0x7fffd448) at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChess.cxx:14

Frame #3 (the first that is my code) is:

#3  0x55573871 in LinuxChessboardWidget::LinuxChessboardWidget(this=0x563bd928, 
drawable=0x563bd8a0, promotion=...,__in_chrg=, 
__vtt_parm=)
 at 
/home/carlo/projects/cwchessboard/cwchessboard/LinuxChessboardWidget.cxx:164
164   add_action("ModeShowCandidates", sigc::mem_fun(*this, 
::on_menu_mode_showcandidates));


Why would this core dump??

LinuxChessboardWidget is defined as:

class LinuxChessboardWidget : public cwmm::ChessPositionWidget, public 
Gio::ActionMap
{
   ...

I have to derive from Gio::ActionMap because its constructor is protected.
The call to `add_action` above is to that class.

Can someone tell me what I'm doing wrong?



Mmm..., i don't know, but this issue might be related with some missing 
arguments in your defined signal/slot.


BTW, i uploaded my third examples including an icon factory for the 
customized icons of the second part of the menu bar:


https://www.gnuinos.org/Gtkmm Examples/Example_3/screenshot.png 
<https://www.gnuinos.org/Gtkmm Examples/Example_3/screenshot.png>


Cheers,

Aitor.


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


Re: GTKMM DATA GRID VIEW

2017-08-23 Thread aitor

Hi Deepak,

On 08/23/2017 02:00 PM, deepak.bhujangac...@harvelsystems.com wrote:

Hi,

I am Deepak, I need help in loading Excel(.xls) file data into GTKMM
TreeView and the data to be readable after loading and displaying it.
Please help me regarding this.

Thanks
Deepak
Maybe on the basis of a *.csv file exported directly from the Calc 
sheet, or using some existent C++ tools for LibreOffice (which are 
beyond my knowledge). But it would be very interesting.


Cheers,

  Aitor.


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