Proper syntax for adding a keyboard event listener in Illustrator

Hi all,
Sorry for the newb question. For some reason, I am unable to capture any keyboard action in my extension. Probably doing it wrong....
My extension is a panel that only has buttons. The shortcuts for cut and paste become disabled after clicking on a button and I wanted to see if my extension could capture "command-x" and then fire the command via script.
Seems pretty basic, but for whatever reason I'm stumped. does the below look accurate? Why aren't I seeing any alert?
function keyHandler(){
    window.addEventListener('keypress',
            function(e)
                function that evaluates script to show alert("yuck");
            false);
Also, when I do command A after clicking a button, it selects the objects in my extension panel. Then when I copy.... well, I get this....
LSC
Sure does seem like the panel has focus. Any workarounds?

OK. No wonder. It doesn't appear that the panel can pick up key commands unless it has focus. I created a text input and when that was active, my code worked fine. BUT, my panel doesn't HAVE a text input. I don't mind hacking something together with a hidden or super small box that has hidden focus, but it does not appear that autofucus or document.getElementById("id").focus(); works. Anybody confirm.
Does ANYBODY have any sort of workaround for this frustrating state of affairs. I just need for command + X to actually cut after clicking a button in my panel. I don't care if I have to send a menu-command to jsx. That would be fine. Just need to get focus somehow....

Similar Messages

  • Keyboard Event Listener doesn't work in Browser

    Is there a reason why a keyboard event listener would not work if the flash is embedded in an HTML? The rest of my game is running fine in the background, but I can't launch the movieClip "nextCar." My code is below, if that makes any difference...
    function goNow (event:KeyboardEvent): void {
        thisOtherKey = event.keyCode;
        if (thisOtherKey == 32) {
            nextCar.gotoAndPlay(2);
            parkingQue.play();
            tries++;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, goNow);

    This may be a silly question, but have you tryed clicking on your swf after it opens up in the browser, and then trying the keyboard controls?
    I don't know of any issues that cause event listeners to workwhen debugging, but not in a browser.  So, I'm thinking maybe your just not focused on the swf.

  • Methods for adding DBL click event in ALV

    Methods for adding DBL click event in ALV

    Hi Jagrut,
      If you are using CL_GUI_ALV_GRID class to display ALV report and want to add
      double clicking functionality to ALV need to handle event DOUBLE_CLICK
      in your local class.
      See the below code how you define it.
    *===============================================================
    * LOCAL CLASSES: Definition
    *===============================================================
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
    * § 2. Define a method for each print event you need.
        METHODS:
        TOP_OF_PAGE FOR EVENT TOP_OF_PAGE
                             OF CL_GUI_ALV_GRID
                             IMPORTING E_DYNDOC_ID,
        DOUBLE_CLICK FOR EVENT DOUBLE_CLICK
                             OF CL_GUI_ALV_GRID
                             importing E_ROW.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *===============================================================
    * LOCAL CLASSES: Implementation
    *===============================================================
    * class c_event_receiver (Implementation)
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD TOP_OF_PAGE.
    * Top-of-page event
        PERFORM EVENT_TOP_OF_PAGE USING G_DYNDOC_ID.
      ENDMETHOD.                            "top_of_page
      METHOD DOUBLE_CLICK.
    * Top-of-page event
        PERFORM list using e_row.
      ENDMETHOD.                            "DOUBLE_CLICK
      You also need to register the events.
      And also check the program BCALV_GRID_VERIFY.
    Hope this will help you.
    Thanks&Regards,
    Siri.

  • I need to know the proper syntax for my SELECT query, please.

    Hello All,
    Quick one for you:
    Let's say that I have several columns in a table with names such as subject_1, subject_2, subject_3, etc. The table's name is subject_names.
    The number in each of the three column name examples is also a value passed along a query string, the user can select choices, 1, 2 or 3. That query string's variable is $qs.
    So, what I want is a SELECT query that uses the query string value as follows (KEEP IN MIND, I know this is not the proper syntax):
    "SELECT subject_[$qs]
    FROM subject_names";
    I have tried all sorts of cominations of quotes (single and double), dots, brackets, braces and parenthesis. I just want to know how to include such a variable within this code.
    Any and all help is sincerely appreciated!
    Cheers,
    wordman

    Well, I did give you the syntax though.
    $query = 'SELECT ' . $qs . ' FROM tbl_name';
    I put spaces between the periods this time to make it more clear.
    If you put the actual word 'subject' in there and just want your form to name it's options as the numbers available you could do this:
    $query = 'SELECT subject_' . $qs . ' FROM tbl_name';
    In PHP you can use either single or double quotes around your query string, I always just use single quotes. I see a lot of other use double quotes.
    Double quotes would look like:
    $query = "SELECT subject_' . $qs . ' FROM tbl_name";
    Or when using double quotes you can actually just place the variable right in the string without having to concatenate multiple strings like above.
    Since you mentioned that you are good with passing variables I probably don't have to mention that you need to set the value attribute of your option tags (if you are using a select) to the value you want them to pass.
    Ex:
    <select name="choices">
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
    </select>
    If you have that part all figured out then you can use the syntax above for your query string.
    Good luck.

  • What is proper syntax for using PassBack in a Report page select statement

    In my select statement I reference the passBack function using:
    onClick="javascript:passBack()"
    In my Page Header I (Typically) define the passBack function as:
    <script language="JavaScript" type="text/javascript">
    function passBack(passVal1,passVal2) {
    opener.document.getElementById("P2000_CABLE_ID").value = passVal1;
    opener.document.getElementById("P2000_CABLE_LABEL").value = passVal2;
    window.opener.location.reload(true);
    </script>
    But I have never used the passBack function from the Select statement before and cannot happen onto the proper syntax.
    The Page Items I want to pass are:
    1. :P2004_CABLE_ID
    2. :P2004_LABEL
    I want to pass them to:
    1. :P2000_CABLE_ID
    2. :P2000_CABLE_LABEL
    Can someone please help me out... Again?
    Thanks- Gary

    Let's assume column XYZ has both numbers (1), and letters (any alphabet).
    I have a case statement on SQL to turn any value that's not 1 into 0, then I am getting a sum of that column.
    I am also grouping by Row A, B etc to get aggregated sum of column XYZ for those group.
    Now on Crystal Reports function, I need to sum up values under column XYZ for all the groups.
    If I try using sum function like below, I get an error stating:
    "A number field or currency amount field is required here"
    (sum({Command.XYZ}))
    So I thought if I can use a case statement to change the non-numbers to 0 prior to sum that will probably resolve it. But I could not get the below case statement to work either (Error: A string is required). 
    SELECT {Command.XYZ}
       Case 1:
          1 
       Default:
          0;

  • Syntax for adding the file type

    Hi,
    I am trying to add the file type source in the SES server. The SES server is running on a remote machine and I try to add the file directory on the local machine as a source. Could someone give me the syntax please. Also is there a link which helps me with the syntaxes for the different sources in SES.
    Thanks

    Is this on Windows? Handling remote file crawls on Windiows can be a bit tricky.
    If so, then:
    1/ You should to use a UNC-style path to the file, eg \\servername\share\folder\. It will automatically get converted to a FILE url. (Or you can directly specify the file URL). You can't use a "drive letter shortcut".
    2/ You need to make sure that the owner of the Oracle database service (normally called "OracleServiceSES") has access to the shared file system. The service is started by the "Local System" user by default, which does NOT have access to remote file systems. See the NTFS crawler section in the admin guide for more info.
    3/ The connection to the share must be automatic (eg via Active Directory) for the user running the Oracle database service. If, when you access a UNC file path on the server it prompts for a username and password, this isn't going to work.
    If you want to directly enter the URL, the syntax is (non-obviously)
    file://localhost///servername/share/folder
    Note "localhost" is not a placeholder. You need to ALWAYS put "localhost" in there, regardless of the server you are accessing. And note that there are three slashes after it.

  • Proper syntax for email function including a repeat region

    Hey Guys, a fellow ADDT developer and myself ran into a odd challenge recently and was wondering if someone knew a shorter answer.
    LET ME BE CLEAR..I’m not looking for a suggestion, we have resolved the problem..we ARE LOOKING FOR PROPER or shortest FORMAT.
    (we used a submit redirect to a php page that used the “Send Page Section”  and then redirected back..the email looks great)
    This may be a mood point since ADDT is going away but, until then, we feel this will be an useful post because quite often you may have multiple products to email from your SQL statement.
    With that said. We used the send email function on submit.
    1.       Our email content was a HTML content file. Since it was not a php file our repeat region obviously did not work.
    2.       We substituted the HTML file for PHP (just for giggles)..no joy
    3.       We tried regular content as a string..no joy
    We know how to get single rows with the  {table.column} format…but we need to list all undetermined number of products/rows.
    So how would the string or function re-write look  if you needed a repeat region.
    EX:
    emailContent (“ this” . ‘does’. “work”);  regular string
    emailContent (“ this” . $var   . “work”);  regular string
    emailContent (“ this” .   do{  $row; } while( xxx = xxx)  . “work”);  DOES NOT WORK
    emailContent (“ this” .   while( xxx = xxx)  {  $row; }   . “work”);     DOES NOT WORK
    I assume the conflict is you can’t have a function like DO or While in the string….but I also can’t use a php include file.
    There must be a shorter, cleaner syntax that won’t require an advanced set of arrays or for each???
    so  how would a nice clean example of  repeat region results  inside email content, or include file for email contnent, look?
    Thanks

    David, in theory I agree with you, but to a large degree I am completely changing the logic of my human interface. My existing code pre-processes the raw data and saves the results to disk for any future usage. 
    It can then rapidly rebuild all pages for the entire Intranet site when your personal view of the data is changed. 
    After the full creation of all pages, the fixed pages can be viewed using your browser. 
    When you want to change your view, you run the code which completely rebuilds every Intranet page.
    My new software will approach the data differently.  My raw data will be stored with no pre-processing. The pre-processing will occur as the user changes dates and the pages will be built individually on demand, one at a time.
    The second phase of my Windows Form app will be to create pop-up windows that allow the users to modify the definitions for their custom views of the market. 
    When a view is changed, the software will be able to pre-process, as needed, the current date’s data and rebuild the current page with any new changes.
    I intend to create a Refresh.cpp file.  The various segments of the Form’s code will set variable such as date change, view changed, watch list changed, etc. and then call Refresh(). 
    The refresh code will then be able to do the minimum recalculation necessary to rebuild the proper HTML stream. 
    This is another reason to break up the code into various cpp segments such as: LoadRawData, RecalculateViews, BuildPage, etc.
    PS: David, I tried to send you a personal e-mail using your home page link. 
    Hope that was OK and not against forum rules!

  • Need proper syntax for CommonviewFields

    Hello all,
    Am using SP Online
    I have read and tried many blogs and have had partial success with the steps proposed. But when I change
    <property name="CommonViewFields" type="string" />
    to
    <property name="CommonViewFields" type="string" />Title, Text</property>
    I get an error in sharepoint online, saying the XML might not be "well-formed"
    If I export the Content search web part, and re-import it as is, I don't get the error.
    Is there another line of code that I need to change? Or my syntax is wrong? I have tried other column names without success (using the internal name of course)
    Thanks
    Pierre
    pgg02

    Hi Pierre,
    Please remove the first character /, then it should work.
    <property name="CommonViewFields" type="string" >Title, Text</property>
    Thanks
    Daniel Yang
    TechNet Community Support

  • Keyboard events disbaled in full screen

    Hi,
    I have an application which has a text area in it which has some text provided to it using a text flow.
    Now the problem is, when I make the aplication to full screen, I am no longer able to write anything in the text area. I added a keyboard event listner too, but the handler is not invoked.
    So, please can anyone let me know hoe to deal with this issue ?
    Thanks

    On the web, interaction is prevented for security reasons.  In AIR, you can
    use FULL_SCREEN_INTERACTIVE

  • Syntax for page level process to invoke an on-demand app level process?

    I want to use a page level process (if that's the right thing to do) to run an application process on-demand each time certain pages load. What is the proper syntax for the page level process?
    I tried many variations of the following but it does not pass syntax checking.
    1.
    APPLICATION_PROCESS=GLOBAL_UPDATE;
    2.
    begin
    APPLICATION_PROCESS=GLOBAL_UPDATE;
    end;
    What is the proper syntax?
    Thanks,
    Linda

    Linda - If you want to run an application process when certain pages load, just create an application process (PL/SQL type) with the desired firing point, e.g., On Load: Before Header and in the process condition use a condition type like "Current Page Is Contained Within Expression 1 (comma delimited list of pages)". No need to create either a page process or an on-demand application process to do this.
    Scott

  • Proper syntax when binding a boolean to a view node

    What is the proper syntax for binding a nodes visability (or any variable that can be bound) to a boolean variable.
    There are three choices, tell me which of the fallowing is proper.
    var loginPassed: Boolean = false;
    var loadingBox: VBox = VBox {
        visible: bind if (loginPassed) then true else false
        content: [loadingLabel,progressIndicator]
    var loaddingBox: VBox = VBox {
        visible: bind loginPassed
        content: [loadingLabel,progressIndicator]
    var loadddingBox: VBox = VBox {
        visible: loginPassed
        content: [loadingLabel,progressIndicator]
    }Let me know and thanks

    Yes it seams that the problem was not with my bind of the content. The error was actually occuring when running in browser mode. At start up the program was throwing an odd exception. Showing in the stack trace were traces of Node and boolean.
    The error was being thrown when I had Control.TextBox as my default input focus.
    After changing the TextBox to a SingExtension.TextField the error went away.
    I will try to reproduce the error and post in a seperate thread.

  • Removing event listener from a button.

    I've added a "click" event listener to a button, but I'd like to remove it once the button is clicked, so it's not active/clickable any longer. Here's the basic code:
    sym.$('button').click(function(){
         //here I need to make this button not clickable any longer
    Thank you.

    one way...
    sym.$('button').click(function(){
         //here I need to make this button not clickable any longer
         // do smething here then unbind click handler
                sym.$('button').unbind( "click" );
    unbind documentation here.
    hth
    Darrell

  • Proper syntax???

    I was trying to find out the proper syntax for the following select statement. I just started JSP and cannot find info on this. Is this proper?? --
    String Pass= request.getParameter("Password");
    String sql = "Select WEB_USER_ID FROM WEB_USER_INFO WHERE UserName = Pass";
    Thank you for the help!!

    I tried that and got the following error. The asdfasdf is what I typed in the password field.
    500 Servlet jspservlet: unable to service request: [Sybase][ODBC Driver][Adaptive Server Anywhere]Column not found: Column 'asdfasdf' not found

  • What is bind syntax for blob datatype for sqlite3

    Hi All,
    i have written 2 times.
    1. sqlite3bind_blob(insertstatement, 1, image, -1, SQLTRANSIT);
    it doesn't give compile error but when i run the applilcation it crash the
    simulator.
    2. sqlite3bind_blob(insertstatement, 1, image, -1);
    it gives error like too few arguments.
    here image is object of UIImage........
    pls anyone can tell me what is proper syntax for binding of blob datatype.
    Thankx.
    vavdiyaharesh is online now Add to vavdiyaharesh's Reputation Report Post Edit/Delete Message

    I wanted to do something similar, but as you mention, there isn't a lot of sample code to copy and paste etc, and I didn't have the time to spend investigating this one issue when plenty of other things needed my attention.
    In the end I decided to save my BLOB data as actual files in the document directory and then store a link to these in the database row. Something like primarykey_id_blobname.jpg etc.
    Probably not the answer you want, but hopefully it'll get you past a road block and onto the next item on your list.

  • Listen Keyboard events in AIR for iOS? [HELP]

    It works in the browser...  Is there any way in AIR to do this for iOS ?

    Hi, this is an old post but it is related to issues that still in Adobe AIR 3.7, I have the same situation implementing an iCade controller, I have solved the problem creating an iCade proxy that use a hidden TextField to capture text change events that are mapped into keyboard events and finally dispatched to the game listener. This is the code so far, it works but is not optimized, im sure you can optimize and remove the useless code from here:
    package {
              import flash.display.DisplayObjectContainer;
              import flash.display.FocusDirection;
              import flash.display.Sprite;
              import flash.events.Event;
              import flash.events.KeyboardEvent;
              import flash.events.MouseEvent;
              import flash.events.TouchEvent;
              import flash.text.TextField;
              import flash.text.TextInteractionMode;
              import flash.ui.Keyboard;
               * ICadeProxy
               * @author Juan Fernando Vélez Melguizo - © Copyright 3DLogical - www.3dlogical.com
              public class ICadeProxy extends Sprite {
                        private var fireKeysDown:String = "yuihjk";
                        private var fireKeysUp:String = "tfmrnp";
                        public var inputField:TextField;
                        public function ICadeProxy() {
                                  if (stage) {
                                            init();
                                  } else {
                                            addEventListener(Event.ADDED_TO_STAGE, init);
                        private function init(e:Event = null):void {
                                  removeEventListener(Event.ADDED_TO_STAGE, init);
                                  inputField = this.inputFieldSource;
                                  initKeyboardCapture();
                        public function initKeyboardCapture():void {
                   inputField.text = "";
                                  inputField.addEventListener(Event.CHANGE, doKeyChange);
                                  inputField.addEventListener(Event.DEACTIVATE, doRefocus);
                                  inputField.addEventListener(MouseEvent.CLICK, doClick); // This is for debug only
                                  recoverFocus();
                        public function doClick(e:MouseEvent):void {
                                  trace("CLICKED ME:" + e.currentTarget);
                        public function dispose():void {
                                  inputField.removeEventListener(Event.CHANGE, doKeyChange);
                                  inputField.removeEventListener(Event.DEACTIVATE, doRefocus);
                                  stage.focus = null;
                        private function doRefocus(e:Event):void {
                                  recoverFocus();
                        public function recoverFocus():void {
                                  stage.focus = this;
                                  stage.focus = inputField;
                                  inputField.dispatchEvent(new MouseEvent(MouseEvent.CLICK, false, false, 384, 512, inputField));
                                  inputField.text = "";
                                  inputField.requestSoftKeyboard();
                        private function doKeyChange(e:Event):void {
                                  var t:String = inputField.text;
                                  var k:String = t.charAt(t.length - 1);
                                  var eventType:String = "";
                                  var newKey:uint = 0;
                                  if (k == "w") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.UP;
                                  if (k == "x") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.DOWN;
                                  if (k == "a") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.LEFT;
                                  if (k == "d") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.RIGHT;
                                  if (k == "e") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.UP;
                                  if (k == "z") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.DOWN;
                                  if (k == "q") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.LEFT;
                                  if (k == "c") {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.RIGHT;
                                  if (k == "o") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.Q;
                                  if (k == "l") {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.P;
                                  if (fireKeysDown.indexOf(k) != -1) {
                                            eventType = KeyboardEvent.KEY_DOWN;
                                            newKey = Keyboard.SPACE;
                                  } else
                                  if (fireKeysUp.indexOf(k) != -1) {
                                            eventType = KeyboardEvent.KEY_UP;
                                            newKey = Keyboard.SPACE;
                                  stage.dispatchEvent(new KeyboardEvent(eventType, true, false, 0, newKey));

Maybe you are looking for

  • MySite creation error

    I am getting the following error. My Site creation failure for user  DOMAIN\userxyz Microsoft.SharePoint.SPException: User cannot be found. Am alse getting the following value "SPSSITEERROR" in the "Personal site" field for each user profile The setu

  • Need of a function module to give a pop up of certain values

    Hi Experts, I am need of an function module to give a pop up of values present in an internal table, just like an F4 help. Please advise. Thanks in advance, Vivenchandar R

  • Upgrade to Photoshop CS5 with Mac OS 10.4.11

    I am running Tiger 10.4.11 Tigger as I have film scanners that cannot run on the newer 10.5 and 10.6 OS. Can I upgrade to CS5 while running Mac OS 10.4.11. I am using two dual-core intel Xeon processors.

  • Ability to run Reports on Media Download items... (Enhancement Request)

    I would like to suggest that ABC consider enhancing the Reports section to allow users to run reports on the Media Download items.  I have a client that is interested in tracking their download activity of whitepapers and brochures off their website,

  • My new nano 7th gen has no sound

    just got my ipod but cannot get any sound on it