logo       

Re: How to create a popup?: msg#00173

Subject: Re: How to create a popup?
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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe