?
Solved

Making backspace act like rubout if not insert mode

Posted on 2004-09-28
7
Medium Priority
?
196 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 1000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression
Suggested Courses

649 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