Borland Online And The Cobb Group Present:


February, 1994 - Vol. 1 No. 2

Borland C++ 4.0 IDE Tip - Splitting an edit window

If your source files are more than a couple of pages long, you may frequently scroll back and forth between parts of a file. When your source files are that large, you can waste a lot of time referring to another part of your code.

In Borland C++ 3.1, you could see different regions of a file by opening multiple windows for the same filename. If you made changes to any of the open windows for a file, all of them would reflect the changes. Then, you would be warned about saving changes to the file when you closed the last open file window.

However, if you have a number of windows open for each source file, your IDE Desktop can become cluttered in a hurry. As Figure A shows, having two windows open for each source file in addition to your other IDE windows can be quite confusing.

Figure A - If you open multiple windows for a file in Borland C++ 3.1, the IDE Desktop becomes crowded.

In Borland C++ 4.0, however, you don't have to open multiple windows to see separate parts of a file because you can now split an editor window and scroll each section independently. In this article, you'll show you how to split editor windows into separate sections and how to rejoin those sections into a single view.

Splitting Windows into panes

To split an open editor window, you'll first need to make sure that the buttons Win SplitHorizontal and Win SplitVertical appear in the editor window's Speedbar. These buttons appear at the far right of the Speedbar by default, as shown in Figure B.


Figure B - Normally, you'll find the buttons for splitting editor windows in the Speedbar.

First, you'll open the file window that you want to split. In order to split the window horizontally, you'll click the Win SplitHorizontal button. To split the window vertically, you'll click the Win SplitVertical button.

After you've split a window, you can then split those sections, or panes, again. You can continue splitting successive panes until they become too small to display their scroll bars.

To split a pane, you'll first make that pane active by clicking in it with the left mouse button. A window's active pane has scroll bars down the right side and along the bottom. You can then split that pane by clicking the Win SplitHorizontal or Win SplitVertical button in the Speedbar.

Making Panes

To see some of these techniques in action, launch the Borland C++ 4.0 IDE. When the IDE Desktop appears, open an existing source file by choosing Open... from the File menu. When the Open A File dialog box appears, enter

C:\BC4\README.TXT

in the File Name entry field. To open a file window for README.TXT, click the OK button.

When the file window appears, click on the Win SplitHorizontal button in the Speedbar. The window will split into two panes separated by a horizontal dividing line, as shown in Figure C.

Figure C - You can view separate sections of a file by splitting the file's window.

Now, split the upper pane of the window vertically. Begin by clicking in the upper pane of the window with the left mouse button to make it active. Then, click the Win SplitVertical button in the Speedbar. A vertical dividing line will appear in the middle of the upper pane, as shown in Figure D.

Figure D - You can split existing panes to view three or more file sections.

After you've split a pane, the relative size of the panes may not be appropriate. Fortunately, you can easily resize the panes.

Growing Panes

To resize a given editor window pane, you'll position the mouse pointer directly over the divider that appears between panes. When the mouse pointer changes to a double arrow, you'll click and drag the divider with the left mouse button. If you've split a window both vertically and horizontally, you can adjust the vertical and horizontal dividers independently.

To adjust the location of the vertical divider, position the mouse pointer over the vertical divider between the horizontal divider and the top of the window, and then click and drag with the left mouse button. The horizontal divider won't move when you adjust the vertical divider this way.

To adjust the horizontal divider, position the mouse pointer over the horizontal divider between the vertical divider and the left side of the window, and then click and drag with the left mouse button. The vertical divider won't move.

To adjust both dividers, position the mouse pointer at the intersection of the horizontal and vertical dividers. When the mouse pointer changes to a four-way-arrow shape, drag the two dividers with the left mouse button.

To see these functions, return to the IDE and the window you split earlier. Position the mouse pointer over the vertical divider and drag it to the right, as shown in Figure E.

Figure E - As you resize a pane, the IDE displays a black bar to show the new location for the divider.

Now, position the mouse pointer over the intersection of the three panes. When the pointer changes to a four-way arrow, drag down and to the right.

After you've split a window and resized the panes, you may want to rejoin separate panes. Fortunately, it's easy to remove one or more dividers.

No Panes, No Gains

To remove a horizontal or vertical divider, you'll simply move it to the edge of the window. If there are dividers between the divider you want to move and the edge of the window, moving the divider against another one will remove the first divider.

Return to the IDE to remove one of the existing dividers. Position the mouse pointer over the vertical divider and drag it as far to the right as you can. When you release the left mouse button, the vertical divider will disappear.

Conclusion

In Borland C++ 4.0, you can split your source windows into multiple panes and easily view different parts of a file. By splitting your windows, you can avoid scrolling between sections of a file or crowding your IDE Desktop with open windows.

Return to the Borland C++ Developer's Journal index

Subscribe to the Borland C++ Developer's Journal


Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.