Image Viewer Plugin - Part 2 - firebreath

in a former thread ( Adding a user interface to an image viewer plugin ) I have got some good insight on how to add GUI controls to a firebreath plugin. Taxilian pointed out that when I use a windowed plugin under Windows it should be straighforward. Basically like developing any other Windows App.
Now, to make sure I understand correctly. I'm suppose to create a child window from the window handle supplied by the onWindowAttached event. To create such a child window I need to register such windows class with ::RegisterClassEx(...) to have my own Window Procedure. Is that correct? I mean how else would get access to WM_COMMAND events?
Once that is done I need to ::CreateWindowEx(...) my child window with the hwnd from the plugin.
Is that the right way of thinking?
Thanks ahead,
Christian

Actually creating a child window is optional; WM_COMMAND events for your actual plugin window will be delivered encapsulated in a WindowsEvent that you can catch the same way you get an AttachedEvent. All windows events are sent that way.
Another option is to do what you describe and register a new class with a WINPROC and create a child window. The main reason for doing that would be that you might be able to more easily interact with an abstraction like wxWidgets, etc because it will not know what FireBreath is to get events from it that way. Either method should work fine.

Related

Manipulation events are not fired on page with a listview

Now I'm developing windows phone 8.1 app with WinRT
I'm trying to support swipe-right-to-go-back gesture in my app.
I try to capture the manipulation events on my page. My page's root is a grid and have a ListView inside. I used the UIElement.AddHandler method with "handledEventsToo=true" to add the event handlers. But when I touch the screen, only the ManipulationStarting event is fired, other events seems to be eat by listview.
Could anyone tell me about the manipulation event behavior or other methods to implement this feature? Thanks!!
You won't normally capture events on LisView, beacause it has a ScrollViewer which intercepts them.
There is a way to do it - you will have to disable ScrollViewer and then perfrom some actions when the events are fired and perform scrolling manually. This answer will guide you.
In case someone encounters this page, I spent the better part of a week figuring out why manipulation events were only firing half the time on my UWP charts using the winRT xaml toolkit.
You may need to check that the background is not null on whatever element has the event handler attached. Templated controls are not necessarily hit test visible unless they have one. Otherwise, the input can go right through to the element behind it.
https://msdn.microsoft.com/en-us/windows/uwp/xaml-platform/events-and-routed-events-overview

Send mouse events to inactive and hidden windows/WPF forms

I'm developing an app that needs to generate mouse events on a window Win32/WPF which may be minimized or hidden from view on the desktop.
I have tried the user32.dll APIs SendInput, SendMessage, PostMessage etc. These work only if the window is visible on the desktop. Would you know about any methods that work for hidden/inactive windows?
I've also tried .NET's UI Automation library. In this case, a window is brought to the front or I'm not able to get a clickable point for the control.
Any ideas how I can proceed? If I can proceed?
I don't know if you're still interested in an answer (I just stumbled upon this question out of sheer dumb luck), but have you tried making a global windows hook?
I have no honest idea on how to properly go about implementing one; but I know you should be able to add a global windows hook to, well, Windows, to listen for whatever events you want (should include mouse and keyboard events!)
Good luck...

How to correctly implement hotkeys in a WinRT application?

I tried using Window's ButtonDown event as well as Grid's ButtonDown (all window elements are inside this grid). However, these events never seem to fire.
Where, logically, should the code for handling button down events (as to implement hotkeys) be in a WinRT application?
I thought someone recently blogged about this, but I can't find the post right now. You can check these articles though: MSDN link, link.
Basically you would handle Window.Current.CoreWindow.KeyDown/Up, store the current state of the modifier keys (Ctrl, Alt, Shift) and respond to combinations to handle them. Then you should also specify accessibility and help strings like these on your controls:
ToolTipService.ToolTip="Shortcut key: Ctrl+P"
AutomationProperties.AcceleratorKey="Control P"

Air Native Window Active Window Change

I have a Adobe Air app (AS3, not Flex) that has 2 windows. When I click away from them onto another desktop program, I get an "Deactivate" Event (as you would expect).
When I click on say Window#1 I get an "Activate" Event (as you would expect).
But when I go from Window#1 to Window#2, I get nothing. And I believe this is because the Air application is still the active program, Just a Different Window.
But I have the need to know when I go from 1 window to another.
The horrible solutions I have come up with so far is to have an onEnterFrame and check if the current window is the active window. But I would much prefer to do it a much better way that such a hack.
I have gone though Stage, NativeApplication and Native Window Events and none of them do what I need. Can anyone point me to another Event I may have overlooked?
Listen for window activation events directly on the NativeWindow object. (All display objects dispatch activation/deactivation events, but these are triggered by the application -- or SWF object in the browser -- getting or losing the OS focus.)

using PopUpManager in a Flex 4.5 Mobile App

This is more of a best practices question rater than something technical.
I'm working on a mobile app using the Flex 4.5 SDK and I'm trying to figure out the best way to handle notification windows. In most cases these windows will be alerting the user to when something goes wrong. Ex: bad login, no data, cannot resolve server.
I'm using a singleton design pattern, I have a Requests class that handles server calls. Most popups will be originating from this class (IOErrorEvents from my loader being used to access the API). Since this class is a singleton and is used from all Views inside the app it is not aware of applications current view. I'm also not sure having this class keep track of the current view and having it push popups on top of it would be best practice.
I'm hoping that I can use PopUpManager to keep track of where to add popups and what popups are currently on the stage. Though all examples I've seen online about this show static Components being used in a views Declarations tag.
I'm really just looking for any examples or input on how you would solve this problem. Any help would be greatly appreciated!
I had the same problem, and sorted it by making an Alert popup component that you can call from anywhere in the code base, and it will pop up in the currently active window. It also has an always visible scrollbar text area which is handy
http://bbishop.org/blog/?p=502
It works for a view navigator application, but if your using a tabbed navigator application, you can add a call for that, or simply change the code to
mainTabbedNavigator = FlexGlobals.topLevelApplication.tabbedNavigator;
currentTab = mainTabbedNavigator.selectedNavigator as ViewNavigator;