Re: Display simple box indicating position on mouse click?

Bob Caryl wrote:

I suppose adding the label "by hand" is no more "by hand" than removing the icon...

You are right.

However, it just occurred to me that using a plain Gtk::Window may not be more "by hand", either.


Toralf Lund wrote:

Bob Caryl wrote:

Sorry Toralf,

My bad.. use Gtk::Dialog instead of Gtk::MessageDialog.

You mean, and add a Gtk::Label by hand? Yes, perhaps...

I did find a way to remove the icon, though, but it involved Gtk+ (not Gtkmm) functions and direct access to gobject() members...


Toralf Lund wrote:

Bob Caryl wrote:

Hey Toralf,

You can connect a callback to your signal_button_press_event that would displaying the mouse coordinates in a Gtk::MessageDialog that has no buttons added to it and with all its decorations turned off...

Yes. I considered that earlier, but thought I might ask first in case there was an even simpler way...

Anyhow, I've now tried this, and it nearly looks the way I want, but there is one problem: The message dialog will also contain an icon indicating the message type. I don't want that, but I can't seem to find a way to disable it.

that would make it resemble a tool tip; and, since it would have focus, you could close it when it receives the release event. Just a thought.

Possibly a dumb question, but how exactly can I do that? I thought that it would go away if I did


after creating as

Glib::RefPtr<Gtk::MessageDialog> msgBox=new Gtk::MessageDialog(*this, msg, Gtk::MESSAGE_INFO, Gtk::BUTTONS_NONE);

but it doesn't.

Bob Caryl

Toralf Lund wrote:

In one of my applications, I'd like to display the pointer position (within the widget) when a certain mouse button (I haven't decided which) is clicked, in some kind of a popup box. Any suggestions about how to achieve this? I mean, to capture the actual click and get the position, I can probably just connect to signal_button_press_event() - or possibly signal_button_release_event(), but what's the best way of actually displaying the information? Maybe I want something rather like the standard tooltips, but I don't know how to force display of those...

- Toralf

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