Edwina’s Interface

Like many editors, Edwina has a dual interface. Figure 9-1 shows Edwina in raw-meat mode—that is, nothing but editing space and status bars. (Ignore the menu bar and toolbar for now.) This editor might have commands, but only for those who memorize them from a book (not supplied). Furthermore, clicking various locations on the status bars produces various actions, but you’ll have to figure this out for yourself.

The only thing wimpy about this editor is the menu bar and toolbar. Those menus and toolbar buttons are your entry to quiche mode, where friendly dialog boxes hold your hand as they guide you through easy versions of the commands and let you customize colors and fonts. Figure 9-2 provides a menu map.

Figure 9-1. Edwina the editor.

Figure 9-2. Edwina’s menu map.

The quiche interface needs no introduction; we all know how menus and dialog boxes work. The raw-meat interface is a little trickier. For example, look at the Line, Column, and Percent items on the bottom status bar—items you would expect to find in any editor. But if you click one of these items, it becomes an entry box in which you can enter a new line, column, or percent value. When you enter a value, the editor moves to the new location.

There’s more. When you click the time display, it toggles to a date. When you click the INS item, it grays and switches you to overwrite mode. Click the CAP item, and you toggle the Caps Lock status.

The status bar is simply a StatusBar control, and Line, Column, Percent, and Margin items are Panel objects. But unknown to the casual viewer, an invisible text box hides behind the XEditor control on Edwina’s form. When you click a modifiable panel, Edwina moves the hidden text box over the correct panel, fills it with the current entry as a default, makes it visible, and gives it the focus. When you finish editing (by pressing Enter or changing the focus), the text box disappears, and the panel displays the result. More important, the new value is assigned to the Line property of the XEditor control, and the cursor—uh, make that the caret—moves to the new location. You can check this code out in EDWINA.FRM.

The XEditor control is designed throughout to work with both the raw-meat and the quiche interfaces (or with any other interface you dream up). A direct interface contains lots of options and alternatives that you can hook up whatever way you choose. And there’s a simple interface that hooks to the typical menu items. The simple interface is less flexible for clients but friendlier for users.