Hi We are using Flex 4 in our project on UI side. On loading the application dashboard, we get a set of pods. We click on a pod and the pod view opens. This pod view contains datagrid with the first column as a hyperlink. When you click on hyperlink another screen opens which is our module screen.
This module screen has a SUBMIT button on top and a couple of datagrids. Now we load data in the grids using RemoteObject. The parent container for each of the grid is a WindowShade Component.
Now our requirement is that the user can make modifications in one or both of the grids and click SUBMIT. Depending upon which grid the user has modified I want to make the corresponding Window shade as read only. IF the user modifies both the grids, I need to make both the Window Shade components as read only and disable the SUBMIT button. The user should be able to see this change immediately on click of SUBMIT without closing the screen or navigating away from the screen.
When the user opens screen for the first time, we get some statuses from backend and Depending upon these statuses, I make the Window shades as read only and enable/disable the buttons. When I click SUBMIT, I still hit the backend and get the status but no enabling/disabling of buttons or window shade happens.
I have written the logic for enabling/disabling in the updateComplete method of my mxml file for which swf is created.
the updateComplete gets called when user opens screen for the first time.It does not get called when the user clicks SUBMIT. why is it so?
I have tried using Loader and SWFLoader to load my SWF file as below but it is not working either.
var request:URLRequest = new URLRequest("com/citi/risk/credit/maintenance/view/widgets/CRCMaintenanceModule.swf");
var loader:Loader = new Loader();
loader.load(request);
Any help or pointers would be greatly appreciated.
Two things you may want to consider:
1) In short, FlexEvent.UPDATE_COMPLETE is an event that gets dispatched has completed rendering itself (gone through a Flex component life cycle). This could happen once, or many times depending on how often the component changes and it's state needs to be re-rendered.
The frequency/timing of this event will vary based on the object that is dispatching it. For example a container that is being resized will dispatch this numerous time. A label that never changes may only do it once.
Instead, you should consider adding a "creationComplete" (FlexEvent.CREATION_COMPLETE) event listener. "creationComplete" only happens once, you can add the listener to any object that contains the submit button.
2) When you click submit, the object you've added the "updateComplete" listener to probably hasn't changed enough to go through Flex's component life cycle. So no event is dispatched.
The answer to why this doesn't happen actually depends on which object you have added the event listener to.
Have you tried using a "click" handler on the submit button, so you could disable the appropriate elements when the button is clicked? Again, the "click" event will happen only once, unlike "updateComplete" ;)
Related
I have some pages where I have a kendo ui grid (wired up to full CRUD services), but use a separate Kendo UI Toolbar control (as opposed to the toolbar configuration in the grid itself). I have a number of different buttons/menus on the toolbar, but am seeing a strange behavior when calling saveChanges() on the grid. If a cell is being edited when the save button is clicked, the grid is saved, but the edited value is lost (it reverts back to where it was). The following details what I see in different situations:
When using a save button configured in the grid (command: "save"), any changes in a cell being edited are committed with the save.
When using a plain html button that calls the saveChanges() method of the grid, any changes in a cell being edited are committed with the save.
When using a save button configured in a toolbar control, the changes in a cell being edited are LOST when saveChanges() is called.
The following jsbin shows the behavior of all three:
http://jsbin.com/jazobexatu/2/edit?html,js,output
I have tried calling the save from the toolbar button a number of different ways (even trying to trigger the click event of the external button), but nothing seems to correct the behavior. I also tried calling closeCell() on the grid (to try to force the value back into the data, but that doesn't work either). I haven't been able to debug the javascript enough to figure out what is different. I'm hoping someone with a deeper understanding of these controls can help me out.
For some reason, the mouse down event on the toolbar button doesn't cause a blur on the editor.
You can try it yourself by clicking in the cell to edit it, then click and hold the mouse button down on the "normal" button. The editor closes on mouse down, causing a blur of the editor, and persists the change.
If you do the same thing, click and hold mouse down, on the toolbar button, the editor stays open.
I've been poking through the source, but haven't figured out exactly why this happens. My best guess would be that the mousedown handler on the toolbar prevents the event from bubbling or running its default action and the editor doesn't blur.
Additional detail: On mousedown on the grid header button and the normal button, the focused element changes (which is what causes the editor blur). But on mousedown of the toolbar button, the editor input element still has the focus.
Shifting the focus on mousedown of the toolbar might be a workaround.
Sort of a weird hack, but this works in Chrome (any should in any browser that supports activeElement
click: function (e) {
$(document.activeElement).blur();
$("#grid").data("kendoGrid").saveChanges();
}
I have NSButton created on interface builder for this app of mine.
When this button is pressed the app starts to render an image. At this time the button's label change to PRESS TO CANCEL RENDER.
The render happens on a second thread but because the app is busy, it may take one or two seconds for the render to stop when that button is clicked. At this time the user may get impatient and click repeatedly on the button, making the app stop, start, stop, start, etc., the render.
Even not responding to the action immediately, the app stores all clicks on that button and processes them when possible.
Is there a way to set the app in a way that when it starts rendering it will accept just one click on that button (to stop the render) and ignore all others until the render finally stops?
You can use
[_yourButtonOutlet setEnable:NO];
and then enable it when the rendering has stopped completely.
I have 2 NSButtons, both are bordered momentary push-in buttons. I have a main window to which other views are swapped in and out. These two buttons are in the main window custom view (next,previous) which helps to navigate through the views.
When I reach the 2 view with the help of next button, I make the previous button enabled and visible. So if I press the previous button at this point the 1st view will be swapped in and I make the previous button transparent and enabled.
At this point if you press the next button to navigate to second view, the 2nd view will be swapped in and the previous button is displayed again. But it is highlighted here. How can I get rid of this?
I hope you will get some better answers, but a general technique that I have found to work in cases like this is to wait with enable/disable actions until things have settled down for the new configuration of the views.
After all (if I have read your description correctly), you are hiding a button in the middle of its own action handler.
Postponing this is easily obtained by dispatching your enable/disable code on the next (or, more correctly, a later) invocation of the run loop of the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
// Enable or disable your buttons here.
});
As a solution it is somewhat of a hack, but on the other hand, waiting until your main view is no longer in a state of flux before you re-configure your navigation UI is not a bad approach.
I'm trying to build an image gallery with photos fetched through an API. The API only allows 1 photo to be fetched at a time.
I want to display a photo and when the use swipes left/right display the previous or next photo.
I'd like the user experience to be seamless/fast. In order to achieve this I was thinking of doing the following:-
When a photo is viewed in full screen, fetch the previous and next photo in the background.
However, what event should I use so that the API call process does not cause any delay to the user.
So my question is, is there an event that is triggered after the photo/contents of the view is displayed on the screen.
That way , I can call the API in that event and pre-fetch the data.
If there's a different approach altogether I should take then please do suggest that too.
Thanks.
The approach you can take is slightly different that what you think. The viewActivate event I believe is the one that is fired off when the view is fully rendered and is ready to be pushed to the screen, but I believe that firing off your request will cause some chunky behavior in the transition which brings the view on to the screen. What you really want to do is add an event listener to the actual transition that brings the view onto the screen and when the transition completes you should then fire off your API request to get the additional pictures. A transition fires off a FlexEvent.TRANSITION_END event when a transition is completed. So attach your listener to that and it should do what you are looking for.
I have been trying this for past few days but couldnt figure it out.
I have an application which has a NSOutlineView and a NSTableView. Outlineview takes input a path and displays them in the form of a tree structure its sub contents. So when ever a user clicks on a particular folder in the outine view, the contents of the folder should be displayed in the table view with their attributes in the form of a list.
Now i am able to display in both the views respective contents and the interaction between the outlineview and tableview is done using delegates and notifications.
Now my problem is I want to have mouse events to be detected in both the views so that i can make my app more interactive by enabling single click to select, double click to enable opening the file/folder and control+click to enable a contextual pop up menu. but strangely no mouse events are getting detected.
my design of the app is pretty simple with each of table and outline views having their own view and controller class and interactions between them using notifications. Please can you guys suggest me where i am going wrong?
I know i can get single click and double click to work using setAction and DoubleAction methods of table view but i cannot get control click to work. I want to know whats wrong with my app design as non of my views are detecting mouse events :(
Thanks
You can get whether Control is pressed with:
if([[NSApp currentEvent] modifierFlags] & NSControlKeyMask){
//control was pressed at the time the event was posted
}
Or you might want to subclass the NSTableView/NSOutlineView and override mouseDown: to get the event directly.
Also, if your action and doubleAction aren't working, verify that the target/action are correct with something like:
NSAssert([[theView target] respondsToSelector:[theView doubleAction]], #"target/action is wrong");