Solved

Making backspace act like rubout if not insert mode

Posted on 2004-09-28
7
194 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
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!

 

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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 …
Introduction to Processes

724 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