search plugin for auto-indent

Working on new editor enhancements?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

search plugin for auto-indent

Post by eddy »

hi,

I tried to code an auto-indent functionality but I don't know how to catch event from external app.

My idea was to replace callback...

Code: Select all

sci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
pb = Val(GetEnvironmentVariable("PB_TOOL_MainWindow"))
oldproc = SetWindowLong_(sci, #GWL_WNDPROC, @ScintillaWindowCallback()) 

Code: Select all

Procedure ScintillaWindowCallback(hWnd.l, Message.l, wParam.l, lParam.l)
    result.l = 0
    Select Message
        Case #WM_NOTIFY
            *lpnmhdr.NMHDR = lParam
            *notify.SCNotification = lParam
            Select *lpnmhdr\code
                Case #SCN_CHARADDED
                ;....
                Case #SCN_STYLENEEDED
                ;....
            EndSelect
        Default
            result = CallWindowProc_(oldproc, hWnd, Msg, wParam, lParam)
    EndSelect
    ProcedureReturn result
EndProcedure 
... no result for the moment
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

not really...
I want to indent code without using file.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Your approach isn't going to yield results:
MSDN wrote:Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process.
If I were trying to accomplish your goal I'd consider installing a number of keyboard hooks and sending scintilla messages based on the various keypresses. In any case, you won't be able to read the IDE's message queue as it isn't owned by your process.
BERESHEIT
Post Reply