On Sat, 2003-11-22 at 10:19, Thomas Bayen wrote:
> Hi,
>
> In my application I want to create a special button widget. It is a kind
> of a listvalue widget. The widget has a label with the "choosen value".
> It is a button and the user may press it to change the value. If he does
> this, I open a popup that uses a complex and very special database-aware
> RecordSearch-widget to choose a new value.
>
> In the following sourcecode you see the callback function that is used
> to open the popup. There are three questions about this:
>
>
> * How can I make that my popup behaves like a real one? For example if I
> move my main window around with the mouse the popup stays on the old
> screen position :-(
in all likelihood you want a gtkmenu, there's no bundled example code
other than the test for the widget which will show you some basics.
http://cvs.sourceforge.net/viewcvs.py/*checkout*/gtk2-perl/gtk2-perl-xs/Gtk2/t/16.GtkMenu-etc.t?rev=1.7
i would suspect that maybe your RecordSearch object might should inherit
from Gtk2::Menu (or something like that anyway) without knowing more
about it that's about all i can say. others may have better
opinions/ideas. maybe you should at least take a look at the C code for
GtkMenu and see what it does for pop-ups.
> if I use "$self->{win}->set_property('type','popup')" the input focus
> does not go into the popup widget but stays in the main window. If I
> make it modal, it gets the focus, but I can't click into the main window
> any more to close the popup (like a menu popup would). And the "window
> move" problem stays the same in all these cases.
>
> Is there any simple (perl or C) example about creating my own popups?
there's plenty of easily translated C examples/doc for it, a good
starting point would be the tutorials at http://www.gtk.org/. i don't
>
> * With my code the popup window does not open on the right place. I need
> the size of the window manager's window decoration to add it to the
> coordinates. As I understand the documentation this should work with
>
> (...)=$self->get_root_window->get_frame_extends;
> or
> (...)=$self->get_toplevel->get_root_window->get_frame_extends;
>
> but I get the error message
>
> Can't locate object method "get_root_window" via package ...
>
> Is this method not implemented, if it is how can I call it or how can I
> find out the root coordinates of my widget in another way?
if you use gtkmenu then this won't be an issue as it takes care of all
of that.
> * I use the "allocation" function to get the coordinates of the widget.
> I can not find documentation to this function. I found it only with
> indirect mention. If this is a "documentation bug" I want to report it
> here...
you're more than welcome to document it, send us a patch. we're in the
process of doc'ing now. we're mainly focused on function/api listings
and doc'ing where things differ from the c api at this point.
-rm
|