How to handle intercommunication between windows - extjs4

I am able to open a new window by clicking on a button in another window, but my requirement is that I should be able to listen to the events generated from the other window.
Can anybody help me? How can I register the events from one window and listen to them in the other, so that intercommunication can happen?

My answer would be that you shouldn't. Register your listeners in a common controller--that way, whatever events are fired by either window can be captured by the controller, and the controller can decide what needs to happen to what window in what circumstance.

I use TIBCO PageBus (http://developer.tibco.com/pagebus/default.jsp) for inter application events within my ExtJs applications. It is a JavaScript event bus. For instance, similar to what you describe, I have an editor window, which has a button to display a preview window. The editor window on a save, raises a update content event on the page bus, which the preview window subscribes to, upon receiving the event it refreshes the preview.
One of the advantages of this approach is that many clients can subscribe to events, if you have a complex application.

Related

use OnClientClick on bootstrap modal to avoid postback

Am using vb.net in asp.net to create my project. I use also a bootstrap modal to get data from client.
In the modal I have buttons and textboxes that get the data from user. there is a FINISH button that ends the process and closes the modal
the problem is that the other buttons are not supposed to close the modal, but make some calculations and processes. At one hand I need the postback in order to tiger the events of the buttons, And at the other hand the post back closes the modal, and i have to re-open it at the end of each process. This action makes the modal close and re-open after each click, and it is not Nice or Convenient
I thought that if I disable the postback of the buttons, and use the OnClientClick to catch the client click, this will work for me. But the Question is how can I make the OnClientClick Call a server side code (Sub)?
Any other Suggestions are welcome :)
OnClientClick is just that the CLIENT CLICK it doesn't translate into a server side method. Each ASP.Net server control has an OnClick event which is associated with a server based method, but that would give you the exact same scenario that you're dealing with now.
In this situation, I would have the secondary buttons (i.e. the ones that don't close the modal by behavior) use AJAX to send/receive data from the server (accessing an ASHX file or some other handler/WebAPI). This removes the entire postback situation entirely which sidesteps the issue.

How do I create a click event in Verold?

I am experimenting with Verold (http://verold.com), a web based tool that allows you to create webgl 3d experiences. I have made this simple prototype:
http://www.verold.com/projects/54270b01497675020000007d
Right now my animation occurs on load. I'd like to "replay" the animation on click of the background (or on another object).
I could not find the appropriate event to make a "button" or click event.
You have a couple of options.
You can use an Event Handler component in Verold, and listen to the Pick event on any object in your scene.
Alternatively, if you're building an API project in Verold, you can create a button in your HTML page and trigger an event from there:
VAPI.globalEvents.trigger('myEvent');
Then in Verold, add an EventHandler that listens to the myEvent Custom event.
Ross

Silverlight avoid requesting an event twice

I have a Control say for ex a Submit button if user clicks the button twice or more continuously then user receiving same message / same operation taking place twice or more.
I need to avoid this situation.
thanks for your inputs.
You need to detect the button click event either in the code behind of the view (or ViewModel if using the MVVM pattern) and disable the button. Now I take it that your submit button is firing off some kind of asynchronous operation. Once the asynchronous operation has successfully completed you will probably need to enable the button so that it is available again.
Shankar, if you want to avoid clicking on button, you should disable it. If you can give more details about what exactly you are trying to do, more details can be given.

NSWindow does not respond to keystroke command-s

It may be very simple, but I cannot find it:
I have three windows in three separate NIBs in my application. One is opened when a new document is opened, the other two can be opened from the program's window menu.
The problem is: two windows (in them the one that is opened at the beginning) accepts the normal keystroke as for example command-s for save, and the other one does not and gives a warning sound instead. I cannot figure out the difference between the two windows or their controllers. I know it will have to do with the responder chain, but I am left clueless.
Any ideas?
Check to make sure that the window's delegate is set to the window controller, and that the window controller implements -saveDocument: (or whatever action the Save item is connected to).
Windows don't respond to key combinations. Menu items do. In response to being pressed (whether using the mouse, using a key combination, or using Accessibility), the menu item sends its action message down the responder chain.
You get a beep when nothing in the responder chain responds to the action message.
Assuming that this is an NSDocument-based application and you've started Apple's doc-based-app template, the menu item's action is saveDocument:, and the NSDocument object is the object that responds to that message. When your document windows are active, their documents are in the responder chain, so the menu item that sends that action message is enabled. When your third window is active, the document is not in the responder chain; nothing else responds to that message, so the menu item is disabled.
This problem isn't specific to Save—it affects all action messages that should go through to the document object. One important other example is Print: The user will probably mean to print the document, not the third window.
You've probably made this third window a kind of window that exists as a peer to the other windows. Besides this responder-chain problem you're having, the user will also probably not realize that they have left the document; they expect to still be able to do document things. Consider making it a utility panel instead.
If you really do have a good reason to make this window whatever kind of window it is, you'll need to keep the last-active document object in the responder chain when this third window becomes main, while at the same time handling the case where the window becomes main because a document window (possibly the last one) has closed.
Well, it turns out that I implemented the third window in a way where I created it with its controller using initWithNibFile, ran a procedure in the controller and then sent it a [window close] command because I did not want it to appear on the screen yet. That somehow took it out of the document-associated window, no idea why. No I migrated that specific called procedure into the document controller itself, treat the window like the second window and voila, it works again.

.Net Not Responding, Application.DoEvents and Threading

My mdi VB.Net application performs a long operation on some data. Ideally I should use a separate thread to prevent the dreaded “Not Responding” message.
My problem is if I use a separate thread users then have the ability to click on other controls in the application which can directly affect the operation my background thread is working on, creating an error.
Is there any way to prevent all the mdi windows, toolbars and other controls from receiving mouse clicks and keyboard input during my background thread’s operation?
Or is there a way to clear the message que before performing a Application.DoEvents?
Thanks
I would say that the best choice when you don't want a user to click on a control is to set Enabled to False for that control.
CLARIFICATION: Setting Enabled to False for a parent control will also disable any children. So, setting Enabled to False on the main window and and MDI windows, will do the trick.
There are a couple of ways of disabling the controls but I'm not sure it's what you want.
If you have a main window which is completely disabled while a background thread is processing then why go through the overhead of processing on the background? The advantage of processing on the background is to allow the user to still work with the application while you process data.
I think a better approach would be to take Dustin's route and selectively disable certain controls that can affect the background operation. Or make your background operation independent of the UI while it's processing.
If you tell us a little bit more about how your Main Window and Background thread interact we may be able to give you a better solution.
Hide all forms and only show the one main form. Then disable the Toolbar/Menu if you have either. Then have a status bar with a progress bar and when it gets done, unhide the form the user was working on.
When you are using a statusbar or a progress bar while your background thread is processing some longduring task, disabling your form will also disable your progress/status bar from updating. So what you should do in this case is disable every other control exept from the one that needs te be kept active (e.g. like a progressbar).
List<Control> lstControls = GetAllControls(this.Controls);
foreach (Control ctrl in lstControls)
{
if (ctrl.GetType().Name.ToLower().Contains("progressbar") {
ctrl.Enabled = true;
}
else
{
ctrl.Enabled = false;
}
}
Use a thread and display a modal dialog that shows the user the progress of your task and gives the user the option to cancel it.
The modal dialog will automatically prevent input (the parent may have to be the mdi window itself.)
(Please do not use hacks like hiding or disabling controls or windows. And please, please, please! do not use DoEvents.)