Solved

Making backspace act like rubout if not insert mode

Posted on 2004-09-28
7
193 Views
Last Modified: 2013-11-13
Using Developer Studio to edit C files, I want backspace to act like this:
1) if currently in "insert mode", I want backspace to act like it does ... i.e., to move characters to the left as it deletes the previous character
2) if currently in "overlay mode", I want backspace to move one character left and replace the character with a blank
0
Comment
Question by:ESQuicksall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 250 total points
ID: 12169620
This macro should do it - though the name could probably be better.
----------------------------------------------------------
Sub MyBS()
'DESCRIPTION: A description was not provided.


  if ( Application.TextEditor.OverType = True ) Then
'Begin Recording
      ActiveDocument.Selection.BackSpace
      ActiveDocument.Selection = " "
      ActiveDocument.Selection.CharLeft
'End Recording
  Else
    ActiveDocument.Selection.BackSpace
  End If
End Sub
0
 

Author Comment

by:ESQuicksall
ID: 12179259
That did it. Thanks.

Now, I would like to assign it to the backspace key but Developer Studio won't let me assign the backspace key (probably because that is used to backspace within the "Press New shortcut key" box). Is there an override or some other place I can reference to set this key?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12180787
Not sure.  You can do Shift+Backspace for sure.  I don't know where the key binding is stored.  You might be able to go there and edit it manually.  I'll look for it when I get a chance.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ESQuicksall
ID: 12183240
BTW, can you tell me how to check the character at the curser regardless of if there is a Selection or not?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12191388
Seems more complicated than necessary, but I don't see another way:

    l = Len(ActiveDocument.Selection)
    ActiveDocument.Selection.CharRight dsExtend
    If Len(ActiveDocument.Selection) > l Then
        c = Right(ActiveDocument.Selection,1)
        ActiveDocument.Selection.CharLeft dsExtend
    Else
        ActiveDocument.Selection.CharLeft dsExtend
        c = Left(ActiveDocument.Selection,1)
    End If
0
 

Author Comment

by:ESQuicksall
ID: 12191479
I assume a macro can only operate on a selection. I am having trouble finding the documentation on "Right" and all the other functions like that that may be available to me. Can you give me an idea as to how I would find that documentation? i.e., is this code simply Visual Basic or is it a Developer Studio unique code set?
0
 
LVL 19

Expert Comment

by:drichards
ID: 12191782
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question