I wrote a small tool which shows all source code marker and added the functionality to remove a marker by invoking Ctrl+F2 from this tool. Anyhow I was not able to do this without activating the IDE window which is not perfect. Any ideas if it is possible to do the same while keeping the IDE window in the background?
; hwnd = ... ; handle of the IDE Window
; use of SendMessage_() or PostMessage_() and Delay() ??
PostMessage_(hwnd, #WM_KEYDOWN, #VK_CONTROL, #Null) ; lParam probably needs some attention
PostMessage_(hwnd, #WM_KEYDOWN, #VK_F2, #Null) ; -"-
PostMessage_(hwnd, #WM_KEYUP, #VK_CONTROL, #Null) ; -"-
; Borrowed from MSDN.... WM_KEYDOWN
; lParam
; The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.
;
; Bits Meaning
; 0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
; 16-23 The scan code. The value depends on the OEM.
; 24 Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
; 25-28 Reserved; do not use.
; 29 The context code. The value is always 0 for a WM_KEYDOWN message.
; 30 The previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
; 31 The transition state. The value is always 0 For a WM_KEYDOWN message.
Remarks: I guess success depends on how PB-IDE handles key presses.
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).
Did not work without the code around it (AttachThreadInput) seen in the snippet above - played around for a while and I fear it isn't possible to do that without a short flicker while the window is active...
One of the following lines have to be used as well to work...
- SetFocus_(Ide\HandleIde) - ok
- SetActiveWindow_(Ide\HandleIde) - ok
- SetForegroundWindow_(Ide\HandleIde) - ok
- PostMessage_(Ide\HandleIde,#WM_SETFOCUS,0,0) - does not work
That's too bad. Another idea...
Work with the Scintilla Control and the Markers defined by PB....
You need to 'borrow' the functions from the IDE (github)
The implementation in the IDE is in the following files.
; Common.pb
; #MARKER_Marker = 22 ; line markers
;
; ScintillaHighlighting.pb
; Procedure AddMarker()
; Procedure ClearMarkers()
; Procedure MarkerJump()
; Procedure.s GetMarkerString() ; get a list of all markers as a string
; Procedure ApplyMarkerString(Markers$) ; apply a string of marker numbers to the file
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).