I need to disable the dojo button with click event, But my dojo button disable color only button now also click event working properly, how to restrict this? In j query when we use the disable attribute the click vent also change to the disable mode. How its in dojo?
My code:
dom.byId("somID").setAttribute("disabled", "disabled");
You need to work with the widget and not the dom node.
require(['dijit/registry'], function(registry) {
registry.byId('somId').set('disabled', true);
});
Related
I have a QWizard with 2 custom buttons (on top of the Back\Next buttons).
I wish that a click on my custom button will change to another QWizardPage.
How do I do that?
Thanks
That would be doable by connecting the custom buttons clicked signal with a slot which handles moving to next page.
QWizard wizard;
wizard.setButtonText(QWizard::CustomButton1, "Custom button");
wizard.setOption(QWizard::HaveCustomButton1, true);
QObject::connect(&wizard, &QWizard::customButtonClicked, [&]
{
wizard.next();
});
The code above would create a wizard with a custom button which would function like the default "next" button. If you want to create a dynamic (as opposed to linear wizard which it is by default) you would need to reimplement QWizard::nextId(). Please see:
https://doc.qt.io/qt-5/qwizard.html#nextId
I have a Spark CheckBox and I'm trying to prevent it from changing when clicked. In most Flex components there is a CHANGING event and you can prevent default. I've only found a CHANGE event and if I listen for that event and then set checkbox.selected = !checkbox.selected; it just dispatches changed again and the check box is reselected.
You can just disable any mouse events for this checkbox and would still be able to change the selection programmatically with selected=true:
<s:CheckBox id="myCheckbox"
mouseChildren="false"
mouseEnabled="false"/>
I've added an event listener for a mouse click event and this seems to work but there is a flicker where you can see it was selected for an instant.
IEventDispatcher(checkbox).addEventListener(MouseEvent.CLICK, function(e:Event):void {
trace("click");
ToggleButtonBase(target).selected = !ToggleButtonBase(target).selected;
e.stopImmediatePropagation();
e.preventDefault();
});
Using this, if I trace the events, it's:
change
change
click
Not ideal but it seems to be working.
if I use a button to open a dialog, the button doesn't change the status to normal (stay on ui-state-hover).
How can I tell the button to change back after clicking on it?
Hope some1 can help me :)
I believe ui-state-focus is the class that's being added when the button is clicked. If you add this to the end of the buttons 'click' event, it should reset it to a normal state.
$('#button').toggleClass('ui-state-focus');
I have a scenario where...
1.) Have created a div with a dropdown list and ok, cancel button
2.) On document ready - registering div created on step 1 into a jQuery dialog
3.) on a javascript button click - I am opening this dialog box.
4.) Now, the problem is - the jQuery dialogbox which I have created, needs to be used by other button clicks as well on same page. Now, my div's (which is a dialog at runtime using jQuery) ok button click is already engaged with a javascript function (button1 click) and I can not associate other button's click events with it - thus stuck up here and have no clues or hit to resolve this.
Anyone have faced this issue in asp.net, jquery earlier? Can someone provide a guidance?
Why you cant associate another event?
buttons will have different id. Is it?
$('#button1').click(function() {
alert('Handler for button 1 .click() called.');
});
$('#button2').click(function() {
alert('Handler for button 2 .click() called.');
});
Is this not possible in your case.?
Options:
1) disassociate the click handler when the function opens the div, then later in the function of opening the div associate a click handler to the button.
2) create multiple buttons toggle them all hidden, associate the click handler to each button you want. When the div is opened do a check to see which button to toggle to visible.
3) create no buttons but have a function create the button on the fly. When the div is opened, create the button for that div by calling the function and passing in a code telling it which button to open and what to associate to the click handler (this can be stored in an array and all that is passed in is the key).
Depending on the application, I have used all of these methods. The last one can have a twist that allows it to call an ajax server based application to get the button text and functionality (stored in a database), this saves you from having to load an array with button data, and also allows for easier expansion of the application.
I have a videoplayer with a custom skin class. I want to override the functionality of the fullscreen button. When I add an click event, the player still goes into fullscreen mode. How can I prevent the fullscreen event from firing?
It turns out that if you change the id of the button to anything other than the default then you regain full control over the button.
I changed fullScreenButton to customFullScreenButton (below):
<s:Button id="customFullScreenButton" label="Fullscreen"
click="handleFullscreenButtonClicked(event);"
skinClass="FullScreenButtonSkin"/>
Have you tried calling stopImmediatePropagation on the event when your event listener gets called? That should stop it from bubbling, but I'm not sure if your listener will get it first. It's worth a shot though. Hope that helps.