B1DE / KeyDown Event  ...

I have a problem with an addon i'm developing  .. I have a matrix on a screen for which i'm trying to capture a KeyDown event (actually the 'Del' key but it seems to happen with all keys) ..
I attach an item listener to my matrix as shown below ..
  [B1Listener(BoEventTypes.et_ITEM_PRESSED, true)]
        public virtual bool OnBeforeItemPressed(ItemEvent pVal) {
            Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            Item item = form.Items.Item("mtx_0");
            Matrix matrix = ((Matrix)(item.Specific));
            // ADD YOUR ACTION CODE HERE ...
            B1Connections.theAppl.MessageBox("Key Pressed", 0, "Ok", null, null);
            return true;
I notice there is no KeyDown event so i assume the ItemPressed event can be used .. Is this correct  ?
Also in my main add on I have ..
// ADD YOUR INITIALIZATION CODE HERE     ...
            EventFilters filters = B1Connections.theAppl.GetFilter();
            //  BoEventTypes.
            EventFilter filter = filters.Add(BoEventTypes.et_KEY_DOWN);
            filter.AddEx("MyAddonScreen");
... to enable global trapping of keydown by my addon ..
Any help gratefully received  ..

Thanks David  ..
In that case B1DE doesn't expose a KeyDown Event  .. So I assume that I must create a separate
key down event handler in my main addon code  .. maybe like  ..
// ADD YOUR INITIALIZATION CODE HERE     ...
            EventFilters filters = B1Connections.theAppl.GetFilter();
            //  BoEventTypes.
            EventFilter filter = filters.Add(BoEventTypes.et_KEY_DOWN);
            filter.AddEx("MyAddonScreen");
           B1Connections.theAppl.ItemEvent += new _IApplicationEvents_ItemEventEventHandler(theAppl_ItemEventHandler);
.. and then an event handler ..
private void theAppl_ItemEventHandler(string formUID, ref SAPbouiCOM.ItemEvent pval, out bool BubbleEvent)
            BubbleEvent = true;
            Form form = B1Connections.theAppl.Forms.Item(formUID);
            if(form.TypeEx.Equals("MyAddonScreen"))
                B1Connections.theAppl.MessageBox("The ItemEvent has been trapped ", 1, "Ok", "", "");
Is this the correct best practice ?

Similar Messages

  • Best practice for responding to keyDown event

    I am writing my first Cocoa application.  It's a simple utility app -- a calculator.  I've got everything working, the last thing I want to add is I want the app to respond to key press events.  So, you could click the "4" button with the mouse, or you could just press the "4" key on the keyboard.  I'm reading all the event handling documentation, but I'm not picking up on the recommended approach for getting an NSResponder (or NSView) that handles the event.
    I can make a subclass of NSWindow and tell the interface builder to make the main window of that type.  Then when I override the keyDown message in my new NSWindow subclass, it gets the events, but I'm not sure how to connect it to my application delegate class (since I basically just want to switch on the key pressed and call the corresponding message in the delegate that the button "select" action targets.
    Or, I think I heard something about doing this by changing the super class of the application delegate class from NSObject to NSView, or NSResponder or something.  I haven't poked at that idea much, but I'm not sure how to actually get the application delegate object then actually set up as the first responder (I think that's what I'd want to do).
    So, I'm hoping someone can give me specific directions on how/where I should implement my keyDown method, but I'd also like to understand what the recommended "best practice" is for doing this.  What would Apple say is the right architecture for doing this?  I'm as much interested in learning how to make this work as learning the Apple design pattern behind it.
    The structure of my program is as follows:
    I have one nib file (actualy a .xib) where I've designed my window with a textbox for display and a hand-ful of buttons.  I've registered outlets and actions from there to the AppDelegate class (the one that the standard project template sets up for you).  Following the MVC pattern, I then have a Calculator class that the AppDelegate initializes and all the actual logic of the calculator is in that class.  The AppDelegate basically just responds to messages from the buttons, passes them along to methods in the Calculator class, and then asks the Calculator for the current display value and updates that back into the textbox. So, the graphical elements in my nib file are the "view", the AppDelegate is the "controler" and the Calculator class is the "model".  Right? 
    So, who is supposed to be handling keyDown events?   Seems like the view should capture them and send them to the controller, but how do I set that up?

    Dear Noppong,
    You can do it with multiple ways like :-
    1. Get the current host name and make complete URL with using host name for the webdynpro iview.
    request = (IPortalComponentRequest) this.getRequest();
    HttpServletRequest req = request.getServletRequest();
    StringBuffer strURL = req.getRequestURL();
    2. Create the KM Document or Link for webdynpro Iview OR Create the WPC Web Page for the webdynpro ivew
    Refer to [http://help.sap.com/saphelp_nw70/helpdata/en/06/4776399abf4b73945acb8fb4f41473/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/06/4776399abf4b73945acb8fb4f41473/frameset.htm]
    [http://help.sap.com/saphelp_nw70/helpdata/en/06/4776399abf4b73945acb8fb4f41473/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/06/4776399abf4b73945acb8fb4f41473/frameset.htm]
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/ff/681a4138a147cbabc3c76bde4dcdbd/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/ff/681a4138a147cbabc3c76bde4dcdbd/content.htm]
    Hope it will helps
    Best Regards
    Arun Jaiswal

  • Arrow key in the keydown event

    Hello,
    I used the keydown event to display the characters on the Screen depending on the key which is pressed,
    but if I press arrow keys and want to display "x" on the extreme right side of the characters for example :
    abcsdex
    here x is displayed when left arrow key is pressed. I tried it but x is not displayed where I want it is displayed on the extreme left of the characters or in between the characters.
    Thank you.

    I used the keydown event to display the characters on
    the Screen depending on the key which is pressed,
    but if I press arrow keys and want to display "x" on
    the extreme right side of the characters for example
    abcsdex
    here x is displayed when left arrow key is
    pressed. I tried it but x is not displayed where
    I want it is displayed on the extreme left of the
    characters or in between the characters.
    Thank you.write a KeyPressed event.get a ASCII value of the key you want to press.Then append the ASCII value of that pressed key to the current string in your desired position.First store the current string to a String variable.

  • Backspace not detected as KeyDown Event

    Hi
    I'm trying to determine if the back space is pressed on my WPF. And I'm getting no where!
    My code (which is the event handler for the KeyDown event for a textbox)
    private void CompanyName_KeyDown(object sender, KeyEventArgs e)
    MessageBox.Show(e.Key.ToString());
    If I press a number, return (enter), letter or even a function key (F2, F3 etc) it works. But, delete, backspace and spacebar do not cause the event to fire.
    Any idea why?
    Dave

    Hey DaveRook, I hope you're fine.
    I believe you may check the following approach:
    if (Keyboard.IsKeyDown(Key.Back)) //Also "Key.Delete" is available.
    //Your code goes here..
    Please, mark my reply as Answer if it helps or vote it up if it gives a key to the solution.
    Thanks in advance and good luck.
    Ahmed M. Gamil
    "It is not titles that honor men, but men that honor titles."

  • Keydown events in subpanel

    I have read some other posts about this sort of problem, but the solutions offered there have not worked for me.  What I want to happen is the VI in the subpanel should respond to keydown events.  Everything I have tried to get this to happen has been intermittent at best.  What usually happens is that a mouse click on any control or indicator in the subpaneled VI will then cause all keydown events to work on the VI as I wish, but you have to do that initial mouse click first.  Does anyone know how to get a VI in a subpanel to respond to keydown events as soon as the VI starts running in the subpanel without any other interaction in the subpanel first?  Assigning keyfocus and registering for events are the general suggestions in other threads about this sort of situation, but none of that has worked for me in the desired fashion.  I am using LV 8.0.1 on WinXP if any of that matters.

    OK, the basement flood is fixed for now, and the deadline was met on Friday.  Here is a little demo of the problem.  The basic idea is that the subpanel will be used for several different little recipe guides like the one included.  Other things in the code could require bailing out of the recipe, so there is a global to force an early exit, but normally you would exit when the last step in the recipe finished.  The code does things based on where the user is in the recipe, so waiting for the user to press any key is the way the code knows when to do the next step.  I want the user to have to do nothing extra to get the keydown to work right from the beginning.
    Attachments:
    testsubpanel.llb ‏67 KB

  • Ctrl-v key combo not working in keydown event in Adobe Air

    I am needing to capture the ctrl-c/ctrl-x/ctrl-v keys in the keydown Javascript event from within Adobe Air.
    I have managed to get the events to fire correctly.
    When I press ctrl, c, x, v, ctrl-c and ctrl-x, I get the correct corresponding keycodes. However, when I press ctrl-v, no event gets triggered.
    Is Air preventing the key presses from reaching this event in the case of ctrl-v?
    Here is the code I am using:
        document.getElementById('main_grid').addEventListener('keydown', keyDownEvent, false);
        keyDownEvent = function(e) {
            alert(e.keyCode);

    I'm surprised you get ctrl-c and ctrl-x. Do they work when you have selected text? What is probably happening is the default handler for the paste event is "swallowing" the keystroke. You could try listening for the paste event and calling the event object's preventDefault() method. (I haven't tried it, though, so I'm not positive that would allow the keystroke to be passed along.) If you are trying to create your own copy/paste functions, you might be better off listening for the copy and paste events themselves, rather than the raw keystrokes.
    Another alternative is to listen for the keystrokes on window.htmlLoader, which should get the keystrokes before they are passed to the HTML engine.

  • B1DE / CFL / Event Handling  ..

    Had problems with CFL's in an application i'm developing so i've created a real simple demo of my problem in the hope someone can help me ..
    In the sample i have a simple screen designed with the painter with a static text field, an edit box and a button . In the .srf  I have defined a CFL with multi selection =  false, object type=2 and a unique ID = 'CFL_1'  and i have attached it to the button via within the .srf .
    I then have a simple before / after event handlers attached to my button to catch the before/after choose from list events 
    When i push the button the before event fires and my little message is displayed (correctly) .  The event returns true (bubbleevent ..) BUT no list appears and no after event is fired .. The routine is trivial but i can't see any reason for the non appearance of my list .. Can anyone shed any light on my problem ?  I'm on SAP2007A PL 15 and using B1DE to generate my initial app (using C#) .. I've tried generating the code inline (creating CFL in code) and attaching it to the button but the result is the same - before event fires and no list ...   If i run one of the SDK examples (ChooseFromLists) which uses this list then it runs without problem ..  I've been on with this for a couple of days now and it's really frustrating ..  I've added the event handlers - but these are essentially the vanilla ones generated by B1DE. Is it anything to do with how B1DE registers the event handlers ?
    public Button__CFL1__btLookup() {
                FormType = "CFL1";
                ItemUID = "btLookup";
            [B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, true)]
            public virtual bool OnBeforeChooseFromList(ItemEvent pVal) {
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("btLookup");
                Button button = ((Button)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                B1Connections.theAppl.MessageBox("Choose from list button (before) ", 0, "Ok", null, null);
                return true;
            [B1Listener(BoEventTypes.et_CHOOSE_FROM_LIST, false)]
            public virtual void OnAfterChooseFromList(ItemEvent pVal) {
                bool ActionSuccess = pVal.ActionSuccess;
                Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
                Item item = form.Items.Item("btLookup");
                Button button = ((Button)(item.Specific));
                // ADD YOUR ACTION CODE HERE ...
                B1Connections.theAppl.MessageBox("Choose from list button (after) ", 0, "Ok", null, null);
    " Help me Obi Wan  .. you're my only hope  ... "
    Thanks

    Hi Noor , I think i found my problem  .. I created this using the screen painter in PL 7  .. I created a similar screen by hand , saved both and compare XML  .. Screen painter added a 'MODE=0' tag  , manual one created using parameters had 'Mode='1' .. Changed mode on screen painter code to mode='1' and everything worked !  .. Couldn't  see anywhere on screen painter how to explicitly set this keyword , only ones saying -1 represents all modes .. Anyway , thanks again for you interest  and contributions  .

  • Firing keydown event from software`

    I would like to know how to fire a keydown or mousedown etc. event from the program itself. Without actually pressing the keys or buttons.
    Something to do with dynamic event programming?

    Dynamic events are one of the best features added to LV 7.0 and have saved me a few times.  The idea is that you can add events which an event handeler can register for the only thing you have to do it decide on the parameters which define the event. basically you craete a user event, register for the event, pass the event to the dynamic event terimina (right click on the event structure and "show dynamic event terminal" then add the event case just as you do with a native event.  In addition you can turn on and off the dynamic events as needed.  I will post an example I did later if it would help.  Spent the time to learn dynamic events, well worth the effort.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • VI Keydown event interferes with menu selection

    My application requires that the user log a data point with a spacebar pressed. To do this, I want to use the Key Down event at the VI level. However, I find that when I include this event it disables the keyboard's Alt- menu selection, even though I'm passing all the parameters through KeyDown unchanged. I've included a skeleton VI that exhibits this behaviour. Has anyone else run into/overcome this problem?
    Thanks,
    David Moerman
    Advanced Measurements Inc
    www.advmeas.com
    Attachments:
    VI_KeyDown_vs_MenuSelect.vi ‏41 KB

    Instead of using keydown, use keyup. I have written the attached VI to decode the scancodes on my computer so that one can tell what key was pressed. Unlike with keydown, this method allows the alt-keys of the window to work and it will indicate a larger number of keys.
    Jeremy Braden
    National Instruments
    Attachments:
    Decode_scancodes_into_ascii.vi ‏487 KB

  • Catch KeyDown events for modifier keys

    I need to be able to tell when a user presses or releases the CTRL key for my application, but I can't get KeyListeners to work and the key bindings only appear to work with releasing the key. I also have key bindings for CTRL key combinations (like CTRL-N, CTRL-S, etc.), but I need an event which is fired when the user first presses the CTRL key. The goal is to have a tooltip on my custom JPanel which pops up when I press CTRL and goes away when I release it.
    My (broken) key binding code:
    JPanel main=new JPanel();
    InputMap im=main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(KeyStroke.getKeyStroke("pressed CONTROL"), "cDown");
    im.put(KeyStroke.getKeyStroke("released CONTROL"), "cUp");
    main.getActionMap().put("cDown",new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            isCtrlDown=true;
            updateTooltip();
            System.out.println("down");
    main.getActionMap().put("cUp",new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            isCtrlDown=false;
            updateTooltip();
            System.out.println("up");
    });If you press the control key a few times over this component, you only get "up" printed.

    Hi BaconOppenheim,
    Could you let me know which locale/input source you're using? I've run through some tests with the configuration you mentioned and I'm not seeing a problem. There is an issue with Ctrl+Click as that triggers a right click on Mac but the Alt key is certainly working on mouse events.
    Could you send a screen shot of the test extension output after running:
    1. Click + Shift key down
    2. Click + Alt key down
    3. Click + Cmd key down
    4. Click + Shift key + Alt key + Cmd key down
    That should cover the cases and show me the exact results.
    Thanks,
    Greg

  • How can I stop an event structure detecting keydown events until the vi has initialised?

    My application has a sequence structure with 3 frames. First one initialises some front pane objects and controls, the second communicates with an external device via a serial port to a start condition and waits for this to complete by polling the device. The third contains the event structure which reads the device when the spacebar is pressed. The problem is that any pressing of the spacebar when the application is in the first 2 frames of the secquence structure is stored and executed as soon as the third frame becomes active. I have tried using dynamic Event registration but to no avail. Am I doing something wrong? can the keyboard be disabled until the second frame complete
    s?

    I usually avoid sequence structures in favor of driving execution order through data dependency (error clusters are great for that). However, since you've already got one, you coul try to add another frame right before your event structure. In that frame, place another event structure that can trap that stray keyboard event. Put a tiny timeout value on it so it doesn't appear to "pause" your VI's response. That event structure will catch any bogus key presses that happen during initialization.
    Having said all that, I still think the behavior is not proper. The event should not be handled if it happened before your VI gets to the event structure. For now, you can try that workaround.
    Daniel L. Press
    PrimeTest Corp.
    www.primetest.com

  • Catch the keydown event in matrix

    Dear all,
    In matrix I have 2 cols (Code, FullName). In Col with name 'Code' have formated search to search Employee Code. Now i want to catch the tab key when user leave the col 'Code' I will call a function to get Fullname to assign to col 'FullName'. I tried use formated search for this case but inactive so I must use this solution.
    Please help me for this problem.
    Thanks

    Hi,
    You can trap the Validate event on your form and then filter to check if the item UID is your matrix and the column is your code column. If the ItemChanged property is true then run your code to retrieve the name and populate the other column for the current row.
    Kind Regards,
    Owen

  • Change keys in keyDown event

    Hi, I want to create a new TextInput, that changes then keys
    while typing, lets say:
    when I type "A", shows "B"
    when I type "X", shows "Z"
    or something like that.
    I can´t do this to work..
    Thanks.

    It's not precisely what you asked for, but I'm sure you'll
    get the idea.
    Use this code in an actionscript class called
    components/KeyModifier.as
    Add the code to your app with <components:KeyModifier/>
    Be sure to add xmlns:components="components.*" to your parent
    component's tag.

  • KeyDown Space Event in C#

    I have one textbox in that whe I write word in English it will convert to Hindi.
    Now when the user presses space "the English Word" that the user has written will convert to
    Hindi Word.
    I am using KeyDown Event.
    Now when the user presses space each time after writing English word it should convert to Hindi 
    Like this::http://manish4dotnet.blogspot.in/2013/05/aspnet-create-hindi-textbox-using.html
    In that  see Live Demo and see how the word changes after the userpress space
    I have writted code for Transliration.
    Now I want for space 
            private void spacepressed(object sender, KeyEventArgs e)
                if (e.Key == Key.Space||e.Key==Key.Enter)
                    if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
                        var w = new WebClient();
                        w.DownloadStringCompleted += (s, e1) =>
                                //MessageBox.Show(e1.Result + ""); //to get parse result
                                var a = JArray.Parse(e1.Result);
                              //  var o = (JObject)a[]; // to parse the "Amitabh"
                                //var o= (JObject)a[1]; // to parse the "Blog"
                                int i=0;
                                //MessageBox.Show(o["hws"] + "");   // to get "Amitabh" array   
                                foreach(var o in a)
                                txt_Amitabh.Text = o["hws"][0] + " ";
                                //    StreamResourceInfo sri = Application.GetResourceStream(new Uri("transliterate_mine;component/Fonts/aparaj.ttf", UriKind.RelativeOrAbsolute));
                                //     txt_Amitabh.FontSource = new System.Windows.Documents.FontSource(sri.Stream);
                                //   txt_Amitabh.FontFamily = new FontFamily("Aparajita");
                        w.DownloadStringAsync(new Uri(string.Format("http://www.google.com/transliterate/indic?tlqt=1&langpair=en|hi&text={0}&&tl_app=1",txt_Amitabh.Text)));

    Hi,
    Please ask for a specific issue regarding the C# programming language, IDE, libraries, samples, and tools. For a function or an application, it is beyond of our supported.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Compatibility of events API with Latest JPI1.4

    Hi,
    We have a Java applet written with mostly Jdk1.0 ... which works fine with
    native JVM's of netscape 4.75 and IE5.5 browsers.
    But when I use latest JPI1.4 and above, I find the conetent on the screen is not fully coming up unless the mouse move is done on that .
    When I build/compile it, I get the following warnings
    Can someone suggest is this deprecated API's that is causing the problems when we execute applets with the latest JPI.
    What can be the workaround ???
    warning: addItem(java.lang.String) in java.awt.List h
    as been deprecated
    loa.addItem(cs);
    ^
    warning: delItem(int) in java.awt.List has been deprecated
    list1.delItem(ind2[i]-i);
    ^
    warning: delItem(int) in java.awt.List has been deprecated
    list1.delItem(ind);
    ^
    ^
    warning: mouseUp(java.awt.Event,int,int) in java.awt.Compo
    nent has been deprecated
    public boolean mouseUp(Event ev, int x, int y) {
    ^
    warning: mouseDown(java.awt.Event,int,int) in java.awt.Com
    ponent has been deprecated
    public boolean mouseDown(Event ev, int x, int y) {
    ^
    warning: mouseDrag(java.awt.Event,int,int) in java.awt.Com
    ponent has been deprecated
    public boolean mouseDrag(Event ev, int x, int y) {
    ^
    warning: keyDown(java.awt.Event,int) in java.awt.Component
    has been deprecated
    public boolean keyDown(Event ev, int key) {
    ^
    warning: keyDown(java.awt.Event,int) in java.awt.Component
    has been deprecated
    return super.keyDown(ev, key);
    ^
    warning: mouseEnter(java.awt.Event,int,int) in java.awt.Co
    mponent has been deprecated
    mouseEnter(ev, ev.x, ev.y);
    ^
    warning: mouseExit(java.awt.Event,int,int) in java.awt.Com
    ponent has been deprecated
    mouseExit(ev, ev.x, ev.y);
    ^
    ^
    warning: getPeer() in java.awt.Component has been depreca
    ted
    return getPeer() != null;
    ^
    warning: encode(java.lang.String) in java.net.URLEncoder
    has been deprecated
    warning: encode(java.lang.String) in java.net.URLEncoder
    has been deprecated
    urlst += ("&" + fid + "=" + URLEncoder.encode(getFieldVal(row, f
    id)));

    Hello Mike,
    Please refer to this article 1794398 - Forward Fit Plan: Which patches are included in each
    Support Pack for Business Intelligence (BI)
    Cheers,
    Fadoua

Maybe you are looking for