User forums > Using Code::Blocks

How to switch between files in Code::Blocks editor window

(1/2) > >>

FrankPeelo:
What is the best way to go between two files, e.g. between the header file and the code file, in Code::Blocks?

Ideally I would like to have them side by side, but "Split View" seems only to show the same file in both views. I want to check/modify the declaration of my function (or the documentation there) in the .hpp file when I am working on the definition in the .cpp file. Is it possible to split the view and have different files in the two views?

Alternatively, can I switch quickly between files without losing my train of thought?

I found a thread (https://forums.codeblocks.org/index.php?topic=19589.0) saying that ctrl-Tab should let me switch between windows. Maybe it worked in 2014; I can't quite get it to work properly, now. It only switches between editor tabs if I first click on the tab. If the focus is on the code, ctrl-tab gets me into the "Management" sidebar to the left of the editor window, and then starts bringing me through the tabs in there. Unless I put ctrl-TAB as the binding in Settings|Editor... ->Keyboard shortcuts -> View -> Switch tabs, but then I get the "tab-switcher window" discussed in that thread.

The setup is, Code::Blocks 25.03 installed from codeblocks_25.03_amd64_debian11.tar.xz on Ubuntu 22.04 LTS with Mate as the desktop environment.

ccdric:
first of all : something like "Hello" !!! and ending by something like "thank-you ...." would be nice

but as I'm in a good mood :
- switch quickly : for me shift-ctrl-tab works
- side by side :  open 2 file, drag and drop one of them on the right side .. works fine for me too 

blauzahn:
Swap header / source    F11

see https://wiki.codeblocks.org/index.php/Keyboard_Shortcuts

It is one of my favourite nifty little features of Code::Blocks besides F2 for opening/closing the log info pane.

FrankPeelo:

--- Quote from: ccdric on September 24, 2025, 03:28:04 pm ---- switch quickly : for me shift-ctrl-tab works
- side by side :  open 2 file, drag and drop one of them on the right side .. works fine for me too

--- End quote ---

Thanks for that @ccdric, shift-ctrl-tab gets me to the tab without using the mouse, which is an improvement. Then ctrl-tab lets me change which file I'm looking at, although not to toggle back to the one I was at before.

The side by side option sounds very interesting! But I can't get it to work.
Now there are multiple source files open in Code::Blocks. The name of each file is in a tab at the top of the editor window. First file is showing in the editor, I should drag and drop another on its right.

* If I try to drag the second file's tab at the top of the C::B editor window, as soon as I click on it I move to that file instead of being able to drag it.
* If I drag the filename from the "Projects" tab in the C::B management pane, the path of the file is inserted into the file.
* If I drag from the "Files" tab in the C::B management pane, nothing happens.
* If I drag from the file browser, the file I drag opens in its own tab. 

Sorry, I would like to use your hint but I can't figure it out.

Thanks anyway.

blauzahn:
I have the open file list window attached to the right side of the cb-window, next to the editor. In addition to that I have set in settings|editor|other editor setttings| Label in editor tab is the file's to relative path. The tabs on top or bottom of the editor window fill up available space quickly but navigating via the open file list works well for me even when I have dozens of files opened.

At the bottom I prefer to have the logs getting the full width.

Navigation

[0] Message Index

[#] Next page

Go to full version