Re: How to check whether the window is visible(at top/front) to user?



Hi,

Can anyone help me on this? Thanks.

On Fri, Jul 30, 2010 at 1:21 AM, Tao Wang <dancefire gmail com> wrote:
Hi,

I have an icon shown on tray by Gtk::StatusIcon, and I expect that if I click the icon, the main window will show, and click it again, the window will hide. So far so good. But I also expect that if the window is not visible by user, such as some other windows at the top of the window, then, when I click the tray icon, the main window will not hide (because ->get_visible() is true), instead, the window move to the front/top, so user can see it.

I use following code to do that:

    if (main_window->get_visible())
    {
        if (main_window->is_focus())
        {
            main_window->hide();
        }else{
            main_window->raise();
        }
    }else{
        main_window->show();
    }

However, it doesn't work. is_focus() is always false when I clicked the tray icon, so the window cannot hide. Can anyone tell me where am I wrong? Thanks.

--
Regards

Tao Wang



--
Regards

Tao Wang


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