Re: Connecting to Configure signal event

2013-11-28 Thread Kjell Ahlstedt


2013-11-28 00:14, a skrev:

On 11/27/2013 12:59 PM, Kjell Ahlstedt wrote:


2013-11-26 22:37, a skrev:

On 11/26/2013 08:33 AM, Kjell Ahlstedt wrote:


2013-11-26 05:09, a skrev:

Hi,

I'm trying to connect to the configure signal 
event(signal_configure_event()), in the documentation I read that 
you have to enable Gdk::STRUCTURE_MASK, and I think that is the 
problem I am having. I tried do it several different ways, like this:


this-add_events(Gdk::STRUCTURE_MASK);
Gtk::Window::add_events(Gdk::STRUCTURE_MASK);
MainWindow::add_events(Gdk::STRUCTURE_MASK); //I think they are 
all synonyms, but just in case they weren't


and I tried using set_events() function too. Is this the correct 
way to enable STRUCTURE_MASK?


Thank you.

Tim O.
Have you read 
https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en#signal-handler-sequence 
and added an after = false parameter in your call to 
signal_configure_event().connect()?


Kjell

Thank you for the link, but I recently just read that using the 
configure signal could have performance problems, and I read in an 
old mailing list that signal_expose_event should be used, which is 
now signal_draw. So instead I was thinking of using 
signal_size_allocate. Because all I really want is just the window's 
size. So which one of these would have better for getting the 
window's size and then increases a Gtk::Entry width. Thank you.


Tim O.
Is this a continuation of your question in 
https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00070.html ?
I made a small test with the example program in 
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/entry/simple?h=master
I changed the vertical box to a horizontal box. The Entry widget 
expands with the window if it's added to the box with 
pack_start(m_Entry, Gtk::PACK_EXPAND_WIDGET). If you want the Entry 
to get all extra space, you should add other widgets to the box with 
Gtk::PACK_SHRINK.


If you can't get this to work, can you post a small program here on 
the mailing list? A program that does not behave the way you want, 
when its window is expanded.


Kjell
Here is how I solved it the problem, probably not the best way, but it 
works kind of:


When I  ran your program (deleted from this reply), I realized that I 
had misunderstood your intention. You don't want the Entry to grow when 
the user increases the size of the parent window. You want the Entry to 
grow when the user enters text in it. You want it always to be large 
enough to show all the entered text. I don't know an easy way of 
achieving that. Perhaps you can simplify your program somewhat by using 
Gtk::Editable::signal_changed() instead of signal_key_press_event() and 
signal_delete_text(), and by using Gtk::Entry::set_width_chars().


Kjell

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


Re: Connecting to Configure signal event

2013-11-28 Thread a

On 11/28/2013 01:12 PM, Kjell Ahlstedt wrote:


2013-11-28 00:14, a skrev:

On 11/27/2013 12:59 PM, Kjell Ahlstedt wrote:


2013-11-26 22:37, a skrev:

On 11/26/2013 08:33 AM, Kjell Ahlstedt wrote:


2013-11-26 05:09, a skrev:

Hi,

I'm trying to connect to the configure signal 
event(signal_configure_event()), in the documentation I read that 
you have to enable Gdk::STRUCTURE_MASK, and I think that is the 
problem I am having. I tried do it several different ways, like 
this:


this-add_events(Gdk::STRUCTURE_MASK);
Gtk::Window::add_events(Gdk::STRUCTURE_MASK);
MainWindow::add_events(Gdk::STRUCTURE_MASK); //I think they are 
all synonyms, but just in case they weren't


and I tried using set_events() function too. Is this the correct 
way to enable STRUCTURE_MASK?


Thank you.

Tim O.
Have you read 
https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en#signal-handler-sequence 
and added an after = false parameter in your call to 
signal_configure_event().connect()?


Kjell

Thank you for the link, but I recently just read that using the 
configure signal could have performance problems, and I read in an 
old mailing list that signal_expose_event should be used, which is 
now signal_draw. So instead I was thinking of using 
signal_size_allocate. Because all I really want is just the 
window's size. So which one of these would have better for getting 
the window's size and then increases a Gtk::Entry width. Thank you.


Tim O.
Is this a continuation of your question in 
https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00070.html ?
I made a small test with the example program in 
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/entry/simple?h=master
I changed the vertical box to a horizontal box. The Entry widget 
expands with the window if it's added to the box with 
pack_start(m_Entry, Gtk::PACK_EXPAND_WIDGET). If you want the Entry 
to get all extra space, you should add other widgets to the box with 
Gtk::PACK_SHRINK.


If you can't get this to work, can you post a small program here on 
the mailing list? A program that does not behave the way you want, 
when its window is expanded.


Kjell
Here is how I solved it the problem, probably not the best way, but 
it works kind of:


When I  ran your program (deleted from this reply), I realized that I 
had misunderstood your intention. You don't want the Entry to grow 
when the user increases the size of the parent window. You want the 
Entry to grow when the user enters text in it. You want it always to 
be large enough to show all the entered text. I don't know an easy way 
of achieving that. Perhaps you can simplify your program somewhat by 
using Gtk::Editable::signal_changed() instead of 
signal_key_press_event() and signal_delete_text(), and by using 
Gtk::Entry::set_width_chars().


Kjell

I actually want to do both at the same time. I will try and use 
Gtk::Editable::signal_change() and Gtk::Entry::set_sidth_chars(). Thank 
you for those suggestions. Also, thank you Andrew Potter for the 
Gtk::ALIGN_FILL suggestion, but when I tried that the entry text box was 
not centered.
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Connecting to Configure signal event

2013-11-27 Thread Kjell Ahlstedt


2013-11-26 22:37, a skrev:

On 11/26/2013 08:33 AM, Kjell Ahlstedt wrote:


2013-11-26 05:09, a skrev:

Hi,

I'm trying to connect to the configure signal 
event(signal_configure_event()), in the documentation I read that 
you have to enable Gdk::STRUCTURE_MASK, and I think that is the 
problem I am having. I tried do it several different ways, like this:


this-add_events(Gdk::STRUCTURE_MASK);
Gtk::Window::add_events(Gdk::STRUCTURE_MASK);
MainWindow::add_events(Gdk::STRUCTURE_MASK); //I think they are all 
synonyms, but just in case they weren't


and I tried using set_events() function too. Is this the correct way 
to enable STRUCTURE_MASK?


Thank you.

Tim O.
Have you read 
https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en#signal-handler-sequence 
and added an after = false parameter in your call to 
signal_configure_event().connect()?


Kjell

Thank you for the link, but I recently just read that using the 
configure signal could have performance problems, and I read in an old 
mailing list that signal_expose_event should be used, which is now 
signal_draw. So instead I was thinking of using signal_size_allocate. 
Because all I really want is just the window's size. So which one of 
these would have better for getting the window's size and then 
increases a Gtk::Entry width. Thank you.


Tim O.
Is this a continuation of your question in 
https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00070.html ?
I made a small test with the example program in 
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/entry/simple?h=master
I changed the vertical box to a horizontal box. The Entry widget expands 
with the window if it's added to the box with pack_start(m_Entry, 
Gtk::PACK_EXPAND_WIDGET). If you want the Entry to get all extra space, 
you should add other widgets to the box with Gtk::PACK_SHRINK.


If you can't get this to work, can you post a small program here on the 
mailing list? A program that does not behave the way you want, when its 
window is expanded.


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


Re: Connecting to Configure signal event

2013-11-27 Thread Andrew Potter
On Wed, Nov 27, 2013 at 11:18 AM, a vis.314...@gmail.com wrote:
 On 11/27/2013 12:59 PM, Kjell Ahlstedt wrote:
 2013-11-26 22:37, a skrev:
 On 11/26/2013 08:33 AM, Kjell Ahlstedt wrote:
 2013-11-26 05:09, a skrev:
 Here is the small program where the Gtk::Entry does not increase when window
 increases.

 //Example.cc

 ExampleWindow::ExampleWindow()
 : m_VBox(Gtk::ORIENTATION_VERTICAL),
   m_HBox_entry(Gtk::ORIENTATION_HORIZONTAL),
   m_Label(Label)
 {
   set_size_request(200, 100);
   set_title(Gtk::Entry);

   add(m_VBox);

   m_HBox_entry.set_halign(Gtk::ALIGN_CENTER);

If the HBox alignment is not set to Gtk::ALIGN_FILL (as it is by
default), the box will only be the minimum required sized for its
children.
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: Connecting to Configure signal event

2013-11-26 Thread Kjell Ahlstedt


2013-11-26 05:09, a skrev:

Hi,

I'm trying to connect to the configure signal 
event(signal_configure_event()), in the documentation I read that you 
have to enable Gdk::STRUCTURE_MASK, and I think that is the problem I 
am having. I tried do it several different ways, like this:


this-add_events(Gdk::STRUCTURE_MASK);
Gtk::Window::add_events(Gdk::STRUCTURE_MASK);
MainWindow::add_events(Gdk::STRUCTURE_MASK); //I think they are all 
synonyms, but just in case they weren't


and I tried using set_events() function too. Is this the correct way 
to enable STRUCTURE_MASK?


Thank you.

Tim O.
Have you read 
https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en#signal-handler-sequence 
and added an after = false parameter in your call to 
signal_configure_event().connect()?


Kjell

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


Re: Connecting to Configure signal event

2013-11-26 Thread a

On 11/26/2013 08:33 AM, Kjell Ahlstedt wrote:


2013-11-26 05:09, a skrev:

Hi,

I'm trying to connect to the configure signal 
event(signal_configure_event()), in the documentation I read that you 
have to enable Gdk::STRUCTURE_MASK, and I think that is the problem I 
am having. I tried do it several different ways, like this:


this-add_events(Gdk::STRUCTURE_MASK);
Gtk::Window::add_events(Gdk::STRUCTURE_MASK);
MainWindow::add_events(Gdk::STRUCTURE_MASK); //I think they are all 
synonyms, but just in case they weren't


and I tried using set_events() function too. Is this the correct way 
to enable STRUCTURE_MASK?


Thank you.

Tim O.
Have you read 
https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en#signal-handler-sequence 
and added an after = false parameter in your call to 
signal_configure_event().connect()?


Kjell

Thank you for the link, but I recently just read that using the 
configure signal could have performance problems, and I read in an old 
mailing list that signal_expose_event should be used, which is now 
signal_draw. So instead I was thinking of using signal_size_allocate. 
Because all I really want is just the window's size. So which one of 
these would have better for getting the window's size and then increases 
a Gtk::Entry width. Thank you.


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