Insert / Overtype mode

Just starting out? Need help? Post your questions and find answers here.
RobertRioja
User
User
Posts: 88
Joined: Thu May 02, 2019 3:57 am
Location: USA
Contact:

Insert / Overtype mode

Post by RobertRioja »

Is there a way to control the Insert / Overtype mode of the keyboard programmatically?
Axolotl
Addict
Addict
Posts: 899
Joined: Wed Dec 31, 2008 3:36 pm

Re: Insert / Overtype mode

Post by Axolotl »

This mode information is probably not stored/configurable in the keyboard.
I looked for an explanation in the Scintilla documentation, as there is a section on overriding.
To my knowledge, the mode is stored in the text control.
OverType (borrowed from Scintiall Doc)
SCI_SETOVERTYPE(bool overType)
SCI_GETOVERTYPE → bool
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
RobertRioja
User
User
Posts: 88
Joined: Thu May 02, 2019 3:57 am
Location: USA
Contact:

Re: Insert / Overtype mode

Post by RobertRioja »

I also cannot find any way to control the Insert / Overwrite modes. It seems strange that something like this cannot be controlled by software. I guess if anyone figures it out, they could become rich !!!
Thanks for trying anyway.
interfind
User
User
Posts: 27
Joined: Thu Apr 22, 2021 1:41 pm

Re: Insert / Overtype mode

Post by interfind »

This is working for me:

Code: Select all

;Send Insert-Key to Notepad
#INPUT_KEYBOARD         = 1
#KEYEVENTF_KEYUP        = $0002
#KEYEVENTF_SCANCODE     = $0008
#SC_INSERT              = $52   ; Hardware-Scancode

Define input.INPUT

;Send Insert-Key DOWN
input\type = #INPUT_KEYBOARD
input\ki\wVk = 0
input\ki\wScan = #SC_INSERT
input\ki\dwFlags = #KEYEVENTF_SCANCODE

mywnd = FindWindow_("Notepad", NULL)
If mywnd=0
  RunProgram("notepad.exe")
  Delay(500)
  mywnd = FindWindow_("Notepad", NULL)
EndIf

If mywnd
  SetForegroundWindow_(mywnd)
  ;ShowWindow_(mywnd, #SW_SHOW)  
EndIf

SendInput_(1, @input, SizeOf(INPUT))

;Send Insert-Key UP
input\ki\dwFlags = #KEYEVENTF_SCANCODE | #KEYEVENTF_KEYUP
SendInput_(1, @input, SizeOf(INPUT))
Post Reply