Extjs 4.2 How to add contextmenu to a Label at runtime? - dom

I have a label which created at runtime and I want to attach a listener to it to display a contextmenu when the user click right mouse button?
Thank you

Here is the solution:
mText is a label.
mText.getEl().on('contextmenu', function(e,t,eOpts) {
e.stopEvent();mnutxtContext.showAt(e.getXY());
});

Related

Ag-grid: How disable cell click event when enableCellTextSelection is used and text is selected?

Using ag-Grid Community and Angular, I set [enableCellTextSelection]="true" to enable cell text selection to facilitate copy-paste, but I found that the cellClicked event still fires when text is selected and the mouse button is released (i.e. the mouse is clicked, dragged and released in the same cell).
Is there a way to detect that text is selected in the cellClicked event and "cancel / quick exit" it?
I looked for a way to distinguish between the mouse down and mouse up coordinates but couldn't find anything...
Thanks.
Version in use
ag-grid-angular: 23.2.1
ag-grid-community: 23.2.1
Here's a little workaround you can use. Use window.getSelection() to get the text selected by the user. From this, you can determine if text has been selected or not.
Change your cellClicked callback function to this:
cellClicked(event)
{
if (window.getSelection().type !== 'Range')
{
//text has not been selected, the cell has been clicked
console.log('cellClicked');
}
}
Demo

How to show datepicker on click of textfield in titanium?

I am able to show datepicker. But on native application User click the textfield and date picker is open .So I need to implement that functionality using titanium platform. can you suggest a way or give some example .When user click textfield it don't show keyboard only show datepicker ?
Its simple just add a datepicker in runtime.
Go through this link Demonstrates all
Datepicker on click of text box
You have to set the editable property of your textfield to false, then call your picker in the "click" callback of the textfield.
var textfield = Ti.UI.createTextField ({
editable: false // That way the keyboard won't show up
//your other textfield properties
});
textfield.addEventListener('click', function(e) {
showDatePicker();
});

Tinymce adding text with button

I'm trying to implement a button outside of the TinyMce editor, that would add text to the active editor upon clicking.
How can I do this?
(For example: There's a button on my website that should add "Test" into the editor, but it doesn't).
Thanks for help :)
Add this code to the onClick of your button:
// the editor id is the same id of your textarea, default "content" in case your textarea does not have an id
tinymce.get('your_editor_id').execCommand('mceInsertContent', false, "Test");
In case you have one single editor on your page you may also use tinymce.activeEditor instead of tinymce.get('your_editor_id').

How to make a button in android and make it invisible

I want to have a button which should not be visible but when clicked onclick should be executed..
I have tried making
Button button;
1)button.setVisiblity(4);//it made it invisible but onclick was not working
2)In the layout xml i have attached android:visibilty="invisible" //but it made it invisible
Remove the visibility bit and use the following instead.
button.setBackgroundColor(Color.TRANSPARENT);

How can i show textbox as a Dropdownlist on mouseover

When I hover over a textbox I want it to be displayed as a dropdown list, then after I click it I want it to be displayed as a text box again, how can this be done using jquery?
Try this JqueryUI Autocomplete Box, It can be tweaked as ComboBox as well.
http://jqueryui.com/demos/autocomplete/
I suggest to use this.