Help - Search - Members - Calendar
Full Version: ui service
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
danZ
I'm trying activate and hide the main ui from my component. I'm using

CODE
user_interface::g_find("Default User Interface")->activate();

user_interface::g_find("Default User Interface")->hide();


I'm a little confused about the user_interface service. Can you activate more then one UI at the same time? Can more then one be visible? Can you get a ptr to current UI (assuming you can ony have 1) - that is replace the string constant above with some config variable or something?
Peter
QUOTE(danZ @ Dec 31 2003, 08:29 PM)
I'm trying activate and hide the main ui from my component.  I'm using

CODE
user_interface::g_find("Default User Interface")->activate();

user_interface::g_find("Default User Interface")->hide();


I'm a little confused about the user_interface service.  Can you activate more then one UI at the same time?  Can more then one be visible?  Can you get a ptr to current UI (assuming you can ony have 1) - that is replace the string constant above with some config variable or something?

Don't call UI services, only core does that, you will break things if you do.
Use appropiate menu_manager::run_command() instead to activate main window
danZ
QUOTE(zZzZzZz @ Dec 31 2003, 09:59 AM)
QUOTE(danZ @ Dec 31 2003, 08:29 PM)
I'm trying activate and hide the main ui from my component.  I'm using

CODE
user_interface::g_find("Default User Interface")->activate();

user_interface::g_find("Default User Interface")->hide();


I'm a little confused about the user_interface service.  Can you activate more then one UI at the same time?  Can more then one be visible?  Can you get a ptr to current UI (assuming you can ony have 1) - that is replace the string constant above with some config variable or something?

Don't call UI services, only core does that, you will break things if you do.
Use appropiate menu_manager::run_command() instead to activate main window

OK, I didn't see those (Foobar2000/Hide main window, Foobar2000/Activate main window, Foobar2000/Hide or show main window)

I'd still like to provide a lua hook for determining the current active state of the ui such as

bool fb2k_uiIsActivated()

How would I do that? - can I iterate checking ::is_visible() ? or should I use the windows API such as

::IsWindowVisible(service_factory_base::get_main_window()

Thanks.
Peter
I'm afraid that there's no better way than IsWindowVisible()/IsIconic() on main window handle at the moment.
I'll probably add something for that later (0.8?).
danZ
QUOTE(zZzZzZz @ Dec 31 2003, 10:25 AM)
I'm afraid that there's no better way than IsWindowVisible etc on main window handle at the moment.

As long as it works its more then adequate but I could see why you may wish to move that into your API at some point. Thanks for the help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.