Building an application in which a phone interacts with a PC application. The application (which has a GUI on the PC side) appears as JavaFX Tabbed Pane. I am going to "listen" for a event "A" which comes from the phone. When this event "A" occurs, I would like to change tabs on the tabbed pane (PC side). Is there a way I can implement a listener to overload the existing clickable tabs, so that event "A" can also change between tabs?
I hope this is not overly confusing. I simply want the application to to change panes by a separate event. I don't even know where to start since all the details of the tabbed pane are hidden in the API. Thanks in advance.
Karl
If I understood your question, try
public void myEventAHandler() {
tabPane.getSelectionModel().select(desired_tab_index);
}
Related
I am working on a windows phone 8 c# application. I have to get long tap events of Forward and Backward buttons that I have placed in the Application bar, but found only Click event for application bar button.
Please let me know how to capture the long tap event for an application bar button?
Thanks in Advance
This is not possible. The ApplicationBar API is quite restrictive, which is a deliberate move by Microsoft to ensure consistency. You cannot handle arbitrary events from the ApplicationBar. If you want this kind of behaviour, you will have to build your own UI to support it.
It is worth noting that your users will not expect 'long press' (more commonly referred to as tap-and-hold) behaviour on the app-bar.
I have an air application. Clicking the application menu item opens a native window. Just like in other applications, I want that while the native window is open, access to other preferences in the application (like close application etc) should be disabled.
How can I do this?
I don't know of any easy way of doing this. The best I can think of is to listen for the DEACTIVATE event, prevent it, and then manually reactivate the window. Some code:
var args:NativeWindowInitOptions = new NativeWindowInitOptions();
var subWindow:NativeWindow = new NativeWindow(args);
subWindow.activate();
subWindow.addEventListener(Event.DEACTIVATE, onDeactivate);
private function onDeactivate(event:Event):void
{
event.preventDefault();
NativeWindow(event.target).activate();
}
This will ensure that this subWindow always retains focus until it is closed.
There are two differences that I can see between this method and typical application behavior for this type of subwindow.
1) The parent window can be dragged around (for some reason this does not dispatch a DEACTIVATE event)
2) Usually the subwindow should kind of "flicker" and plays an alert sound to indicate that it must be dealt with before further actions can be made (this is the the behavior for other applications on Windows 7 at least; I am not sure about other OS's).
For the dragging problem you should be able to have the parent window listen for the MOVING event and preventDefault() whenever the subwindow is active.
I don't see any good way of replication the behavior of 2. You can have the subwindow notifyUser(NotificationType.INFORMATIONAL) in the DEACTIVATE event but it's not the same thing that other applications do.
I have a desktop-like application which has 2 controllers: 'Desktop' which represents desktop icons and 'Taskbar' which represents the taskbar where you find buttons to minimize/restore windows already opened, like MS Windows is working.
The problem I currently have is the approach to "how should I display the window". Infact after doubleclicking the icon, I should create a window, and this could happen both on Desktop controller or on Taskbar controller (or maybe directly on the viewport, because they can be dragged anywhere). However, when I create a window, a new button should be created on the taskbar to minimize/restore it.
Because of this, I thought about handling window in the taskbar controller, however I don't know how to reach the Taskbar controller from the Desktop controller.
I have 3 ideas in my mind at the moment:
The Desktop controller directly adds the button to the TaskbarView, but in this way I'm feeling like violating MVC pattern. Also I need to specify TaskbarView in Desktop views.
The Desktop controller after icon doubleclick fires a custom event on the Taskbar controller. In this case the taskbar opens the windows and adds the button, this approach is quite linear but I don't know how to reference a controller from another controller (in this case, from Desktop to Taskbar)
The Ext.Application register for itemdblclick event on Desktop controller. When this event is fired, it redirects (or call a custom event) on Taskbar controller. After this everything keeps going like point 2. In this way I centralize the Routing functionality (like rails), however could also happen that Application object becomes really big. Also I'm using it as a "gigant controller" to route everything, but this is not really a big problem, thinking about rails it does something similar.
The application should not be split in 2 controllers (so Desktop and Taskbar should be one) and everything will be fine. I don't think this approach is correct.
So, my questions are:
Which approach should I use: 1,2,3,4 (or specify if there is something different)?
What a window should belongs to: Desktop controller, Taskbar controller, something else?
Thanks for any answer
I have a similar setup to you. Personally I would go with choice 2. There is a couple ways to deal with this. One is to have a parent that contains both the Desktop and task bar as its children and it can manage the communication between the two. You can create custom events which the parent listens for and directs them to the correct children.
So for example the parent creates both the task bar and desktop and it listen for icon click events on the desktop. When a click event on the icon occurs the parent receives the events and then internally determines what need to be done. In this case it knows that it needs to call the task bar and create the button for the opened window on it.
You could also look at using a a Mediator design pattern in JavaScript to register senders and listeners. So you could sent it up that the desktop is a sender of icon click events and the task bar is a listener of these events. The click on the icon will send an event to all the listeners of it set in the mediator. This way you don't need a parent to manage it. But personal I like the parent better.
I have a desktop application written in Ruby that is using GTK2. It's just a small test application to play with GTK2, but I'm having problems achieving what I want to do. Is there any way using GTK2 to get at the titlebar (apart from setting the title), specifically to either add a button to it (beside the min/max/etc, B in the below diagram) or to add an option to the menu that pops up when you click the icon on the titlebar (A in the below diagram)?
I'm thinking there might not be because GTK is meant to work with many many different window managers, but I just wondered if there was. As a side question, what event does clicking the 'cross' button fire? At the moment if the user clicks that the window disappears but the program doesn't end - I need to capture that event and quit the program.
Thanks for any help, including hitting me over the head and telling me how silly I am.
Note that this is possible in GTK 3.10 and up, by using gtk_window_set_titlebar(). It replaces the window manager's title bar with a custom one. GtkHeaderBar is a good custom title bar class to use.
You can't, however, make it look just like the window manager would, because you won't know which window manager the user is running.
No, the title bar is owned by the window manager and you will typically not have direct access to it.
When the user tries to close the window by clicking the window manager's button, the window will receive the delete event.
How can I implement a non-modal sliding notification bar, such as Firefox, Beyond Compare, and VMware Workstation 6.5 use, in client-side Windows apps?
Any language or framework is fine for now; my current app is in Delphi / C++Builder, but I'm also interested in comparing frameworks and prototyping some UIs.
Related question: This question asks about doing so in Java.
Beyond Compare's notification bar doesn't slide, it just pops open, so I can't offer any help on that. The notification bar itself is just a TPanel with a TImage and TLabel for the image/text. It's placed on the main window at design time and it's set to align bottom. Normally it's hidden, and when there's a message to display we set the Visible property to true.
There's different ways to hide the notification, depending on how you want it to behave. In BC we install keyboard and mouse hooks (SetWindowsHookEx with WH_KEYBOARD or WH_MOUSE) and hide it on key up and mouse button events. Alternatively, like Mark said, you could hide it after a delay, add a close button to the side, or just watch for specific events in your app and manually hide it then.
In Delphi, I believe that you can change a property on the Dialog itself (change the window type away from "Dialog" and select the standard windowed alternative). Sorry I cannot be more specific, it has been about two years since I last worked on a Delphi app.