IDE / Scintilla - active tab
IDE / Scintilla - active tab
Hi guys,
I have written myself an Include Browser which, when started as an IDE tool, determines all includes in the complete project (also within the includes).
I can now search through all files using a search function.
Now I want to display the found location in the IDE and I can't get any further.
I use RunProgram() to load the file into the IDE. How can I now
determine which ID Scintilla has in the currently open tab? So that I can jump to the code line with #SCI_GOTOLINE?
GetEnvironmentVariable("PB_TOOL_Scintilla") is not updated.
Any ideas?
I have written myself an Include Browser which, when started as an IDE tool, determines all includes in the complete project (also within the includes).
I can now search through all files using a search function.
Now I want to display the found location in the IDE and I can't get any further.
I use RunProgram() to load the file into the IDE. How can I now
determine which ID Scintilla has in the currently open tab? So that I can jump to the code line with #SCI_GOTOLINE?
GetEnvironmentVariable("PB_TOOL_Scintilla") is not updated.
Any ideas?
"Daddy, I'll run faster, then it is not so far..."
Re: IDE / Scintilla - active tab
Only the active tab's Scintilla window will be visible:
Code: Select all
Procedure EnumWinProc(hwnd, *lparam.Integer)
Protected sClass.s{260}
GetClassName_(hwnd, @sClass, 255)
If sClass = "Scintilla"
If IsWindowVisible_(hwnd)
*lparam\i = hwnd
EndIf
EndIf
ProcedureReturn 1
EndProcedure
EnumChildWindows_(hwnd_IDE, @EnumWinProc(), @hwnd)
Debug hwnd
Re: IDE / Scintilla - active tab
Thx fryquez! It works
If someone else need this: you can get hwnd_IDE from environment:
The PB EnvironmentVariables are only available if its executed as exe via the IDE tools.

If someone else need this: you can get hwnd_IDE from environment:
Code: Select all
Global hwnd_IDE = Val(GetEnvironmentVariable("PB_TOOL_MainWindow"))
"Daddy, I'll run faster, then it is not so far..."
Re: IDE / Scintilla - active tab
The Includebrowser 'IDE_GetIncludeNames_x86.exe' can download here: https://u.pcloud.link/publink/show?code ... VItYmmPMry
"Daddy, I'll run faster, then it is not so far..."
Re: IDE / Scintilla - active tab
You can also specify the "-l" (or "/L" on Windows) commandline option to specify a line to jump to in the loaded file.
quidquid Latine dictum sit altum videtur
Re: IDE / Scintilla - active tab
FindAllReferences[Win]
WinGetHandle()
Code: Select all
Global PbIdeHandle, ScintillaHandle
Global g_ClassTextIDE.s, g_TitleTextIDE.s
Global classText.s = Space(256)
; PureBasic, Notepad++, SciTE
Procedure.l enumChildren0(hwnd.l)
If hwnd
GetClassName_(hwnd, @classText, 256)
If classText = g_ClassTextIDE
GetWindowText_(hwnd, @classText, 256)
; если заголовок не указан, или в нём есть имя редактора, то применить
If Not Asc(g_TitleTextIDE) Or FindString(classText, g_TitleTextIDE)
PbIdeHandle = hwnd
ProcedureReturn 0
EndIf
EndIf
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure
; Scintilla
Procedure.l enumChildren1(hwnd.l)
If hwnd
GetClassName_(hwnd, @classText, 256)
If classText = "Scintilla"
ScintillaHandle = hwnd
ProcedureReturn 0
EndIf
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure
g_TitleTextIDE = "PureBasic"
g_ClassTextIDE = "WindowClass_2"
EnumChildWindows_(0, @enumChildren0(), 0)
EnumChildWindows_(PbIdeHandle, @enumChildren1(), 0)
Debug PbIdeHandle
Debug ScintillaHandle
Re: IDE / Scintilla - active tab
This seems simply the best option - thx freak!freak wrote: Thu Jan 25, 2024 11:00 pm You can also specify the "-l" (or "/L" on Windows) commandline option to specify a line to jump to in the loaded file.

"Daddy, I'll run faster, then it is not so far..."
Re: IDE / Scintilla - active tab
@Freak: I've tried to load the code and goto line 1234, but it does not jump.
What am I doing wrong?
Code: Select all
RunProgram("PB_SourceCode.pb", "/L 1234", "")
"Daddy, I'll run faster, then it is not so far..."
Re: IDE / Scintilla - active tab
You should call the IDE not a .pb file.
RunProgram("PureBasic.exe", "/L 1234", "")
RunProgram("PureBasic.exe", "/L 1234", "")
Re: IDE / Scintilla - active tab
Thx fryquez!fryquez wrote: Fri Jan 26, 2024 2:47 pm You should call the IDE not a .pb file.
RunProgram("PureBasic.exe", "/L 1234", "")
Now it works this way:
Code: Select all
RunProgram(GetEnvironmentVariable("PB_TOOL_IDE"), Chr(34) + srcfile.s + Chr(34) + " " + Chr(34) + "/L 1234" + Chr(34), "")
"Daddy, I'll run faster, then it is not so far..."