Can a Flex Air Window (NativeWindow) be modal? how? - apache-flex

Can a Flax Air Window (NativeWindow) be modal? how?

I think you need to expand on your use case.
If you want it to be modal, do you want to shut down the entire operating system until this window is handled by the user? I doubt that is possible. Do OSes support that in any way? (Other than when crashing).
If you want to prevent your app from being used while this window is up, don't use NativeWindow use a component with the PopUpManager. It has a modal property when creating the popup.

Another possible way would have been to do something like
private function _onActivate(__e:Event):void
{
if ( _settingsWindow )
{
__e.preventDefault();
_settingsWindow.activate()
}
}
and when you open up your settings window, set everything on the "mainapplications" stage to mouseEnabled = false; mouseChildren = false; and listen for the settingswindow close event to reactivate the mouse enabled and set _settingsWindow to null and mainapplications window to activate again (just to make sure)

Related

Main application window and a dialog interaction in Qt

Good day!
Have a problem: main window (MyApp for example) works in background (behind all other windows or in tray), not necessary to show it without need. After some period of time some reminding StayOnTop dialog appears (having parent = 0, to be not tied to main window) and asks for some user interactions. After dialog closes I’d like to keep an application window user currently working with active, and user continue do his job not switching to MyApp. However, instead of above behaviour, main MyApp window appears and user forces to switch back to his window (job) – inconvenient.
How to prevent MyApp main window appearing after closing the dialog? Need to install some event filter or access OS API? Problem exists in Mac, Windows, Linux.
You could try to re-implement the main window's showEvent and ignore that event, in case other windows are visible.
void main_window::showEvent( QShowEvent* e )
{
if( /*one or more of its children are visible */ )
{
// nothing to do
}
else
{
QMainWindow::showEvent( e );
}
}
Maybe just try invoking hide method after dialog call? Other possibility - try setting this:
http://doc.qt.io/qt-4.8/qwidget.html#windowFlags-prop to Qt::Popup.

How do you bring a visible NativeWindow to the front of all applications in a Adobe AIR App

The application I'm working on is a HTML AIR application based on the AIR 2.5 SDK.
The application starts two windows: the first is a hidden window that registers it's self on the system tray (it's windows specific); the second is a visible lightweight window displaying showing various bits of information. Since the visible window is lightweight, there is no task bar entry to always the user bring the window to the front if hidden under other application windows.
The requirement is that on clicking the system tray icon the display window will be brought to the front.
My current solution looks something like:
function handleClick(){
var nativeDisplayWindow = findDisplayWindow();
nativeDisplayWindow.alwaysInFront = true;
nativeDisplayWindow.alwaysInFront = false;
}
function findDisplayWindow(){
// looks in air.NativeApplication.nativeApplication.openedWindows for the
// the display window and returns it
}
It works but really doesn't feel right.
I've tried using NativeWindow.orderToFront() & NativeWindow.activate() and various combinations of all the other method.
Is this the correct way to bring a window to the front of all application windows in AIR?
If you try casting your nativeDisplayWindow as a Window you should then be able to do something like:
function handleClick(){
var nativeDisplayWindow:Window = findDisplayWindow() as Window;
nativeDisplayWindow.orderToFront();
}
I don't know if this is what you are looking for or whether I've just repeated what you've explained?

Flex: cannot resize player back from Full Screen

The key event is not listened by my Flex app. Since it is really simple code, I cannot understand where the problem is...
init() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, escHandler);
}
private function escHandler(event:KeyboardEvent):void {
debugF.text = "ESC pressed";
}
thanks
I'm not sure I fully understand your question, but a lot of the user interaction events (including keyboard) are disabled when Flash is in fullscreen mode. Escape is automatically handled by Flash to exit out of fullscreen. I don't believe it will be passed to your listeners.

ASPnet web Form Navigation

I want to redirect a new tab and to get focus of the new window when a button is clicked.. I can create a new window, but can't get its focus even thourh, I tried the following code
Window.focus(); How to do this?
My Code:
function new_window(url)
{
//Open a Window in New tab
var popupwin = null;
popupwin = window.open(url);
popupwin.focus();
self.focus();
//window.focus();
}
I think it would be better not to do this. These are browser preferences and don't try to override those. It may fail due to user settings.
Remove
self.focus();
You can use focus() method of a form element. This brings mostly the window to front. window.focus() might implemented different by different browsers.
Do you have html input elements on you popup win?
Try calling focus() on one of the html input elements. This will place the cursor into the element to assist the user start typing there.

How to disable a Perl/Tk window close ('X') button on Windows

Is there a way to make a Perl/Tk window's close ('X') button disabled?
I know how to ignore clicking it using the technique described here, but I would much rather have it disabled.
I'm using Perl/Tk on Windows.
Thanks,
splintor
If you are in a Unix environment you are out of luck. The "close" button is managed by the Window Manager of the desktop which is a completely different process that you have no control on.
Even if by a hack you disable the "close" button the user can always bring it back
if the window manager permits this. The enlightenment window manager for example can
enable/disable all window buttons on demand.
The technique you give in the link is doing exactly this. It does not remove
the "close" button. It just gives a hint to the window manager (WM_DELETE_WINDOW).
It is up to the window manager if this hint will be honoured or not.
See also the icccm and NetWM pages.
What you want might be possible on Windows, but my experience with this OS
is limited so perhaps another poster will know this.
I have an app that I wrote, i was wondering about the same thing, and i don't disableit, but i have a call back to a subroutine, that simply does return;
$Mw->protocol('WM_DELETE_WINDOW',sub{return;});
According to the Perl Monks, it looks like the following works on Windows:
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $window = new MainWindow;
$window ->title("Close test");
$window ->geometry("400x250");
#prevents window from closing
$window->protocol('WM_DELETE_WINDOW' => sub {
print "Do stuff before exiting\n";
exit;
});
MainLoop;
In the above code, you are intercepting the signal sent when the user presses 'X' and can then write your own subroutine to execute when the button is pressed.
If you want to disable the close icon, set sub to empty (effectively telling it to "do nothing when pressed"): 'WM_DELETE_WINDOW' => sub {}
If you don't manage to really disable the close button (I mean to grey it out or even remove it from the window decoration), it might be the most intuitive thing to iconify your window instead of closing it. This is what I did.
$window->protocol('WM_DELETE_WINDOW', sub { $window->iconify(); } );

Resources