Problem in capturing key board event

Hi
I am trying chart selection using keyboard.I tried same
example given in "
http://livedocs.adobe.com/flex/3/datavis_flex3.pdf"
code is
<?xml version="1.0" ?>
<!-- charts/SelectAllItems.mxml -->
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import flash.events.KeyboardEvent;
import mx.charts.events.ChartItemEvent;
[Bindable]
private var expensesAC:ArrayCollection = new ArrayCollection(
{ Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },
{ Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },
{ Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },
{ Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },
{ Month: "May", Profit: 2400, Expenses: 575, Amount: 500 }
private function initApp():void {
application.addEventListener(KeyboardEvent.KEY_UP,
keyHandler);
private function keyHandler(event:KeyboardEvent):void {
var ctrlPressed:Boolean = event.ctrlKey;
// If the user presses Ctrl + A, select all chart items.
if (ctrlPressed) {
var curKeyCode:int = event.keyCode;
if (curKeyCode == 65) { // 65 is the keycode value for 'a'
selectItems();
private function selectItems():void {
// Create an array of all the chart's series.
var allSeries:Array = myChart.series;
// Iterate over each series.
for (var i:int=0; i<allSeries.length; i++) {
var selectedData:Array = [];
// Iterate over the number of items in the series.
for (var j:int=0; j<expensesAC.length; j++) {
selectedData.push(j);
// Use the series' selectedIndices property to select all the
// chart items.
allSeries
.selectedIndices = selectedData;
]]>
</mx:Script>
<mx:Panel height="100%" width="100%">
<mx:PlotChart id="myChart"
height="207"
width="350"
showDataTips="true"
dataProvider="{expensesAC}"
selectionMode="multiple"
>
<mx:series>
<mx:PlotSeries id="series1"
xField="Expenses"
yField="Profit"
displayName="Expenses/Profit"
selectable="true"
/>
<mx:PlotSeries id="series2"
xField="Amount"
yField="Expenses"
displayName="Amount/Expenses"
selectable="true"
/>
<mx:PlotSeries id="series3"
xField="Profit"
yField="Amount"
displayName="Profit/Amount"
selectable="true"
/>
</mx:series>
</mx:PlotChart>
<mx:Legend dataProvider="{myChart}" width="200"/>
</mx:Panel>
</mx:Application>
This example won't work. nothing happen after pressing ctrl
+A .
can any body help me in that?
Thanks
sm

This line of your code:
allSeries.selectedIndices = selectedData;
should be this (that's what in the PDF):
allSeries.selectedIndices = selectedData;
Ya gotta copy the sample code correctly...
Also, nothing will happen from the keyboard until you click
somewhere on the chart.

Similar Messages

  • Problems with key board events

    hi, i am experiencing some key board events, in this project iam suppose to make the sphere/earth move left,right,up,down with left,right,up,down arrow.
    can you please tell me if i have make any mistakes in my coding????
    package
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import org.papervision3d.materials.BitmapFileMaterial;
        import org.papervision3d.objects.primitives.Sphere;
        import org.papervision3d.view.BasicView;
        [SWF (width="800", height="600", backgroundColor="0x000000",frameRate="30")]
        public class InteractiveEarth extends BasicView
            private var sphere:Sphere;
            public function InteractiveEarth()
                super(800 , 600);
                var earthmaterial:BitmapFileMaterial = new BitmapFileMaterial("../assets/Earth.jpg");
                sphere = new Sphere(earthmaterial,100,20,18);
                camera.fov = 25;
                scene.addChild(sphere);
            addEventListener(Event.ENTER_FRAME,rotateSphere);
            addEventListener(KeyboardEvent.KEY_DOWN, downEarth);
           // stage.addEventListener(KeyboardEvent.KEY_UP, upEarth);
            public function rotateSphere(evt:Event):void
                sphere.yaw(0.2);
                singleRender();
            public function downEarth(event:KeyboardEvent):void
                switch(event.keyCode)
                    case Keyboard.DOWN:
                        sphere.y += 5;
                        break;
                    case Keyboard.UP:
                        sphere.y -= 5;
                    break;
                    case Keyboard.LEFT:
                    sphere.x += 5;
                    break;
                    case Keyboard.RIGHT:
                    sphere.x -= 5;
                    break;

    You haven't said what the problem is.
    If your keyboard event handlers are not being called, perhaps you need to add the event listeners to some other object.
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.chikaradev.com
    Adobe Flex Development and Support Services

  • Capture key press events with ExtendScript?

    Is it possible to do this?  I can't find an example in the documentation or online anywhere.  I'd really like to know when the user presses the arrow keys while viewing the slideshow in Bridge.
    Thanks!

    Thanks for the example Paul.  I can see how to listen to key down events on Windows and Dialogs that I create.  Do you know of way to listen for global (app-wide) key down events? These are not defined:
    app.addEventListener('keydown',...)
    app.document.addEventListener('keydown',...)
    I'm trying to add to the slideshow mode by having a little palette dialog with the context information shown that I need.  The default caption box doesn't have what our artists want.  If the palette window is in focus, I get the keydown event, but if they're using the arrow keys to flip through the slideshow, I can't capture those.
    Thanks for the help.

  • How to detect key board event

    HI,
    How to detect keyboard event (Like CTRL key press shift key press) in Swing�any can any body suggest classes and interface for that�.
    Thanks

    [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to use Key Bindings

  • Problem while  capturing keys from keyboard .

    hello abapers,
    i am trying to catch my enter key from keyboard coz i want run some code when user will press enter.
    i think sy-ucomm will capture the key pressed, if i am wrong then plz correct me.
    (1) with this assumption i tried running bdc for my screen and tried to get the bdc_okcode value  which  is /00
         i passed this value to sy-ucomm in my abap prog but it didnt worked
    (2) i tried writting /h in command window it oppend the debugging window but the value for sy-ucomm was blank
    if any one of you is able to correct me it would be of great help to me plz its .....
    Thank you.
    Edited by: Dakshaini A Subramaniam on May 15, 2011 8:36 AM
    Edited by: Rob Burbank on May 15, 2011 4:21 PM

    Hi ,
    Double click your ,
    SET PF-STATUS 'STATUS'.
    code. At Standard Toolbar part of the pf-status  , set OK CODE for first item (green) to 'ENTER'.
    When user hits enter , sy-ucomm will be ENTER.
    This is for screen processing .

  • Problems in capturing the button event

    Hi
    I have created a BSP page with some buttons on it.
    I am trying to execute some code on click of the button, I am capturing the button in OnInput processing event using the following code
    event_data = cl_htmlb_manager=>get_event( runtime->server->request ).
    however the event_data is not getting populated with the button event and i am getting a null reference dump...
    can you tell me if i need to anything else apart from adding the above code.
    Thanks
    Bharath Mohan B

    Hi Bharrie,
    the online documentation describes this very clearly. You access it by double-clicking on the BSP Extension element in the Tag Browser.
    A brief snippet from the doco....
      DATA: event TYPE REF TO CL_HTMLB_EVENT.
      event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
      IF event->name = 'button' AND event->event_type = 'click'.
          DATA: button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.
          button_event ?= event.
      ENDIF.
    Cheers
    Graham Robbo

  • How to listen key board event

    Hi,
    I want to trap CTRL key event on panel on windows plateform plz send a sample code...
    Thanks

    Did you do some follow-up research on the suggestions given to you by tjacobs01 in your last posting on this subject?
    http://forum.java.sun.com/thread.jspa?threadID=645822

  • Key Board Events

    Hi Experts,
    Please let me know if there is a possibilty of introducing custom keyboard events in WD.
    Regards
    Amit
    Message was edited by:
            Amit Kesari

    Hi Amit,
    Please check out for this thread
    POLL: Web Dynpro UI elements - enhancement proposals
    <b>Ravi Pasupathy</b> has requested saying it would be fine if <b>Keyboard Events</b> are implemented in WD. Not very sure if it is implemented now
    Check out for this link
    http://127.0.0.1:2647/help/topic/com.tssap.j2se.doc.user/docs/api/java/awt/event/KeyListener.html?resultof=%22%6b%65%79%62%6f%61%72%64%22%20%22%65%76%65%6e%74%22%20
    Regards
    Mathan MP

  • Capture Key Event - Feature Request

    Hello,
    We are using Forms 9.0.4 to build applications to be viewed over our intranet using Jinitiator. I am new to the development team and this is my first time using Forms. I am trying to find a way to capture key press events on a given field (we want to automatically search within a field each time the user enters a letter). I have seen nothing inherent in Forms to do this. There has been lots of metion of a PJC.
    1. Is there a plan to include such a trigger by default?
    2. If not, can someone please dumb-down PJCs for me?
    Thanks,
    ~Rob Lundeen

    yesterday in how to find which key the user presses we had a solution :
    http://www.oracle.com/technology/sample_code/products/forms/distributions/keyfilter.zip
    thx to indusvalley

  • Apple Wireless Key Board Will Not Connect (Pair)

    Well, now I am having pair problems with Apple key board.
    Have replaced the batteries and still had no effect.
    Have done everything by the book but with no luck.
    Had been working just fine until a few days ago.
    Trying to pair it with a Macbook Pro 2.66. (late June 2009).
    Trashed the com.apple.bluetooth.plist still will not pair.
    Tried: http://docs.info.apple.com/article.html?path=Mac/10.6/en/26871.html
    However this did not help.
    The mighty mouse connects with no problem.
    Now I must admit I have had nothing but on going problems since installing Snow Leopard.
    Never had any issues until Snow Leopard. Go figure.

    Just to follow up as of today the key board is now paired.
    Go figure why one day it will not work then the next day it will.
    After reading many of the comments here there must be some sort of software issue with Snow Leopard.

  • Key board problems

    Hi folks
    I switched from PC to Mac I had purchased an Imac 20’.
    Now I have a key board problem. I can't get upper case „s“ with the right shift button, neither with the left button. I need your help and I’m at a loss.
    Please solve this problem.
    Thanks in advance
    bengel2009

    Hi
    I resolved the problem.I created an new user.
    And my Key board problem dosen‘t existed .
    Thx to all

  • Can't capture key event in applet

    Hi,
    Currently i'm developing an applet. However, i fail to capture the key event in the applet. The key that i fail to capture is VK_TAB. Any idea to handle this?
    Thanks in advance!

    to capture key event, u need to
    1. addKeyListener
    2. focus on that component (yourApplet must focusable)

  • Capture key and mouse event

    Hi,
    What I want to do is..
    when users click on a item such as text item and press the 'Ctrl' key, a message will
    appear.
    How can I capture the event ?
    Thanks.
    Ivan

    Duplicate thread. Please see the other one at:
    <p>capture key and mouse event

  • Key board key can be made as event

    Hi can we make Event case for any particular key in the Key board,For example i need to do particulat event when i hit Enter key in the key board.Is it possible

    Hi Parthipan,
          The Event Structure can detect VI Keyboard events such as Key Down - see example attached.
    Cheers!
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
    Attachments:
    KeyDown.vi ‏33 KB

  • Capture Key events

    I am trying to create a program to capture key events, regardless of where the focus is. For example, any time the user presses ctrl-t, I would like to call a particular method, if the user is in Microsoft Word, Internet Explorer, Halo, or any other application. However, a glass pane would not work, because all other key events will be needed by the current application. This would be identical to Microsoft' s ctrl-alt-del and Microsoft's alt-tab. Any ideas would be greatly appriciated. Post here or E-mail be at [email protected]

    This is not true, think of all the keylogger programs out there that allow you to do this.
    It's not a security issue.
    I also am wondering how to capture a key on a java application without it having focus. An example is a timer in a game. I should be able to be in a full screen game and hit F1 or Home or whatever I choose and have a timer start that will ding at me in 1 minute to let me know that my time is up.
    It is in a way similar to CTRL ALT DEL in that you don't ahve to be focused on anything in particular to use it but that isn't really the best analogy.
    If anyone can point me in the right direction to figure out how I would go about this, please tell me. Or if it is not possible for a program written in java to capture keypress without focus I would like to know that as well.
    You can do this in C and C++ but I would like to just add it in to an existing java program, thanks.

Maybe you are looking for