Would think about using AutoHotkey doing this job, something like this could do what you like to have:
#IfWinActive PureBasic
^Del::SendInput, {Home}+{Down}+{Del}
Otherwise a PB-Tool could do such jobs for you, but as it needs some execution time to read (and rewrite) the source code file, it is just a workaround. The following example pops up a tooltip to show the procedure name of the actual cursor position and copies the cursor line text into the clipboard:
Code: Select all
;{ ShowInformation by Michael Vogel Vo.o1}
; INSTALLATION:
;
; • copy the compiled exe file into the directory "...\Purbasic\Catalogs"
; • set up the tool using "Configure Tools..." with the following parameters (from top to bottom):
;
; %COMPILEFILE\..\Catalogs\Tool ShowInfo.exe
; "%TEMPFILE" %CURSOR
; %COMPILEFILE\..
; Show I&nformation
; Menu Or Shortcut
; Alt+N
;
; [_] Wait until tool quits
; [_] Reload Source after tool has quit
; [_] into the current source
;}
; Define
#Programtitle="Show Information"
Enumeration
#CopyNothing
#CopyProcedureLine
#CopyCursorText
;
#Source
#Window
#Info
EndEnumeration
#CopyMode=#CopyCursorText; GetKeyState_(#VK_MENU)&128
If CountProgramParameters()<>2
MessageBox_(0,"'Show Information' needs two parameters!"+#CR$+"(''%TEMPFILE'' %CURSOR)","Error",#MB_ICONERROR|#MB_OK)
End
EndIf
Global SourceFile.s=ProgramParameter()
Global Zeile.s=ProgramParameter()
Global Info.s
Global Cursor.i=Val(StringField(Zeile,1,"x"))
Global Count.i
Global n
; MessageBox_(0,"Filename: "+SourceFile+#CR$+"Cursor-Position: "+Str(Cursor),"Ok",#MB_ICONINFORMATION|#MB_OK)
If OpenFile(#Source,SourceFile)
While Eof(#Source)=#Null And Cursor
Count+1
Zeile=Trim(ReadString(#Source))
If LCase(Left(Zeile,9))="procedure"
Info=StringField(Zeile,2," ")
n=Count
EndIf
Cursor-1
Wend
CloseFile(#Source)
CompilerSelect #CopyMode
CompilerCase #CopyProcedureLine
SetClipboardText(Str(n))
CompilerCase #CopyCursorText
SetClipboardText(Zeile)
CompilerEndSelect
n=Len(Info)
If n
n*6+10
GetCursorPos_(Mouse.POINT)
OpenWindow(#Window,Mouse\x+10,Mouse\y-15,n,18,#Programtitle,#PB_Window_BorderLess|#PB_Window_Invisible)
SetWindowColor(#Window,#Black)
StickyWindow(#Window,#True)
TextGadget(#Info,1,1,n-2,16," "+Info,#SS_NOPREFIX|#SS_LEFTNOWORDWRAP)
SetGadgetColor(#Info,#PB_Gadget_BackColor,#Yellow)
SetGadgetColor(#Info,#PB_Gadget_FrontColor,#Black)
HideWindow(#Window,#Null)
AddWindowTimer(#Window,#Null,250)
n=ElapsedMilliseconds()+1500
Repeat
WaitWindowEvent()
Until ElapsedMilliseconds()>n
End
EndIf
Else
MessageBox_(0,"The source code file '"+GetFilePart(SourceFile)+"' is locked!"+#CR$,"Error",#MB_ICONERROR|#MB_OK)
End
EndIf
; EndDefine