JavaFx control action - javafx

I have a JavaFx application with multiple buttons to click. At some point in the application it does not make sense to click some of them.
What is the best way to control when a certain action (i. e. Button pressed) should be allowed and when not?

Related

ASP.NET MVC4 - Call an action from a controller by passing a lot of parameters

I am using ASP.NET MVC 4, and I am trying to do the following:
I have a view where I have some radio buttons and checkboxes. User can select what he wants and then there is a submit button in this view that can be pressed. If this button is pressed I want pass by parameter or some other way the radio buttons and checkboxes state (checked/unchecked) to a controller that is linked to another view. The controller is going to do some tasks by taking into account the radio buttons and checkboxes state. While the controller is doing those tasks, in the view associated with the controller I want to put information about what the controller is doing (the progress - simple sentences describing what it is doing -) and show this view.
The submit button is not within a form and the code for the submit button is:
In onclick button I do not know how to pass the radio buttons and checkboxes state to the controller nor once in the controller I do not know how to show the progress of the tasks doing by the controller in the view linked whith the controller.
I am completely lost.... sorry I am completely new in web application programming... I will highly appreciate is anybody can guide me in the right direction to get rid of this.
Some piece of example would be highly apreciated.
Thinking about it, it would suggest to define a ViewObject class that matches all the field (radiobuttons, checkboxes etc) in your form. And then create a specific controller for this view.

click events of combobox in flex

I found that in flex, combobox has 3 events: open, close, change
combobox events example
Let's say I selected A in my combo box. Then I might do 2 things:
I open combobox and click A option again
I open combobox and close it by clicking somewhere else (without clicking A option)
There is no selection change in either of the case above. And they both have open and close involved. So if I want these 2 actions have different behaviors, I can't programmatically distinguish them....
Is it possible to have a click event on combobox or combobox options?? I am using a data provider for my combobox...
Thanks a lot!!!
The ComboBox events do have a click event defined, although it is inherited.
Unless the ComboBox has a click event listener and calls preventDefault() to prevent the event from bubbling, you should be able to listen for the click event on a ComboBox without any issues.

How to keep focus on control intact while AJAX fills DropDown?

I am using Ext.Net 1.3 library for ASP.NET.
I have five ComboBox controls and each is linked to the other. Selection in the first ComboBox is compulsory. Selecting an item from the first fills the second ComboBox, and so on.
The problem is when I press TAB key to navigate on the controls, the focus is lost after appearing for some time on the next Combo.
This is because, when the first Combo looses focus, it fires the OnSelectedValueChanged event which executes the code to fill the second ComboBox using AJAX.
How to keep the focus intact even while AJAX request is executed?
One option may be to call .Focus() on the triggering ComboBox from within your OnSelectedValueChanged event handler.
This will force the focus to be reset on the ComboBox after the DirectEvent returns.
Hope this helps.

How Does ASP.NET Knows Which Button Caused a PostBack?

I'm using ASP.NET 4 to create a page with elements that are used in a jQuery UI Sortable plugin.
All of these elements contain a button (implemented as a submit button) with the name SubmitButton. All but one of these buttons are hidden in the page's Load event. But if I drag the element to another position, and then submit the page using that button, ASP.NET gets confused.
ASP.NET thinks I've clicked a different button, one that wasn't even visible on the page, but is associated with content at the position where the clicked button was before the move. (If I don't move the element, it works fine.)
I can't seem to determine how this is happening. As I understand it, ASP.NET knows which submit button caused a postback because the button's name and value is included in the postback data. (__EVENTTARGET plays no role here and is empty.) So how can it think a different button submitted the page?
How could ASP.NET get confused about which button submitted the page?
(Sorry, it's not possible to put this page on a public website.)
I worked through this issue and here's what I found.
First of all, buttons by default are rendered as <input> tags with type = submit. The postback mechanism in this case has nothing to do with ASP.NET. The postback data includes, among other things, the name of the submit button that caused the postback along with the button's text (in the form name=text).
But ASP.NET button names, by default, include the names of all parent controls. When those controls are unnamed, they are given an ID like ctl00, ctl01, ctl02, etc. The result is that all my buttons are guaranteed to have a unique name.
The problem is when these buttons and parent controls are all created dynamically. On the postback, these controls are reconstructed in the load event but in the new order. Because the order affects the name (ctl01 vs ctl02), this means my submit button has a different name than it did when the page was originally rendered.
The result is that ASP.NET sees the wrong name associated with the submit button used to trigger the postback.

Multiple User Control On Same Page And reference issue with Javascript

I have one usercontrol which contain one textbox, few buttons and one calander.
I had place two instance of user control in one page as design time. It works fine all working from server side...mean server side events reference proper control at runtime.
Problem start after raising server side events from javascript. I succeed to fire proper event from javascript as per suggetion from other thread. Still I am not able to reference specific control at server side event. It always reference to control of last user control placed on page.
In my senerio I am firing calander's selected change event by buttons click event from javascript. The event fires as I want, but always it reference to last usercontrol's Calander.
Firing server side events from jabvascript is one step towards performance of user control.
Please suggest me.
On button click event call function of specific button and find calendar by id.

Resources