SelectionChange for enter and backspace keys

Hello all,
Our VSTO addin needs to know the current selection so we can sync our taskpane with current selection. We are using the SelectionChanged event to register our taskpane synch routine. The problem is that this event doesn't fire on Enter or backspace key.
We are specifically interested in the scenarios where the Enter/backspace results in a paragraph change(para add on enter and paragraph remove on backspace of the last character in a para). It seems like a bug to me that SelectionChange wont
fire on backspace when the delete key does fires it.
Is there any other workaround to detect this paragraph change state?

Hi,
>> I am not interested in a cursor change but rather a paragraph change which would indicate a change from one para to next.
The current object model does not have an event to be triggered when changing the content.
If you want to detect the paragraph changing, we could also use a global Timer to detect the paragraph changing of the active document.
>> Multiple documents - i would have to suspend/reactivate my timer on Activate/Deactivate events
>> Multiple windows of the same document - If i have the same document open in multiple windows, split window, new window etc, how would this timer work?
Here is the sample code for your reference:
using System.Collections.Generic;
using Word = Microsoft.Office.Interop.Word;
using System.Timers;
using System.Runtime.InteropServices;
namespace WordSelectionChangeIssue
public partial class ThisAddIn
private Timer addInTimer { get; set; }
private Dictionary<string, int> ParagraphCountDict { get; set; }
private void ThisAddIn_Startup(object sender, System.EventArgs e)
addInTimer = new System.Timers.Timer();
ParagraphCountDict = new Dictionary<string, int>();
addInTimer.Interval = 1000;
addInTimer.Elapsed += TimerElapsedHandler;
addInTimer.Start();
private void BindToChange(Word.Document document)
ParagraphCountDict.Add(document.Name, document.Paragraphs.Count);
private void TimerElapsedHandler(object sender, ElapsedEventArgs e)
if(Application.Documents.Count == 0)
return;
try
var activeDocument = Application.ActiveDocument;
if (!ParagraphCountDict.ContainsKey(activeDocument.Name))
BindToChange(activeDocument);
var previousParagraphsCount = ParagraphCountDict[activeDocument.Name];
var count = activeDocument.Paragraphs.Count;
if (previousParagraphsCount != count)
ParagraphCountDict[activeDocument.Name] = count;
// trigger event
ParagraphChangeHanlder(activeDocument);
}catch(COMException comEx)
private void ParagraphChangeHanlder(Word.Document document)
System.Windows.Forms.MessageBox.Show("Paragraph Changed!");
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
addInTimer.Stop();
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
#endregion
Regards,
Jeffrey
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.

Similar Messages

  • OK_CODE For ENTER and Scroll key

    Hi,
    when ever i press ENTER button in the module pool screen i need to capture the action code for that, because i suppose to do some action.
    i need the same for scroll button also.
    Kindly help me in this .
    reg,
    Hariharan.

    Hi Hariharan.
    Pressing ENTER returns empty function code in PAI, so you can just check OK_CODE = space . This is why you need to (at the beggining of PAI) save value of OK_CODE and then clear it. It can still hold value of previous action and if you later ENTER was pressed, the value would be incorrect. Do the following:
    - create a screen, go to Element list tab type OK_CODE in empty field (column NAME) next to value OK (column TYPE).
    - in program declare corresponding data object with name OK_CODE, so the value will be transported between screen and program
    "in program
    data: ok_code like sy-ucomm. "this OK_CODE var will hold function code of triggered action on screen
    - write PBO and PAI modules in screen flow logic and corresponding ones in ABAP program
    "in screen flow logic
    PROCESS BEFORE OUTPUT.
      MODULE PBO.
    PROCESS AFTER INPUT.
      MODULE PAI.
    "in ABAP program
    MODULE PBO OUTPUT.
       "here you can set your GUI status
       SET PF-STATUS space.  "using  SPACE will set default GUI status
    ENDMODULE.
    "now in PAI
    MODULE PAI INPUT.
       "here you need to capture ok_code value in order to know what was the action
       data: save_ok like sy-ucomm. "our help var
        save_ok = ok_code. "first remeber what was triggered
        clear ok_code.    "now clear the contenet of ok_code to be able to catch ENTER action (as mentioned above)
        "now check if empty
         if save_ok = space.   "ENTER was hit
            "react here accordingly
         endif.  
    ENDMODULE.
    For more information please refer [Reading Function Codes|http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbaa1335c111d1829f0000e829fbfe/frameset.htm]
    Regards
    Marcin

  • Enter and shift keys not working. HELP!!!

    A few days ago my mouse started behaving erratically all of a sudden. It would move by itself, click apps, and switch tabs rapidly all on its own. I've had this computer for over 2 years and this has never happened before. Restarting and rebooting into safe mode didn't work, but one user suggested a PRAM reset and that fixed the mouse problem. However, my enter and shift key on the right side do not work now (this is much less annoying than the mouse problem, but still very inconvenient!). Restarting the computer and doing another PRAM reset doesn't work unfortunately. I also used the keyboard viewer to confirm that all but those two keys work. I don't think the issue is with keyboard lint because both keys worked fine before I tried the reset. Booting up in safe mode also doesn't fix the problem. It would be great if I could find a way to fix this here since I won't be able to go to an Apple genius bar until December!

    Hello sandi3s,
    The troubleshooting detailed below may help restore functionality to your MacBook Pro's keyboard.
    Some keys don't work as expected
    From the Apple menu, choose System Preferences.
    From the View menu, choose Speech.
    Click the Text to Speech tab.
    If "Speak selected text when the key is pressed" is enabled, the key or key combination set to speak text cannot be used for other purposes or used to type text--click Set Key and change it to a less-commonly used key combination (try to use modifier keys such as Shift, Command, Option, and Control). Or, disable the "Speak selected text when the key is pressed" option.
    Click the Accessibilty or Universal Access pane in System Preferences, then click the Keyboard tab.
    Make sure that Slow Keys is turned off. With Slow Keys on, you need to press a key for a longer period of time for it to be recognized.
    In the Accessibilty or Universal Access pane, click the Mouse tab, and make sure Mouse Keys is turned off. With Mouse Keys enabled, you cannot use the Numeric Keypad to enter numbers--instead the keypad moves the pointer (cursor). (There is an option to enable Mouse Keys with five presses of the Option key; you may want to turn that option off to avoid accidentally enabling it.) If Mouse Keys is enabled and you are using a keyboard with no numeric keypad or Num Lock function, see Unable to type while Mouse Keys is enabled in Mac OS X.
    If the function keys on the top row of the keyboard are not working as expected, see Mac OS X: How to change the behavior of function keys.
    If the issue persists, use Keyboard Viewer to help isolate the issue:Start from the Mac OS X Install Disc, choose Terminal from the Utilities menu and test the keys which were previously not working.  If the keys work while started from the Install disc, then the keyboard itself is working correctly.  Use How to troubleshoot a software issue to isolate the software issue that may be causing the keys to not respond.
    Click the Language & Text pane (Mac OS X v10.6) or International pane (Mac OS X v10.5.8 or earlier) in System Preferences.
    Click the Input Sources tab (or Input Menu tab in Mac OS X 10.5.8 or earlier).
    Click the Keyboard & Character Viewer "On" checkbox to select it (click the Keyboard Viewer "On" checkbox in Mac OS X 10.5.8 or earlier).
    From the Input (flag) menu, choose Show Keyboard Viewer.
    If the keyboard is connected and detected by OS X, the keys you type will highlight in the Keyboard Viewer window. Open TextEdit (or any text application), and try to type something using the keys that were previously not responding to see if they highlight in Keyboard Viewer.
    One or more keys on the keyboard do not respond
    http://support.apple.com/kb/TS1381
    Cheers,
    Allen

  • I cann't typing letter P and backspace key

    is anyone having same problem?
    i can type any letter except letter P and backspace key.
    it was work yesterday.I reseted whole system but still same....should i take thi to appl store? i stil have a warranty.......
    please tell me the solution if sombody knows...please

    Hi,
    Does the issue occur when using all applications?
    Do you see the same issue when you rotate the iPhone?
    This article: http://support.apple.com/kb/TS2802#faq5 provides tips for issues with the display not responding to touch.
    You can try restoring the iPhone and setting it up as a new phone. This would rule out issues with the iPhone software and backup.
    If you restore as new, you may want to archive the backups as mentioned in this article: http://support.apple.com/kb/HT1766
    -Jason

  • InDesign CS5 - Enter and Return keys give unexpected results

    I've been using CS5 for just a few days (Mac Pro, Mac OS X 10.6.3). I've noticed that the Enter and Return keys aren't always behaving as expected. Enter doesn't give me a column break, shift-Return doesn't give me a line break but a new paragraph, and more often than not I can't select the default option in a dialog with either Return or Enter. I've just read cpsid_84345, which says this is an issue in German and Swedish language versions, but I'm using English. The 7.01 update doesn't seem to be available. Any advice?

    That the KBSC files are XML doesn't guarantee faultless migration from one version to the next, probably because Adobe just forgot to cope with importing KBSCs from previous versions. It's great that InDesign offers you such flexibility with the KBSCs, but it's terrible that the implementation has been so sloppy in at least the three last versions (maybe earlier versions, too, but I try to repress the memories).
    Some people have been asking Adobe to make KBSCs scriptable. This would enably you to maintain a small database with KBSCs which a script could read and feed into a new version of InDesign, or redo a KBSC file after it has become corrupt, or whatever minor or major mishap.
    The more people ask for this the better: go to http://www.adobe.com/support/feature.html and request script access to the KBSCs.
    Peter

  • RETURN/ENTER and SHIFT keys no longer work, and my number keys only work as numbers - no longer do they serve as exclamation points or dollar signs etc.

    After downloading OS X Yosemite my RETURN/ENTER and SHIFT keys no longer work, and my number keys only work as numbers - no longer do they serve as exclamation points or dollar signs etc. PLEASE HELP

    Does this bad behavior persist when logging in as a different user, e.g., Guest?  Does it persist when starting up in Safe Mode?

  • Enter and tab keys no longer work

    Good morning.
    My enter and tab keys are no longer working within a text box. Could it be the result of installing "Deke Shortcuts" on my system? I never had a problem before the installation....
    Any suggestions would be welcome.
    Thank you.

    Did you try removing the shortcuts?
    I'd suggest resetting your prefes: Adobe InDesign CS4 * Setting preferences

  • Parts of keyboard dont work in CS4 (enter and arrow keys)

    Hello all... a really weird problem:
    The arrow, enter and tab keys dont work in a new installation of CS4.....
    The user cant move objects around via the keyboard arrows, and cant insert an enter or move the cursor around when editing text.
    Really weird.... but it looks like these keys are just disabled. They work OK in Microsoft Office applications. So I dont think it is they keyboard physically.
    Anyone seen this before?

    Try replacing the preferences. If it's a new install, there's probably not much to lose yet. Hold down Ctrl + Alt + Shift IMMEDIATELY after launching ID from the start menu. You have to be REALLY fast. If you don't see a confirmation dialog, try again.
    Peter

  • AR9.1 Rich Media Annotation TextInput and Backspace Key

    I've put together a test PDF see:
    http://www.amrita-cfd.org/4adobe/rich-media/shock-tube.pdf
    that shows that the backspace key does not work as expected
    for an a TextInput field in a rich-media annotation when
    viewed with Linux AR9.1; at least not with my SuSE 10.3 setup.
    There are a couple of other issues not alluded to in the test PDF:
    (i) the /Widget used to toggle the attachments pane does not work
    in fullscreen mode; (ii) the /Widget used to zoom out from
    the rich-media annotation has /Normal, /Rollover and /Down
    appearances, but only the /Normal appearance is drawn.
    James Quirk

    Hi Sandip,
    Thanks for your reply. I'm glad to hear that the backspace
    issue is being worked on and I'm guessing that you're
    also aware of a similar problem with the enter key?
    I agree that my non-Acrobat PDF might be deficient in some
    way and it's also possible that my user preferences are
    not quite right. But consider the following.
    I re-jigged the test PDF such that the /Widget whose /R
    and /D appearances were not activated now lies half on
    the rich-media SWF and half on the background page.
    Recall this is the /Widget that reads "Click to zoom out!",
    which appears when the SWF is activated.
    Interestingly, when I position the mouse over the /Widget
    half that lies off the SWF (the right-hand half) then the
    right-hand half does have its /R and /D appearances rendered.
    But the left-hand half, the part that lies over the SWF,
    is stuck with the /N appearance.
    Following this observation, I re-jigged the /Widget to
    print out the events its receives on the JS console.
    And it seems that the left-hand half of the /Widget
    is not getting /E or /X events, even though the
    mouse correctly changes shape, but it does receive
    /D, /Fo, /U and /Bl events. The right-hand half
    receives all events as normal.
    You can also try the following. Move the mouse over
    the right-hand half of the /Widget, such that an
    /E event is generated. Then move the mouse along
    the /Widget towards the left-hand half: the second
    the mouse reaches the left-hand half the /Widget
    receives an /X event.
    Therefore it looks like there is some inconsistency
    in the event model when a /Widget lies on top of
    a rich media annotation, or at least the behaviour
    I'm observing is not hinted at in the document adobe_supplement_iso32000.pdf which covers rich-media
    annotations.
    Anyhow, I'll send you the original PDF as you requested
    along with the modified one I describe above.
    Regards,
    James
    p.s. For anyone else reading this message, I've posted
    the modified PDF at:
    http://www.amrita-cfd.org/4adobe/rich-media/shock-tube-v2.pdf

  • IPhone and iPad Built in Delete key and backspace key.

    iPhone and iPad should have built in Delete key besides the backspace key. Due to screen with virtual default keyboard and big finger, it is difficult to position the cursor accurately.  A delete key should be made available to improve productivity.

    First of all, you cannot delete those backup files.  All those files are needed in the event of a "Restore from Backup" is required.  Everytime you do a backup, itunes only update those files with changes made on the phone or iPad only from the last backup. If there are no new changes to certain contents or media, the files will remain untouched in the folder.  This is the reason why you have some files dated as back as one year ago.  Now, even if you have deleted some of those files, a new backup will add those files back during the process.
    As for changing the Default location of the backup folder, you may refer to this link but do at your own risk:
    http://www.hanselman.com/blog/HowToChangeTheLocationOfYourIPhoneBackupAndITunesM obileSyncBackupFolder.aspx

  • Add functionality for enter and close in a dialogue window

    Hi
    I have a dialogue screen.
    On pressing enter or the enter icon I need some functionality.
    And on clicking the close icon or close(on the dialogue window) i need to exit.
    How to add functionality to close and enter?
    (The icons are functioning properly but Enter and close are not functioning)
    Here is the code i have used
    gv_save = gv_code.
    CLEAR gv_code.
    CASE gv_save.
    WHEN 'OK' OR 'ENTER'.
    PERFORM char_convert.
    LOOP AT object_tab WHERE selected = 'X'.
    UPDATE imptt SET pyear = gv_exponent
    WHERE point = object_tab-point.
    ENDLOOP.
    LEAVE TO SCREEN 0.
    CLEAR gv_annual.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_1001 INPUT
    MODULE cancel INPUT.
    gv_save = gv_code.
    CLEAR gv_code.
    CASE gv_save.
    WHEN 'CANCEL'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    Please help me .
    Best regards,
    Kranthi

    You need to take ABAP help and build logic, so that If so & so condition pick LOGO1
    and for so & so Condition LOGO2 & for rest LOGO3.
    You need to incoroporate the Logic in your program for Script / Smartform.

  • Custom functionality for home and end keys?

    I don't know anything about automate, but I was wondering if it's possible to do this:
    I'm a former PC user and on PCs you could use the 'home' and 'end' keys to go to the beginning and end of one line (subsequently, you could hold shift + home/end to highlight from your current cursor position to the beginning or end of a line). This functionality is extremely helpful for text editing and programming. Luckily the versions of Word and Dreamweaver I have on mac do use this, but TextEdit, Flash, and others do not. Is there anyway to program this kind of functionality? And if so how? And why is basic functionality like this different program to program on macs? PC's were at least consistent. Thanks!

    The Command and Option shortcuts will take some getting used to, but that will work. Thanks! an external text editor would be okay for some things, but not Flash ActionScripting within a flash file.
    I just wish some of the more basic functions between mac and pc were the same. I think both platforms would have an easier time getting users to switch if they were a little more consistent and took some of the good features of each into consideration.

  • Apple Wireless Keyboard and annoyance with fn and backspace key

    Hi everybody,
    Just took delivery of this beautiful Apple Wireless Keyboard but having only one problem with it. I've figured out how in System Preferences/Keyboard & Mouse/Keyboard it's possible to check the box which allows the F1, F2, etc. keys as standard function keys but when it's checked I also have to use the fn key to make the Backspace key work like a normal backspace. If I don't use the fn key the Backspace key will eat any type in front of the curser instead of backing up and eating the type behind it. Why is this..? I mean the Backspace Key isn't even on the same row as all the F keys are so why am I having to use the fn key to change the function of the Backspace key..? Actually it would be nicer if the function of with or without the fn key was reversed. Anyone know how I can change that..?
    paul

    Ahhh forget it..
    I realized having that option checked made other keys do screwy things as well unless I used the fn key with them so I've gone back to using the fn key only when I need to use the F keys..

  • Urgent please: Master-Deatils OAF Page for enter and Update data

    Hi all,
    i need your help to build master-details oaf page for Enter / Update data
    for example: We have Locations , Department , Employees tables
    all these tables on one oaf page (OAAdvancedTable)
    when user enter New Location and go to Enter it's Departments and for each department, he can Enter they employees.
    and Regarding to Update date:
    - when user select Location , Department table fetch all departments and user can update
    waiting your support for urgent please
    Regards
    Hany

    i do these Steps :
    1- Create LocationEO,DepartmentEO and EmployeesEO
    2- Create Association between LocationEO and DepartmentEO with one-to-Many relation (LocToDeptAO)
    3- Create Association between DepartmentEO and EmployeesEO with one-to-Many relation (DeptToEmpAO)
    4- Create View Object (LocationVO)
    5- Create DepartmentVO (and add LocationEO due to LocToDeptAO)
    6- Create EmployeesVO (and add DepartmentEO due to DeptToEmpAO)
    7- Creare View Link between LocationVO and DepartmentVO (Based On LocToDeptAO) --> LocToDeptVL
    8- Creare View Link between DepartmentVO and EmployeesVO (Based On DeptToEmpAO)---> DeptToEmpVL
    9- Add LocaionVO to Application Module, then add DepartmentVO Via (LocToDeptVL)
    10-Add EmployeesVO to Application Module Via (DeptToEmpVL)
    and Then Run Test AM, all data fetch sucessfully, and i can insert data with proper relations
    NOw, i want to implement this Business Logic in single oaf Page using 3 OAAdvancedTable (Master - Details -Details )
    Regards

  • Command L for entering and viewing website addresses.

    The Command L  command opens the box for entering web addresses and Google searches.
    The box for entering Google searches and web addresses no longer opens when I open a safari page.
    I cannot find any useful information on this problem in the Safari preferences?
    Any suggestions?
    (Imac, OS10.7.5, Safari 6.1.4)

    Safari -> View -> Customize Toolbar...

Maybe you are looking for

  • How to customize the table layout in WAD (BI70)

    hi experts, i want to customize the table layout in WAD. in 3.5, i can set the table interface class,and use T_Code se24. but now i am using BI7.0, there is no table interface, so how can i customize the table layout?

  • Error in GR/IR - Tax relevancy

    We are implementing SAP ECC6 in a country where there is no tax.  But during the settings, settings requires to assign a tax procedure and for posting certain accounts like GR/IR clearing, tax relevant setting is required as a mandatory from the syst

  • Sorting Problem in XML Publisher Report

    Dear Members, I am facing problems with sorting data in my XML Publisher Report. We are using Oracle E-Business Suite 12.1 Version and i developed a rtf Template and executable is an RDF which generates XML Data. I want the whole report to group by e

  • Cannot install or uninstall Adobe AIR, or install NY Times Reader

    Runnning Window s 7 Pro.  When trying to install Adobe AIR, or to uninstall the current version 2.5. 1, or to install an app that uses Adobe AIR, get message "This application requires a vers ion of Adobe AIR which cannot be found".

  • BOR - fill buffer variables

    Hello! Is there any FM or class which I can use to fill all buffer variables of a specified business object (perhaps by using the BOR-key as importing parameter)? The implementation of a BOR-method requires the values in the buffer variables in order