Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Question 1</h2> <p>I'm new to TideSDK as well and might be wrong, but as far as I can tell from the API documentation, context menus are bound to a window, and displaying different context menus when right clicking different parts of the window would require you to each time change the window's context menu...</p> <p>Example:</p> <pre class="lang-js prettyprint-override"><code>//Create different menus var context_menu = Ti.UI.createMenu(); var copy_menu = Ti.UI.createMenu(); //Add menu items etc. ... //Change context menus on click events depending on clicked element $('#some-element').mousedown(function(event){ if(event.which==3){//detect right click editor_window.setContextMenu(context_menu); } }); $('#text-field').mousedown(function(event){ if(event.which==3){//detext right click editor_window.setContextMenu(copy_menu); } }); </code></pre> <p>This way, when you click the element with id <code>some-element</code>, the first context menu is shown, and when you click the <code>#text-field</code> element, the second context menu is shown.</p> <p>Note that this won't work if one element is inside the other, because then both events are fired.</p> <h2>Question 2</h2> <p>In this code you supplied:</p> <pre class="lang-js prettyprint-override"><code>$.(#this).val(Ti.UI.Clipboard.setData('text/plain')) </code></pre> <p>You want to use <code>Ti.UI.Clipboard.getData</code> and not <code>Ti.UI.Clipboard.setData</code>, since you want to get the text stored in the clipboard and then put it into the text field. Also, you might want to change <code>$.(#this)</code> to <code>$("#this")</code> or <code>$(this)</code>.</p> <p>This should work: </p> <pre class="lang-js prettyprint-override"><code>$("#some-element").val(Ti.UI.Clipboard.getData('text/plain')) </code></pre> <h2>Remark</h2> <p>You seem to be confused about how to use jQuery. To select an element, you use <code>$()</code> and not <code>$.()</code>. Also, with <code>$("#example")</code> you select the DOM element with the id <code>example</code>. <code>$(this)</code> is used inside a function called when an event is fired, and refers to the element on which the event was fired. <code>$("#this")</code> is not the same as <code>$(this)</code>. Hope that helps a bit...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload