Determing whether dijit.dialog content has displayed - dojo

Does anyone know of a way to determine whether the content of a dijit.dialog has become visible to the user? As in if the content of the dialog has actually been displayed yet or not.
Thanks

There's also an onShow event that you could connect to, or even set:
dijit.byId("dialog1").onShow = function(){console.log("hello world")};

The function onDownloadEnd() is called when the dialog's download finishes.
You could connect your own code to that event using dojo.connect().

Related

Aurelia: Show Dialog State In URL

I have a simple Aurelia application that displays accounts. The default view is a list of accounts. There's also an account details view.
I'd to make the details view open in a modal/dialog over the top of the list view. However, I want the presence of the modal to show up as part of the URL.
I found it easy to use the aurelia-dialog plugin to display the details view, but can't figure out how to get the dialog's presence to show up in the URL.
Another option might be to throw out aurelia-dialog and use a child router to display the details view, then figure out how to make that show and hide as a modal.
And, of course, another possibility is that there's a better way that I just don't see yet.
Has anybody seen or created something like this?
One possibility that occurs to me would be to add the dialog's presence as a parameter to the current route and then call it. You could use the route like /account?dialog=true. Run some tests to ensure that the ?dialog=true still routes to the same page. Then, use that route to check whether that parameter is set and display or hide the dialog window. When you refresh the page, the dialog window should still be open/closed. This also means that whenever you open or close the dialog window, you need to send a new route to the router (basically same route but different parameter).
This isn't a detailed solution but might get you on the right path.

titanium - get the current window

I'd like to be able to show an error message (or maybe even a success message!) to the user. However, this would be for an asynchronous event - so it is presumably possible for the user to have jumped to another page in-between the sending for the event and the response.
Given that that is the case, and given that i use a tabgroup as the "base" in the initial app.xml, how am i meant to access the current window? Ti.UI.getCurrentWindow() doesn't do anything on my system - no error, no nothing.
I'm using the Titanium 3 api.
Since your using a tab group you can use Titanium.UI.currentTab. Then you can get the window of the tab like this:
var theWindow = Titanium.UI.currentTab.window;
Specific doc reference (just in case).
Also, you can always use a Titanium.UI.AlertDialog, that will show up no matter what window your on, if it meets your requirements.
Yes you can use
Ti.UI.currentTab.window().
and since this is function so use "()", otherwise it will not give correct output
to get current window use Ti.UI.getCurrentWindow and not Ti.UI.getCurrentWindow()
Ti.UI.currentWindow only works if there is a window already open. The error you have is coming from the fact that when you create the MasterView, you have not yet opened up the window.
Look inside ApplicationWindow.js, you will see that you create the masterview before even opening the window.
If you want to set navbar items, either add them in the ApplicationWindow, app.js, or pass the window to the MasterView.
currentTab only works if your app uses tabs.
currentWindow and getCurrentWindow() only work if the window was opened using the url property of the Ti.UI.createWindow method.
If you're in any other situation, the current window is just not available, it seems.

Changing CSS variables based on JavaScript events

We have a Facebook app here which has three boxes with three buttons. Each button, when clicked, should change state once an event (successfully) happens. The buttons are almost all working (a few minor bugs) but they have been done a rather long-winded and inefficient way.
My question is, what is the most efficient way to link events (i.e. page 'liked', personal information submitted, page 'shared') with the state of the buttons?
You can use jQuery and the .trigger() function to fire off events. Then you can use .bind() to listen to the events and do something. For example, when the user logs in, you can trigger a user_logged_in_event, and bind to it. In the function, you can then use JS to change the login button to logout...

Show but disable a view in Eclipse-RCP

I have two views in my RCP application, wherein I'm performing a task(background operation),the status of the operation is shown in view1. What I'm trying to achieve is that,during the task in progress, user shouldn't able to move/traverse to other views.They(other views) should be disabled.
As a workaround i tried using the showView method of IWorkbenchPage.
activePage.showView(view.ID,null,IWorkbenchPage.VIEW_VISIBLE);
I've used the three constants VIEW_VISIBLE,VIEW_ACTIVATE,VIEW_CREATE. None worked in my case though.By the way in showView method signature, i could not figure out what is a secondary id.
Below is the simulated demo of my problem
here the user can traverse to view Demo,during the operation, which shouldn't be actually.
How can i resolve this, any ideas please?
You can't really disable a view (there is no notion of "disabled views"). The only thing you can do is hide it. Use the hideView() method to do that.
Another way of doing it would be to use the ProgressService to display a modal progress dialog while the operation is progressing. This way the user must wait until the operation is complete before they can interact with the UI.
PlatformUI.getWorkbench().getProgressService().run(true, false, runnable);
See http://wiki.eclipse.org/FAQ_Why_should_I_use_the_new_progress_service%3F
You can disable a view like you disable any other SWT control: by setting setEnabled(false) on the top Composite. Often done by overriding ViewPart.showBusy(...)...

Where can I read how to make web notifiers such as the StackExchange at the top left side of StackOverflow screen?

I'm not even sure what the name of that is to be able to make a search... but I would like to make those kind of things. Facebook has that too with the messages, notifications and friends requests. Thanks
I'm not sure if you expect anyone to give you a complete tutorial with source code included? :) You should probably do some digging around yourself, since a concrete answer on this could mean to write a few pages :)
How can you dig around?
Thé tool for a job like that is Firebug (IMO).
With bigger tasks like these it makes sense to try to split it up in smaller pieces.
Let's say you go for a widget like the user profile popup on SO.
you need some HTML to display in a popup: right click on any html element on the popup and click the 'inspect element' menu item. This brings you to the HTML tab in firebug. This allows you to figure out how the HTML is structured
you need some CSS to style that popup: when you're browsing the html structure, you might already have noticed that on the right side of it is the CSS that is applied to the active element
you might want to use some animation effects: for that you could use jquery. Have a look here to find out more on which effects are available and how they can be triggered. Fading is used in the profile popup on SO.
then you might ask yourself the question where SO get's that html structure from, right? To find out more about which server calls are made you can use the 'NET' tab in Firebug. (When you hover over your user name (only the first time?), then you should notice there's a call made to something like: http://stackoverflow.com/users/profile-link-stats?_=someLongNumberHere
In firebug you can then inspect the request and response. You should notice that the response is some HTML structure. This HTML structure is then inserted into the DOM.
Sooooo you can kinda glue it all together now:
the user hovers over his user name
the hovering triggers a server call (see step 4): use jquery hover to attach a handler to the user link. (subsequent hovers don't trigger that server call, so there needs to be a check to see if that profile popup was already loaded or not)
when the server call successfully returns (see jquery get), the returned html is inserted into the DOM and a fadeIn effect is triggered.
it seems a mouseout is used to fadeOut the popup
I HOPE this is the answer you were looking for. It took me a while ;)
You probably need to check out stackapps