<?xml version="1.0"?><?xml-stylesheet href="docbook-css/driver.css" type="text/css" ?><?xml-stylesheet href="haiku.css" type="text/css" ?><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN""http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" ><book><bookinfo><date>9-1-2006</date><title>Haiku Human Interface Guidelines</title><subtitle>Better Known as "How <emphasis>NOT</emphasis> to Write Software</subtitle><authorgroup><author>DarkWyrm</author></authorgroup></bookinfo><chapter id="chapter1"><title>How to Design Software Good</title><para>Haiku is an operating system which is known for its speed and being easyfor anyone to use. This is partly because good programmers try to designtheir apps for more than just themselves. We are going to examine how youcan also make your program more appealing. The reason is easy: easier to usemeans more people using your program. Writing good software can be hard, butit is worth the time and effort.</para><sect1> <title>Who's Gonna Use It?</title><para>You probably already know what kind of program you are going to write. Ifnot, put this book away and do some thinking first. Without a clear idea ofwhat you want, it's hard to do something about it. Once you know whatgeneral kind of program you would like to create, you also need to figureout who the program is meant for. This can be something as general as'desktop users' to something as specific as 'Haiku Web Developers'. When youknow who the main users of your program will be, you can make certainassumptions about what your users know. You can't necessarily expect amusician to understand how to effectively use a 3D modelling program asadvanced as, say, 3D Studio Max, but you can expect them to have skillswhich lend themselves to using a program for writing music.</para><para>Depending on how concerned you are about details, you may even want tocreate a user profile -- a fictional idea of an example user. This canconsist of just one or two sentences or can be several paragraphs. A shortuser profile contains the person's first name, occupation, level ofexpertise, and what kinds of things they want to be able to do with theircomputer. One thing to be sure of is to make the user profile believable --like a person you might know. In fact, when you design your app, it may behelpful if you know someone who fits into the target audience. You don'twant to design your app for that person specifically, but, rather, someonejust like them.</para> </sect1><sect1> <title>What will the User be Doing?</title><para>Most people will use your software to get work done, unless, of course,you're writing the next hit game, and despite experiences you may have hadwhich might make you wonder, users are fairly intelligent. The saying thatno one reads manuals is mostly true: people generally have better things todo than read software manuals except when either in trouble or as bathroomreading. Try to keep in mind how busy most people are and how valuable theirtime is to them when you are designing your program.</para><para>In order to make doing work with your program easier, you need toprioritize what kinds of work they will do in order of how often the work isdone. Come up with a list of tasks the user will be doing and put them intoone of 3 categories: Common, Uncommon, and Rare. Common tasks,unsurprisingly, are those things which the user does all the time. In a wordprocessor, this would include typing in text, changing font sizes andstyles, and adjusting margins. Uncommon tasks are those which the user doesjust from time to time. Depending on the user, this might be something likeprinting labels, adding color to a table, or counting the words in thedocument. Rare tasks are those which are done every once in a great while.Often times, these tasks are ones which the user would quite likely not missif it were not possible to do it with your program. This would also be thekinds of things that only 20 percent of your users or less would end upusing. If you do decide to include features to handle Rare tasks, thinkcarefully about each task's importance in the grand scheme of things beforedeciding with any finality.</para><para>To paraphrase Einstein, you must make your software as simple as possiblebut no simpler. Complexity must be kept to a minimum. One major way this canbe done is by avoiding features which are used only in remote instances --the tasks in the Rare group. Design your application to meet the needs of 80percent of your target audience. Features add complexity and complexity addsdifficulty.</para> </sect1><sect1><title>How will Your Users Do Their Work?</title><para>Once you know who your users are and what they will be doing, you willneed to figure out how it will be done in a general sense. This does notinclude what your program will actually look like, however. In a personalfinance application, one of the user's primary tasks will be entering intransactions. The user will need to type in the data for each transaction ordownload them from their bank over the Internet. You need to know this kindof information for each task the user will have to perform, common orotherwise.</para><para>The actual implementation is determined last, which is why it has not beendiscussed until now. This is where the general usage of the application isdetermined. For example, the user will have a form to enter transactionsinto an account. The form should have text fields for each of the differentkinds of data, such as the payee, the amount, and the check number.Somewhere nearby, the user will be able to see a list of all thetransactions in the current account. Because this is where the actualbuilding of the look of the program takes place, it is crucial at this pointin development to know and understand what makes software truly easy to use,so this is what we will examine next. Note that what technologies will beused to actually create the program have not even been mentioned yet. Foryour audience, technology is merely the means to an end -- a tool -- and notthe goal itself.</para></sect1><sect1><title>Summary</title><para>Careful planning is the key to writing excellent software, regardless ofwhat stage of development a project may be in. In order to be easy, goodsoftware only has what is really needed. It also helps the user do their workwherever possible. Only by thoroughly understanding what the work is, how itis to be done, and who is doing it can a program provide the best experiencepossible.</para></sect1></chapter><chapter id="chapter2"><title>Qualities of Good Software</title><para>When it comes to software, the proof is in the usage. If a piece ofsoftware requires significant time to learn, users will only invest thetime in learning it if (a) they have no other choice but to use that particularsoftware and (b) the importance of the need filled by the software is muchgreater than the importance of the user's time. In short, users will learnonly what they must in order to do their job and even then only when forced todo so.</para><sect1><title>Good Software Focuses on a User's Actual Needs</title><para>In Chapter 1, it was mentioned that your program should meet the needs of80 percent of your target audience. It is impossible to meet the needs ofall users in the same software and still retain some semblance of being easyto use. Sometimes users don't even know that they need or don't need afeature and it is up to the designer and developer to figure out what isneeded. Most often, it is better to have a small collection of morespecialized tools than one which does everything.</para></sect1><sect1><title>Good Software Uses Everyday Language</title><para>Jobs in the Information Technology industry are almost always professionalpositions. One aspect which makes IT a profession is that it has its ownbody of knowledge and terminology to go with it. Most people have only arudimentary 'computerese' vocabulary. The thing that they look at when theyuse a computer is called a monitor or just 'the screen'; the little arrow onthe screen is called the cursor, and the thing they type with is called akeyboard. Few users know (or care) what a 'file format' is and fewer stilldo know what an 'invalid sector' on a floppy disk might be.</para><para>Good programs use language appropriate for the audience. The problem isthat quite a lot of software intended for the general desktop user readslike Yiddish for Joe User. In such cases, regular, everyday language shouldbe used as much as is possible. For file management software, 'volumes' arereally disks -- even though the term isn't quite accurate, a normal personthinks a disk is a storage container and that volume is what you have up toohigh at really good parties. Images are 'pictures'. A person doesn't 'kill'a application that has 'hung' -- they 'force a frozen program to quit'.Details like this may seem minor, but many small improvements in a program'susability can have a profound effect overall. Of course, if your targetaudience is IT professionals, these kinds of terms are perfectly acceptable.Be sure that you match the everyday language of your audience and when indoubt, err toward using less technical language.</para></sect1><sect1><title>Good Software Does Not Expose Its Implementation</title><para>Good software works a certain way because it is the best way to be done orclose to it, not because the code was written in a certain way or because itwas dictated by an underlying API. An example of this would be if a musiccomposition program has an easily-reached maximum song size because the codemonkey who wrote it used a 16-bit variable instead of a 32-bit one. Whilethere are sometimes limitations that cannot be overcome, the actual codewritten and the architecture used when it was written should have as littleeffect as possible on what the user sees and works with when using yoursoftware.</para></sect1><sect1><title>Good Software Uses Graphical Controls Properly</title><para>GUI controls were meant to be used in certain ways, and when a programdoes not use them in that particular way, it is confusing to the user andpossibly hazardous to the user's data. Check boxes, for example, arecommonly used in lists where a value can be turned on or off. Some programs,however, uses them for choosing one option in a list even though radiobuttons are meant for this task. Text boxes should not be used for labellingother controls. This might seem to be common sense for most, but, restassured, there are many programs which do not do something as simple asthis. In short, use standard controls the way they were intended.</para></sect1><sect1><title>Good Software has a Natural Layout to its Controls</title><para>Some tasks have a natural, logical workflow, and good programs aredesigned in a way that capitalizes on this workflow. When entering anaddress in the United States, the natural order is Name, Street and Number,City, State, and Zip Code. Following any other order would both frustratethe user and also lead to more mistakes in entering data. This also appliesto the Tab navigation order of controls in a window. Generally speaking,this order should either be left-to-right, top-to-bottom or in acounter-clockwise circle, depending on how the controls themselves areplaced and the expectations associated with the work to be done.</para></sect1><sect1><title>Good Software Gives Plenty of Feedback</title><para>Imagine for a moment that you have just started converting a movie file toanother format. You hit the button marked 'Go' and wait. Then you wait somemore. You go to the restroom, brew a new pot of coffee, get the mail fromthe box, confirm that mullets are still out-of-style, and come back to waitsome more. You're sure you clicked the button, but nothing seems to behappening. Did something go wrong? Only after some snooping around with afile manager do you find out that everything is OK. You didn't know what washappening because the program didn't tell you what it was doing.</para><para>Good software keep the lines of communication open. Good feedback justmeans making sure that the user knows what your program is doing at anygiven time, especially if the program is busy doing something which makesthem wait. CD and DVD burning programs tell the user how much is left beforethey are finished making a CD or DVD. File management programs tell how manyfiles are left to copy or move. Web browsers animate a little icon whilethey download a web page. Users have a natural tendency to think that ifnothing seems to be happening, then the program is probably frozen. Makingsure that the user knows your program is hard at work puts their mind atease.</para></sect1><sect1><title>Good Software Makes Errors Hard</title><para>It has been said that nothing can be made foolproof because fools are soingenious. Even so, make it tough for the user to make a mistake. If, forexample, the user needs to enter in some text and certain characters are notallowed, then disable those characters for the text box it needs to beentered in instead of nagging the user with a message box. If resizing awindow horizontally should not be done for some reason, don't let the userdo it. Does your program require a selection from a list before the userclicks OK? Tell the user that -- nicely, of course -- and then disable theOK button until a selection is made. An even better solution would be toselect a good default choice for the user and give them the option to changeit. Build constraints into your application which prevent errors. This wouldbe why 3.5" floppy disks have a notch in one side -- it can be inserted intoa drive only one way. Constraints are also good for lazy developers becausethen their software crashes less and they don't need to write as mucherror-handling code.</para></sect1><sect1><title>Good Applications Handle Errors Gracefully</title><para>Even if you make it hard for a user to make a mistake, expect your programto have to deal with errors. It is possible for a program to handle errorsin a way that doesn't leave the user wondering what happened. When code iswritten, errors of all sorts need to be anticipated and handled, such aslack of memory, lack of disk space, permissions errors, corrupted files, andloss of network connectivity. As Murphy's Law states, if something can gowrong in a given situation, it probably will. Hope for the best but preparefor the worst: without bordering on the completely ridiculous, handle everyerror that is likely to occur. Doing so greatly improves the perception ofyour software by the outside world. Crashes are unacceptable in all cases.Period. Error messages, for example, need to describe at the user's level ofexpertise what happened and suggest what the user can do to remedy thesituation. In the worst case, the program needs to provide an easy way forthe user to send technical information about the problem back to you viae-mail or some other means. In all cases, the user's data is to bepreserved.</para><para>One way that you can see how well your program handles errors is todeliberately try to break it in every way possible. Feed the entire text ofyour Aunt May's quiche recipe into a text box all at once. Try to open filesit has no business being given. Take a valid document, back it up, open itin DiskProbe, enter as much junk data into it as you like, and then try toopen it. Break your Internet connection while it's in the middle of anupdate. Try to use files with really wonky filenames. Be creative andridiculous and, most of all, have fun breaking things!</para></sect1><sect1><title>Good Software is Forgiving</title><para>Computers are excellent tools for people because they are good at manythings that people are not. From a perspective which focuses on technology,humans are imprecise, illogical, disorganized, and make mistakes frequently.They are, however, excellent at forming habits and matching patterns, twothings computers have a difficult time doing. Make commands undoablewhenever possible and when it is not possible, be sure to inform the userthat such is the case. Capitalize on a computer's strengths to make up for aperson's inherent weaknesses.</para></sect1><sect1><title>Summary</title><para>Good software takes real work to produce. It is not for the stereotypical'lazy programmer' unless they know where it is acceptable to be lazy. Increating something of value to customers, good software creates a positiveimage for a company and loyal customers who will do your own advertising foryou. The best advertising is done by your customers to their friends,family, and coworkers.</para></sect1></chapter><chapter id="chapter3"><title>Conventions of Haiku</title><para>Just as a person generally doesn't go barging into a stranger's home andstart redecorating and otherwise making himself at home merely because theowner does not own a shotgun, your program needs to have good manners ingetting along with both the operating system and the other programs the userhas installed on the system. Some of these are merely good coding practicesmeant to make your job easier and others are for ensuring that your programcan be more easily maintained. None of them are difficult or much work, sothere. Now you have no choice but to follow them. :D</para><sect1><title>Program Settings: Format and Location</title><para>While there are lots of ways to store program settings, the easiest andrecommended method is placing them in a BMessage and flattening it to aBFile. By using BMessages as your container, you don't have to concernyourself with writing and debugging other code. The exact location used tostore them depends on the number of files you will need. If your softwareneeds only one file and will only ever need one, then it is just simplest toplace it in the user's config/settings folder. However, should you need morethan one file, please put them in their own folder to minimize the clutter.The folder should either follow the formathome/config/settings/your_app_name_here orhome/config/settings/your_company_name_here/your_app_name_here.</para></sect1><sect1><title>Maintain Responsiveness</title><para>Probably the best-known quality about BeOS and Haiku as operating systemsis speed. This largely comes from the extensive use of multithreading inapplications. Being responsive does not necessarily mean that your programshould never be busy. It should just respond to input and redraw requestseven when it's doing something. A common experience encountered by Linux andWindows users is the "blanking out" of a window or an entire program becauseit is busy doing something else. This comes from two things: the program hasone thread of execution devoted to all its windows and that thread is busydoing some sort of time-consuming work. Instead of falling into this trap,which is unprofessional for you and confusing for the user, spawn anotherthread to do the actual processing and allow the message-handling thread tocontinue to do its job. This makes sure the user knows that your applicationis still running properly and has not frozen.</para></sect1><sect1><title>Avoid Hardcoded File Paths</title><para>Whenever your program needs to specify a particular location on thesystem, use the find_directory() function to generate it. If and when theday comes that Haiku supports multiple users, your application will make asmooth transition to the new architecture. This will also allow for backwardcompatibility with older versions of BeOS, such as the change in locationsfor B_COMMON_FONTS_DIRECTORY being in a different place for Haiku than onR5. find_directory() is supported in both C and C++ environments.</para></sect1><sect1><title>Easy Access to Recently Used Files</title><para>The Deskbar provides the most recently used documents, folders and applications,but those lists are limited in slots (defaults to 10) and not permanent. Therefore,applications that deal with files should provide the user with a list of files theyhave opened or saved most recently.</para><para>It's recommended to show the last 10 opened or saved files in a submenu ofthe Open menu item in the File menu. If the user clicks the Open label, theregular file dialog appears, otherwise they can choose the file to open from itssubmenu. An example of this is the StyledEdit application.</para><para>The Haiku API provides BRecentFilesList::NewFileListMenu() in the RecentItems.hheader that creates the recent files menu and has the system do all its management.</para></sect1><sect1><title>Make Your App's Look Fit in with Others</title><para>Certain function calls have been provided in the API to aid in making surethat your software shares the same general look as other applications andallow the user to make customizations to the system at the same time. Unlessthere is a very good reason for it, get colors for your program withui_color() and the constants which go with it. Determine the size of yourcontrols dynamically - use the ResizeToPreferred and GetPreferredSize forsystem controls and calculate the size of your own controls based on fontsizes obtained from the system instead of hardcoded values. If you'rewriting code specifically for Haiku and don't care about compatibility withother BeOS flavors, use the new layout API. All of this will allow betterease-of-use for the user who prefers tiny fonts to increase use of desktopreal estate and also for older users who need larger font sizes toaccommodate weaker visual acuity. Graphics are an important part of aprogram's look, but don't reimplement the look of the buttons and otherstandard controls just to make your application stand out from the rest. Bykeeping visual consistency with the rest of the operating system, you avoidconfusing the user with buttons that do not look like you can click on them,strange-acting menus, and so forth.</para></sect1><sect1><title>Live Updates</title><para>One way to make sure that your application communicates effectively withthe user is to provide "live" updates to information in it. This mostlyrelates to files in the system. A good example is an address book programwhich automatically removes and adds entries when new People files are addedto the People folder. The information doesn't even have to be data that isoutside your program. It could just be as simple as updating an entry in alist of items as the user types makes changes to it in a form in a differentpart of the GUI. Responsiveness like this in a program helps the user feelmore in control of the work they are doing and prevents possible loss ofdata.</para></sect1><sect1><title>Translators</title><para>Haiku comes with bits of technology that allows lazy programmers to belazy and still have their programs be good ones. One of them is theTranslation Kit. Merely including the library and making use of evensomething as simple as the BTranslationUtils class will help to ensure thatat least this portion of your code is free of bugs. In general, you willprobably find yourself making use of image translators most in order to loadimage resources that your program will use. Just remember that translatorsare system add-ons and that unless your program has installed a translatorfor a particular file format, depend only on the formats installed bydefault in the system. As an aside, some formats are undocumented or requirelicensing, which makes it difficult for users to access their own data. Useopen and documented formats as much as possible.</para></sect1><sect1><title>Squeezing the Most Out of BFS: Queries and Attributes</title><para>The filesystem that Be created was nothing short of amazing in the 1990s.Even with the gradual evolution of other operating systems having progressedsince then, it is still one of the most powerful around. Attributes are apowerful tool which allow you to store data about a file without being partof the file. This kind of power is easily put to use with audio files, suchas FLAC, Ogg Vorbis, and the ubiquitous MP3. By attaching attributes toaudio files, you can search for them with a query. Queries also leverage thefilesystem's power. As long as the attribute you are querying for is indexedin the filesystem, there is no place a file with that attribute can hide. Totop it all off, they are also a fast way of search for files meeting acertain criteria.</para><para>Although both attributes and queries are very powerful, use good sense. Ittakes quite a while to read a large number of attributes from a file, so youmay wish to cache them if you are writing a program which will need to readmore than just a few of them. Queries can only make use of attributes whichare indexed, and their speed goes down as more and more attributes areindexed.</para></sect1><sect1><title>The System Tray: It's Not Just for Dinner Anymore</title><para>Because it can very easily become cluttered, install icons in theDeskbar's shelf only when it provides information that is updated often orif it provides functionality which will be frequently accessed by the user.Examples of these kinds of situations would be monitoring memory andprocessor load, checking mail, or quick access to features provided by apersonal information management program. If it is unlikely that the userwill need to access the information or functionality less than once persession, don't use the Deskbar -- accessing your program through the Be menuor an icon on the desktop should be sufficient.</para></sect1><sect1><title>Tracker and its Uses</title><para>Tracker can be quite a useful tool for your program which requires littleeffort to provide some courtesies to the user which would otherwise be a lotof work. The Open and Save windows have already been done for you. Pleaseuse them. If just a certain type of entry is needed, such as afolder or specific type of file, make a filter that shows only those typesof entries. By removing unneeded items from the file navigation window, youare reducing the number of choices the users must pick from and alsopreventing them from opening the wrong kinds of files. Keep in mind thatthere may be files that may not have had their MIME type identified, so donot exclude them either. You can also make Tracker show a window for aparticular folder in order to show the user where a particular file has beenstored and give them access to it directly.</para></sect1></chapter><chapter id="chapter4"><title>Getting Input from the User</title><para>While it might seem a simple case to get input from the user, it is oftennot the case if you wish to account for many external factors, such asaccessibility, speed, and user expertise.</para><sect1><title>Mouse Vocabulary, AKA "What's This Button Do?"</title><para>The mouse, while the favorite rodent of most users, is not a veryintuitive device: mouse skills must be learned. Most of the time, mouseskills are not an issue because the user is clicking on buttons, menus, andso forth, but sometimes a program must deal directly with mouse clicks andmoves. Mouse operations fall into one of three categories.</para><variablelist><varlistentry><term>Skills you can expect the user to have:</term><para><itemizedlist><listitem>Single-click</listitem><listitem>Double-click on primary mouse button</listitem><listitem>Single click with secondary mouse button</listitem><listitem>Drag with primary mouse button</listitem></itemizedlist></para></varlistentry><varlistentry><term>Skills the user might have:</term><para><itemizedlist><listitem>Drag with secondary mouse button</listitem><listitem>Single-click with tertiary mouse button</listitem><listitem>Single-click on primary mouse button with modifier key</listitem><listitem>Triple-click with primary mouse button</listitem><listitem>Scroll with scroll wheel</listitem><listitem>Scroll with scroll wheel and modifier key</listitem><listitem>Drag with the tertiary mouse button</listitem></itemizedlist></para></varlistentry><varlistentry><term>Don't Use These:</term><para><itemizedlist><listitem>Click-and-a-half: Mouse down + mouse up + drag with a second mouse down</listitem><listitem>Multiple click with non-primary mouse button</listitem><listitem>More than 3 consecutive clicks (quadruple clicking or more)</listitem><listitem>Drag with tertiary mouse button</listitem><listitem>Drag with modifier keys</listitem><listitem>Secondary/Tertiary click with modifier keys</listitem></itemizedlist></para></varlistentry></variablelist><para>In the event that your program must deal with directly handling mouseinput, there are certain rules of thumb for how each of the expected skillsis to be used. Single clicks are used for the most common actions inoperating a control. This would be selecting items in a list, pushing abutton, choosing a menu item, and placing the blinking text cursor in aBTextView. Double clicks are used for secondary functions, such as invokingan item in a BListView or selecting a word in a BTextView. Secondary mouseclicks (most commonly called "right-clicking") are generally used for acontext-sensitive menu or, in the case of graphics programs, drawing withthe secondary color. Mouse dragging is used for selecting text or movingthings around. Mouse dragging with B_TERTIARY_BUTTON is generally used forpanning. The scroll wheel by itself should be used just for scrolling, butyour program may have a use for the scroll wheel when used with a modifierkey, as below:</para><variablelist><title>Scroll Wheel +</title><varlistentry><term>B_COMMAND_KEY: </term><listitem>Zoom in/out</listitem></varlistentry><varlistentry><term>B_OPTION_KEY: </term><listitem>Scroll by one full page</listitem></varlistentry><varlistentry><term>B_CONTROL_KEY: </term><listitem>Increase/decrease font size</listitem></varlistentry></variablelist></sect1><sect1><title>Keyboard Accelerators: The Sports Cars of GUIs</title><para>More advanced users often like using keyboard shortcuts for common tasksbecause they reduce the considerable amount time spent switching between thekeyboard and the mouse.</para><variablelist><title>Standard System Accelerators:</title><varlistentry><term>B_COMMAND_KEY + N: </term><listitem>New document</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + O: </term><listitem>Open document</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + S: </term><listitem>Save document</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + Shift + S: </term><listitem>Save asβ¦ (show Save dialog window)</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + P: </term><listitem>Print</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + W: </term><listitem>Close active window</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + Q: </term><listitem>Quit</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + C: </term><listitem>Copy</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + X: </term><listitem>Cut</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + V: </term><listitem>Paste</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + F: </term><listitem>Show find window</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + G: </term><listitem>Find again</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + B_OPTION_KEY + F: </term><listitem>Show Replace window</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + L: </term><listitem>Replace and Find</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + ,: </term><listitem>Settings window</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + B: </term><listitem>(Word processor) Bold font</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + U: </term><listitem>(Word processor) Underline font</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + I: </term><listitem>(Word processor) Italicized font</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + A: </term><listitem>Select all</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + Z: </term><listitem>Undo</listitem></varlistentry><varlistentry><term>B_COMMAND_KEY + B_SHIFT_KEY + Z: </term><listitem>Redo</listitem></varlistentry><varlistentry><term>Tab / Shift + Tab: </term><listitem>Keyboard navigation</listitem></varlistentry><varlistentry><term>B_CONTROL_KEY + Tab: </term><listitem>Switch programs</listitem></varlistentry></variablelist><para>When choosing keyboard accelerators for your program, use them only forcommonly-used tasks. Do not use one of the system combinations for a taskdifferent from the list above. Doing so will only confuse and frustrateusers. Choose key combinations which are easily associated with thefunctions that go with them. For example, Tracker uses Alt + Up to go to theparent folder of the current window. The Command key should be the mainshortcut key. The Option key is generally used to modify an existingshortcut with a closely related function. Command + F shows the Find window.Command + Option + F shows the Replace window.</para></sect1><sect1><title>Design to Prevent Fitts</title><para>According to Mr. Fitts, when using a mouse or other pointing device, theamount of time it takes to point to something is proportional to how faraway that something is and how big it is. While it might seem obvious, thisis often overlooked when a program is designed. The easiest places for auser to click are the four corners of the screen and the pixel directlyunder the cursor. The reason for this is because the mouse does not need to bemoved to click on the pixel under it. The user also does not have to think muchwhen moving the cursor to a corner because as soon as it reaches an edge, itcan go no farther in that direction regardless of how much the mouse ismoved. The Deskbar is in one corner of the screen for this reason.</para><para>When you design the graphical interface for your program, make controlseasy to click on. Toolbars that have a text label as part of each button areinherently easier to click because the labels add to the size of thebuttons. A number of existing image editing programs use the secondary mousebutton for a pop-up menu to access common features because the mouse doesn'thave to move in order to bring the menu up. Researchers have evenexperimented with circular menus -- called pie menus -- which capitalize onFitts' Law in order to make a menu as fast as possible. Your program neednot go to such measures, but do keep in mind that teeny controls slow usersdown.</para></sect1></chapter><chapter id="chapter5"><title>Dynamic Data Exchange: Pass Data Between Applications</title><sect1><title>Drag and Drop</title><para>Not to be confused with falling reptiles, the ability of a user to clickon an object, drag it to some target, and drop it to make the target dosomething with it is both familiar and empowering, just as are other directmanipulation methods. Nonetheless, the drag-and-drop paradigm should be usedonly where it makes sense to do so -- rearranging items in a list, filemanagement, opening a file dragged to your app from Tracker, etc.</para><para>If you plan on supporting dragging within your program or to otherprograms -- even just a little bit -- you should support drops to the mostprobable targets in your program. This shouldn't normally be all thatdifficult because drops to your program will come from either Tracker (inthe form of an entry_ref) or from within your own program. Drops from otherprograms are not required, but if they are especially convenient, they canbe a nice bullet point in a marketing blurb for your program.</para><para>When implementing dragging, be sure that your program provides feedbackabout what is being dragged. This is often best done by using an image whichclosely represents what is being dragged. If this is not possible, arectangle which is the size of the dragged item's selection should be usedin place of the picture.</para><para>A feature which is very helpful to a user is drop feedback. Any time theuser is dragging something and the cursor passes over your program's window,it can react in a way to show the user that your program will accept thedragged object. Drop feedback can take a variety of forms:<itemizedlist><listitem>A list control draws a line in between two items to show wherethe dragged item would be placed if the user released the button.</listitem><listitem>BTextView controls show a line where dragged text would be placed ifdropped.</listitem><listitem>If the user drags an entry over a folder, Tracker shades itslightly.</listitem><listitem>A color well could highlight its border</listitem></itemizedlist>There are other possible ways, but these should be enough for you to get theidea. As mentioned before, feedback is a Good Thing (TM). It allows the user tobetter understand how to use your program to get something done.</para></sect1><sect1><title>The Clipboard</title><para>Another way of getting data from one program into another is via thesystem clipboard. Unlike other forms of data exchange, using the clipboardrequires very little effort or code because you have to do is plunk datainto a particular BMessage. Some of the standard controls already do it foryou. The BTextView class already implements copying, cutting, and pasting byway of keyboard accelerators. In cases like these, all that you will want todo is add some menu items for less advanced users.</para><variablelist><title>Standardized Clipboard/Drag Data Formats</title><varlistentry><term>Plain Text</term><listitem><para>It is easiest to describe the basics with this code snippet.clipboard->AddData("text/plain", B_MIME_TYPE, your_text_string_here);</para></listitem></varlistentry><varlistentry><term>Styled Text</term><listitem><para>Use the same format as for plain text but add a text run array field to themessage also. You probably won't need to worry about this unless you'rewriting a word processor or something similar.clipboard->AddData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, run_array, run_array_size);</para></listitem></varlistentry><varlistentry><term>Generic File References</term><listitem><para>If the amount of data you wish to pass to another program is too largeto place on the clipboard without straining the system, dump the data toa temporary file and place an entry_ref which points to it on theclipboard instead. Audio and video files commonly suffer from thisproblem. To do this, call AddRef() with the field name "refs" and add anentry_ref pointing to the file you wish to pass this may. Multipleentry_ref objects can be sent just by doing it more than once. If yourprogram is going to handle these kinds of drops file references, itshould look for multiple entries in the 'refs' field unless it would beinappropriate to do so.</para></listitem></varlistentry><varlistentry><term>Image Data</term><listitem><para>If your program uses a different kind of data than what has alreadybeen standardized, there are some guidelines you can follow so thatother programs can use it. First, make sure that the data that is put onthe clipboard is in as generalized a form as possible.<segmentedlist><segtitle>Field Type</segtitle><segtitle>Name</segtitle><segtitle>Description</segtitle><seglistitem><seg>B_STRING_TYPE</seg><seg>class</seg><seg>"BBitmap"</seg></seglistitem><seglistitem><seg>B_RECT_TYPE</seg><seg>_frame</seg><seg>A BRect containing the bounds of the bitmap data in pixels</seg></seglistitem><seglistitem><seg>B_INT32_TYPE</seg><seg>_cspace</seg><seg>The color_space constant for the image data, such as B_RGBA32</seg></seglistitem><seglistitem><seg>B_INT32_TYPE</seg><seg>_bmflags</seg><seg>The Flags() argument from BBitmap</seg></seglistitem><seglistitem><seg>B_INT32_TYPE</seg><seg>_rowbytes</seg><seg>The number of bytes per row, including padding</seg></seglistitem><seglistitem><seg>B_RAW_TYPE</seg><seg>_data</seg><seg>The raw image data</seg></seglistitem><seglistitem><seg>B_POINT_TYPE</seg><seg>be:location</seg><seg>The location from which the image data was copied. May be ignored.</seg> </seglistitem></segmentedlist></para></listitem></varlistentry></variablelist></sect1><sect1><title>Replicants</title><para>Replicants take their cue from Dolly the sheep in allowing a BView to becloned and allow you to do Really Neat Things(TM). As cool as replicanttechnology is, it is only an emerging technology in other operating systemsand is unfamiliar to most users in general. As such, it is best left as anextra feature and not the primary mode of operation for a program. Here aresome guidelines for using them, however.<orderedlist><listitem>It is appropriate for a program to be a replicant if it is a lightweightprogram which provides information or a feature which the user will want tobe able to access frequently.</listitem><listitem>Allow for the size of the dragger handle when computing layout.</listitem><listitem>Be sure it is big enough to not get lost when placed on a busy desktopbackground. At the same time, do not take over the user's desktop unless theywant this to happen. 32 pixels square is a good minimum size, forexample.</listitem><listitem>Provide a reliable way for the user to control your replicant. Do notrely on the menu provided by the dragger handle because the handle itselfmay have been hidden. Instead, provide another means which is immediatelyobvious or, at the very least, show a pop-up menu if the user clicks on it(with either button) and there are no other clickable controls.</listitem><listitem>Place a frame around the replicant's border so that it stands out fromits surroundings.</listitem><listitem>Do not make it too visually distracting. This mainly amounts toavoiding lots of bright colors for the controls and limiting the amount ofanimation and movement.</listitem></orderedlist></para></sect1></chapter><chapter id="chapter6"><title>Use of Text in the GUI</title><para>Almost without exception, if you are writing a program, you will need topay at least a little attention to how it uses text. There are, believe itor not, right ways and wrong ways, and while most of the guidelines for textmight seem trivial, paying attention to what seem like niggling littledetails is what sets a good program apart from the rest.</para><para>Above all else mentioned in this chapter, use language appropriate foryour audience -- most of the time, this means avoiding technical terms --and be both clear and concise.</para><sect1><title>Error Messages, or, "I'm sorry Dave, I'm afraid I can't do that"</title><para>Perhaps the place where you should use text the most is in error messages.They should appear as seldom as possible because you anticipated and handledas many error conditions as possible and then tried to blow it up real good,right? ;) When your program can't handle a particular error, the errormessage given to the user should do the following:<orderedlist><listitem>Explain what happened in everyday words.</listitem><listitem>Provide enough information to know what happened without providingdetails which could confuse the user. For example, if a mail client sends arequest to a server for e-mail and the server fails to respond, a way toexplain this might be something like "MyMailApp could not check your e-mail.The mail server did not respond when contacted."</listitem><listitem>Offer suggestions to help the user fix the problem, if possible. Usingthe above example, one possible suggestion might be "Try checking yourInternet connection with your web browser. If your web browser works, themail server might not be working correctly and you may want to try againlater."</listitem></orderedlist></para></sect1><sect1><title>β¦Ellipsesβ¦</title><para>An ellipsis is a series of 3 dots (β¦) used to tell the user that acontrol, often a menu item or button, will require further input. For example, amenu item named "Newβ¦" will display a window which has the title "New".However, if creating a new document does not require showing a window, thenan ellipsis should not be used. Please be sure to use the B_UTF8_ELLIPSIScharacter instead of 3 periods. Most Haiku keymapsallow you to type in an ellipsis with the Option + period keyboardshortcut.</para> </sect1><sect1><title>Abbreviations, Acronyms, and Contractions, oh my!</title><para>Sometimes space is at a premium. Abbreviations, acronyms, and contractionscan come in very handy in these instances, but they can also be confusing.Whenever possible, avoid using them. Many times the reason there is notenough space is it isn't being used as efficiently as possible. When you usean abbreviation, please be sure that it is absolutely necessary, that it isboth common and clear, and that it is appropriate for your program's targetaudience. For example, using the octothorpe (# symbol) as an abbreviationfor the word 'number' in the English language fits these criteria inmost cases. These same guidelines also apply to acronyms. For example, theacronym CMYK (Cyan, Magenta, Yellow, Black) is acceptable in a color pickerfor an image processing application designed for graphics professionals, butnot in one meant for children. Menus and button labels should never beabbreviated or contain an acronym.</para><para>Special care must be used with contractions. They can be a pitfall forusers who are not using a program in their native language. Because theyrequire a more advanced command of a language, avoid using them in a placewhere their role is crucial in conveying the meaning of a message. Forexample, a checkbox for a message dialog with a checkbox marked "Don't showthis message again" which is unchecked by default should be reworded "Alwaysshow this message" and have the checkbox checked by default.</para></sect1><sect1><title>Capitalization and Spelling</title><para>Nothing is more unprofessional than spelling and capitalization errors. Ifspelling is not your strong suit, consult a spell checker, dictionary, or atleast a friend. This is particularly important if you are working with alanguage which is not your native one. Use sentence capitalization in allplaces, that is, follow the normal grammar rules of the language. ForEnglish, this means only to capitalize specific names like "Tracker" or"Deskbar".</para></sect1><sect1><title>Use of Fonts</title><para>Good use of fonts can way make your program more visually appealing, butwhen not used well, can make it ugly, hard to read, or worse. Stick to theplain, bold, and fixed system fonts to maintain some general visualconsistency across the operating system. It is perfectly acceptable to usedifferent font sizes, but do it only when you need a heading or somethingsimilar and try to limit the number of different sizes to just a few. Awindow which has lots of different font styles and sizes is harder to readand looks unprofessional. Control labels should always be in the systemplain font and size specified by the system.</para><para>When calculating the layout for the controls, be sure that you do notdepend on the system font being set to a particular font size. MostBControl-derived controls implement the methods GetPreferredSize andResizeToPreferred to take font size into account. A basic idea of the lineheight for a font can be calculated by calling BFont::GetHeight() and addingtogether the values of the font_height structure.</para><para>Lastly, do not depend on the user having a particular font installed onthe system unless you are willing to ensure that the user has it installedon the system. Font handling for your program is your responsibility, notthe user's. If you do follow this route, be sure to check to see if you haveredistribution rights for the font's license for the font inquestion.</para></sect1><sect1><title>Special Case: The Command Line</title><para>When designing a program to work in a command-line environment there aresome special considerations which must be addressed. Interaction with otherprograms, use in shell scripts, and a generally consistent interface forcommand-line programs are just some of the things you will need to keep inmind. The major design decisions you should make are how your program willget its data, what options will be available, and what feedback the userwill be given.</para><para>Spend some time thinking about how your program should interact with theshell and with other programs. Most of the time, this will boil down towhether your program is file-oriented or stream-oriented. Stream-orientedprograms like grep and less work pretty much like filters, getting data fromstdin and dumping data to stdout. File-oriented programs like zip and bzip2are given a list of files which the program then operates on. Your programcan certainly do both, but choose a primary method because it will influencedesign decisions later on. Seriously consider handling wildcards instead ofrelying on the shell to do it for you if your program is file-oriented. Thisdoes mean more work for you as a developer, but it also reduces typing and,thus, typing errors for the user. Of course, if it doesn't make sense tosupport wildcards, then don't do it.</para><para>Choose options which are going to be accessible by command-line switchescarefully. Make each one available only if it fills a reasonably commontask. From the perspective of the user, adding an option is adding afeature, which will, in turn, increase the complexity of your program.Provide GNU-style (double dash + long name) switches for all options. Themost commonly-used options should also have a short (single-dash + singleletter) counterpart. The switches --help and -h are reserved for showinghelp information. Only standard UNIX applications (ls, tar, df, etc.) arenot required to follow the standard for -h in order to avoid breakingbackward compatibility. All new command-line programs need to follow this.Also, if your program requires one or more parameters, do the user a favorand show the help message if there are no extra parameters instead oftelling the user to retype the command with the help switch.</para><para>When an option requires a particular value, there is also a standard forhow the user is to provide the information. GNU-style command options shouldfollow the format --option=value with the option to enclose the value inquotes. Multiple values for a switch should be comma-separated. Short-stylecommand options should place a space between each value that follows it likethis: -t value1 value2 value3 ... As mentioned above, wildcards should behandled by the program except when it does not make sense. If your programdoes something which modifies data, make sure that your program requiressome sort of parameter -- a switch, a file, or whatever -- so that data isnot lost if the user invokes your program without knowing what it does. Youcan assume that the user is sharper than a bowling ball, but do not expectthe user to have expert knowledge of the operating system or, for thatmatter, your program. Programs which merely report information -- ls and dfcome to mind -- are not required to do this as long as the informationdisplayed gives the user an idea of what the program does.</para><para>Be sure to give enough feedback when your program does its thing. Likegraphical programs, long tasks should inform the user of progress. This maybe something as complex as a full-fledged progress meter drawn with text, asimple series of periods, a listing each file operated on, or somethingelse. *All* programs should provide some sort of feedback; the only time aprogram may print nothing is if there is a "quiet" option which the user hasspecified. The feedback your program gives doesn't even have to beexcessive; you can just give general details. A "verbose" option shouldprovide more detail than the program does by default. As explained earlierin this chapter, error messages should be no more technical than absolutelynecessary and should be helpful whenever possible. If your program requiresa parameter of some sort and isn't given any, show either the same messageas for the help option or an abbreviated version which is still reasonablyinformative along with something to point the user to the help option formore detailed information.</para></sect1></chapter><chapter id="chapter7"><title>Branding - Program Icons, About Windows, Graphics, and Other Visuals at the OK Corral</title><para>With all this discussion, you may be beginning to think that having awell-designed program means that it is going to be boring to look at. Youcan definitely have it more interesting to look at than drying paint. Thereis plenty of freedom for creativity along with some suggestions to help getyou started.</para><sect1><title>Program Icons</title><para>Your program's icon is one easy way to set it apart from the rest of thepack. BeOS-style icons follow one of two perspectives - flat and isometric.Flat icons look like a head-on view. Isometric icons "look down" on the iconfrom a point above and to the right of the object with angled lines beingabout 30 degrees from horizontal. A good icon can give your program afavorable and professional impression to people who otherwise doesn't know athing about you or your program. Take some time to create or find agood-looking icon. Whatever you do, don't just slap together ashabby-looking icon. It would be better not provide an icon at all and relyon the system to show the default application icon than to have one whichreflects poorly on your program's reputation. For more details on iconcreation, consult the Haiku Icon Guidelines. </para><variablelist><title>Design Tips</title><varlistentry><orderedlist><listitem>Remember that this will be small -- don't use too much detail.</listitem><listitem>Use color combinations pleasing to the eye.</listitem><listitem>Tie it into the general color scheme of your program if it has one.</listitem></orderedlist></varlistentry></variablelist></sect1><sect1><title>About Windowsβ¦ Doorways to Creative Expression</title><para>Give yourself some credit in your program: make an About window. Theydon't need to be especially fancy, but they can be if you are so inclined.It should contain the title of your program, the version, you and any otherauthors or the name of your company, and copyright information. If nothingelse, write a few lines of code to show a BAboutWindow with this informationand you'll have enough. If there is a lot of information to show, using amarquee effect to automatically scroll the information or at least aread-only text view with a scroll bar. Do not include information about thecomputer itself, such as the amount of RAM or processor speed; it doesn'tbelong here. While you certainly may show something short about thelicensing of your program like "Distributed under the terms of the GNUPublic License," the full text of the license belongs elsewhere. The windowshould not have a tab and should either have a button marked 'Close' orsimply disappear when clicked. It should also respond to the Command + Wkeyboard shortcut.</para></sect1><sect1><title>Graphics and Other Stuff</title><para>Graphics need not be limited to just the About window and the programicon. You can also use background images in BViews, toolbars, buttons, andother places. There are few hard-and-fast rules here, but there are sometips you might find useful:<orderedlist><listitem>Follow the Dos and Don'ts for toolbars mentioned in Chapter 12</listitem><listitem>Background images should not be too busy and should not reduce overall readability.</listitem><listitem>If your program uses only a few small pictures, you may want topackage them in a resource file to prevent them from somehow coming upmissing in the installation on a user's machine. Crazy things happen onpeople's computers.</listitem></orderedlist></para></sect1></chapter><chapter id="chapter8"><title>Cursors</title><sect1><title>Predefined Cursors and their Uses</title><para>There are predefined cursor icons in Haiku for a variety of uses,including text selection, hyperlinks, resizing, and the default hand usedfor anything else.</para></sect1><sect1><title>Making Your Own Cursors</title><para>You can very easily make your own cursors for your own purposes, but do itonly if a different cursor will dramatically improve how well the user canwork with your program. At the moment, cursors can only be 16 pixels square.Be sure that the hot spot -- the actuallocation passed to applications when a mouse button is pressed -- is veryobvious. Good hot spots are the tip of the hand cursor, the point of anarrow, or the center of a crosshairs. Use the full dimensions available toincrease the cursor's visibility at high screen resolutions.</para><para><emphasis>NOTE:</emphasis> There is not nor will there ever be a busycursor in BeOS-based operating systems. This is a deliberate designdecision. If you have a need for a busy cursor, you need to make yourprogram more responsive. Often you can use multiple threads to eliminate theneed for a busy cursor.</para></sect1><sect1><title>Animating Cursors</title><para>While Haiku does not provide explicit support for them, you can animatecursors to provide a little more graphical appeal. As with any kind ofmovement in the display, use animation sparingly so that it is notdistracting.</para></sect1></chapter><chapter id="chapter9"><title>Menus, Menu Bars, and Menu Fields</title><para>Menus are everywhere, but common as they may be, far too many programscould use them better. Attention to small details in a program's menus isone common difference between good programs and great ones. A developer canpack a lot of features into a small space and still not force the user toremember it all. Menus afford exploration of the interface in steps. Thischapter will focus primarily on issues related to menus in general. Pop-upmenus and menu fields are discussed in Chapter 12.</para><sect1><title>Naming and Organization</title><para>Choosing good names for menus and menu items is generally not difficult. Amenu should have a name which is short and accurately describes the kinds ofitems it contains. For instance, a File menu should not have Copy and Pasteitems in it. The name for a menu item should both concisely and accuratelydescribe the function it performs. Items are capitalized as described inChapter 6 and an ellipsis is used with any item which requires furtheraction. If a menu item opens a window, the names of both the item and thewindow should be the same.</para><para>Two ways to organize menus are the Noun-Verb method and the Verb-Nounmethod. Noun-Verb names menus after the kind of object that it operates onand items in the menu are actions which can be performed on the object. Forexample, the File menu contains items such as Open, Print, Save, and Close.Verb-Noun names menus with an action and the items are objects which theaction can be performed on. Two example menus could be View and Go. Some"standardized" menus, such as the Edit menu, do not follow eithermethod.</para><para>Items should be organized and grouped by function and/or attribute. Use aseparator item between each item group. An example of this would be an Editmenu which looks like this:<literallayout>_________| Edit ||-------|| Undo || Redo ||-------|| Cut || Copy || Paste ||_______|</literallayout></para><para>Undo and Redo perform related, though opposite, functions. Cut, Copy, andPaste are all clipboard functions, so the belong in a group separate fromUndo and Redo. A font menu would group font styles together. When organizingthe menus in a menu bar, try to have a logical progression from one menu toanother. A financial program might have these menus: Program, File, Account,Transaction, and Help.</para><para>Submenus are another possibility for grouping menu items, particularly forattributes. They should be avoided when other options exist because theyslow the user down and also add complexity to the interface.Users may also have trouble navigating to submenus because of the finemotor skills required. If your submenu has 6 or more items in it, considerplacing them in their own top-level menu.</para></sect1><sect1><title>Marking and Toggling Items</title><para>Menus can also contain items which indicate the state of a feature, suchas the visibility of a tool window. The preferred method is to place a checkmarkbeside the item indicating the positive state. This is less confusing than todynamically change menu item labels and has the advantage that it can be usedfor choosing from more than two states at the expense of screen space. Whenthere are more than two states, all possible states need to be listed in orderto prevent confusion.</para><literallayout><emphasis>Examples of Good Toogling/Multiple State Item Usage</emphasis>|Help|-----------------------Open manualβ¦-----------------------* Show tooltips-----------------------Go to the MyApp website-----------------------|Font|-----------------------Choose font and sizeβ¦-----------------------* NormalBoldItalicsBold italicsStrikeoutUnderline-----------------------</literallayout></sect1><sect1><title>Common Menus and their Contents</title><para>Below are descriptions for menus that are common to many programs. Becausethey are so common, there are some guidelines to their use so that there issome consistency from program to program. With the exception of the Programmenu, each of these menus should be used only if they make sense for yourprogram.</para><variablelist><title>Program: Items related to operating on the program itself.</title><varlistentry><term>About <app name here>β¦ </term><listitem><para>Showsthe About window. This is not a commonly-accessed item, so do not provide akeyboard shortcut for it.</para></listitem></varlistentry><varlistentry><term>Settingsβ¦</term><listitem><para>Show thewindow which is used to customize settings for your program. This can be asubmenu if your program only has a couple of settings.</para></listitem></varlistentry><varlistentry><term>Quit (Command + Q) </term><listitem><para>This should be thebottom item in the menu and a separator should go above it. Clicking on thisitem should close all windows and quit the program.</para></listitem></varlistentry></variablelist><variablelist><title>File: This contains items related to documents handled by your program.</title><varlistentry><term>New (Command + N) </term><listitem><para>Create a new document. This item shouldhave an ellipsis if it shows a window asking for further information (forexample, canvas size for a drawing program), but not if itdoesn't.</para></listitem></varlistentry><varlistentry><term>Openβ¦ (Command + O) </term><listitem><para>Open a document from disk.</para></listitem></varlistentry><varlistentry><term>Open recent </term><listitem><para>This is a submenu in the File menu to allowfast access to recent documents. It should not open a window of any kindexcept if your program uses a one-window-per-document architecture. Thenumber of recent items should be limited to no more than 5items.</para></listitem></varlistentry><varlistentry><term>Close (Command + W) </term><listitem><para>The function of this item depends onthe program architecture. In a program which has one document per window,this closes the window. If there is only one open window, this quits theprogram. Although it is not recommended, if a program allows for multipledocuments to be shown in the same window, this item closes onedocument.</para></listitem></varlistentry><varlistentry><term>Save (Command + S) </term><listitem><para>Save the current document. This shouldnot show a window unless it is a new document that has not yet been saved.It does not normally show a window, so no ellipsis isnecessary.</para></listitem></varlistentry><varlistentry><term>Save asβ¦ (Command + Shift + S) </term><listitem><para>This performs the samebasic kind of task as Save, but it always shows awindow.</para></listitem></varlistentry><varlistentry><term>Save all </term><listitem><para>This item executes a Save command for alldocuments in the program. The procedure for handling new documents whichhave not yet been saved is as follows: <para><orderedlist><listitem>Remember the current document window</listitem><listitem>For each document needing a name, bring it to the front, open aSave window, save the document, and proceed to the next document needinga name.</listitem><listitem>When all documents have been processed, bring the window which wasoriginally the active one back to the front.</listitem></orderedlist>Note that the same procedure is to be applied when closing the program.</para></para></listitem></varlistentry><varlistentry><term>Revert </term><listitem><para>Undoes all changes made to the document since thelast save.</para></listitem></varlistentry><varlistentry><term>Import fromβ¦ </term><listitem><para>Import data from another file format into anew document. Like Openβ¦, this always shows awindow.</para></listitem></varlistentry><varlistentry><term>Export toβ¦ </term><listitem><para>Convert the data in the current document toanother format. Like Save asβ¦, this always shows awindow. This should be reserved for lossy conversions. If your programcan save its data in multiple formats without any information loss,these should be available in the Save and Save asβ¦ menu items instead.</para></listitem></varlistentry><varlistentry><term>Page setupβ¦ </term><listitem><para>Shows the page settings window for printersetup.</para></listitem></varlistentry><varlistentry><term>Printβ¦ (Command + P) </term><listitem><para>This always shows the print windowbefore printing the current document. This is not intended to be the same aswhen a toolbar button is pressed.</para></listitem></varlistentry></variablelist><variablelist><title>Edit: Items in this menu are used for different editing tasks</title><varlistentry><term>Undo (Command + Z) </term><listitem><para>Undoes the most recently performededit. When possible, this item should be dynamic and also include the nameof the task that it would undo, such as 'Undo Cut' or 'Undo Typing.' Useroperations which do not change document data, such as changing zoom levelsor the like, should not be included in Undooperations.</para></listitem></varlistentry><varlistentry><term>Redo (Command + Shift + Z) </term><listitem><para>Undoes the most recent Undooperation. Like Undo, this menu item should also be dynamic whenpossible.</para></listitem></varlistentry><varlistentry><term>Cut (Command + X) </term><listitem><para>Copies the currently-selected data inthe current document to the clipboard and removes it from thedocument.</para></listitem></varlistentry><varlistentry><term>Copy (Command + C) </term><listitem><para>Copies the currently-selected data inthe current document to the clipboard.</para></listitem></varlistentry><varlistentry><term>Paste (Command + V) </term><listitem><para>Inserts the data on the clipboardinto the current document. If there is an existing selection in the currentdocument, the paste operation replaces the selected data with the pasteddata. Like undo and redo, this menu item should be dynamic according tothe clipboard content ('Paste Text' or 'Paste Image')</para></listitem></varlistentry><varlistentry><term>Select all (Command + A) </term><listitem><para>Selects all data in the currentdocument.</para></listitem></varlistentry> </variablelist><variablelist><title>Search: Tasks in this menu include finding and replacing data and othernavigation commands.</title><varlistentry><term>Findβ¦ (Command + F) </term><listitem><para>This always shows a Find window forthe program. The Find window should then allow the user to choose whateveroptions he desires for the find and disappear when the actual find isexecuted.</para></listitem></varlistentry><varlistentry><term>Find again (Command + G) </term><listitem><para>This repeats the most recentFind. If no find has been performed in the program yet, it should show theFind window. Because this command does not normally show a window, noellipsis is needed.</para></listitem></varlistentry> </variablelist><variablelist><title>Help: Different ways that the user can learn more about your program andget help when needed.</title><varlistentry><term>Open manualβ¦ </term><listitem><para>Shows the manual for the program in a newwindow. The manual should never be shown in a BAlert, prefer opening anHTML or read-only text file (using the preferred application set by theuser), or showing a non-editable text view from which the text canbe copied.</para></listitem></varlistentry><varlistentry><term>Go to (MyApp or MyCompany)'s website </term><listitem><para>Opens the defaultweb browser at the website for the program or the program's company,respectively.</para></listitem></varlistentry> </variablelist></sect1></chapter><chapter id="chapter10"><title>Windows</title><sect1><title>You Need the Basics</title><para>Windows are such common controls that every developer should know thebasics of how to use them properly. Some operating systems suffer from theoveruse and abuse of windows, such as bizarre error messages, incessantconfirmations, wrong window types for tasks, and many other mistakes. Learnthe proper ways of working with windows and you will have overcome a majorusability hurdle.</para></sect1><sect1><title>Styles and Purpose</title><para>Haiku allows you to specify the look and feel when creating a window.Setting these properly will help the user immediately know what kind ofwindow they are dealing with, and it also restricts the operationsthey are allowed to perform on it.</para><segmentedlist><segtitle>Look</segtitle><segtitle>Purpose</segtitle><seglistitem><seg>Document</seg><seg>Windows containing a user document, such as an editor or viewer</seg></seglistitem><seglistitem><seg>Titled</seg><seg>General purpose</seg></seglistitem><seglistitem><seg>Floating</seg><seg>Tool and utility windows</seg></seglistitem><seglistitem><seg>Modal</seg><seg>Modal window</seg></seglistitem><seglistitem><seg>Bordered</seg><seg>Alert-type dialog windows</seg></seglistitem><seglistitem><seg>Borderless</seg><seg>Splash screens</seg></seglistitem></segmentedlist><segmentedlist><segtitle>Feel</segtitle><segtitle>Purpose</segtitle><seglistitem><seg>Normal</seg><seg>General purpose</seg></seglistitem><seglistitem><seg>Modal:Subset</seg><seg>Only when you need to block all windows in a subset</seg></seglistitem><seglistitem><seg>Modal:App</seg><seg>When a user decision is required to continue with the rest of the program</seg></seglistitem><seglistitem><seg>Modal:All</seg><seg>When the user needs to make asystem-critical decision, such as system shutdown confirmation. Use thisfeel only when you absolutely have to.</seg></seglistitem><seglistitem><seg>Floating:Subset</seg><seg>When a subset window needs to takepriority in its subset.</seg></seglistitem><seglistitem><seg>Floating:App</seg><seg>Tool and utility windows</seg></seglistitem><seglistitem><seg>Floating:All</seg><seg>System monitors and other windows whichthe user will always want to have visible. Like Modal:All, use this onlywhen absolutely necessary.</seg></seglistitem> </segmentedlist><segmentedlist><segtitle>Type</segtitle><segtitle>Look + Feel</segtitle><seglistitem><seg>Titled</seg><seg>Titled + Normal</seg></seglistitem><seglistitem><seg>Document</seg><seg>Document + Normal</seg></seglistitem><seglistitem><seg>Modal</seg><seg>Modal + Modal:App</seg></seglistitem><seglistitem><seg>Floating</seg><seg>Floating + Floating:App</seg></seglistitem><seglistitem><seg>Bordered</seg><seg>Bordered + Normal</seg></seglistitem></segmentedlist><para>Probably 90% of the time you will end up using Titled and Document windowswith an occasional floating window. Borderless windows are used frequentlyfor splash windows that are displayed as a program is loading. Borderedwindows, which, by the way, do not have a window tab, aren't used muchexcept in BAlerts. Modal windows shouldn't be used more than is absolutelynecessary for reasons explained under the Modality section in thischapter.</para> </sect1><sect1><title>Naming, Placement, Size, and Other Decisions</title><para>Merely knowing what kind of window look and feel to use in a givensituation is not enough: you also have to be aware of resizing, zooming,moving, closing, and minimizing because they affect your program indifferent ways. Once you know what kind of window you need, you should alsofigure out what its initial size and location are going to be. You alsoshould not restrict the other actions a user can perform on a window unlessyou have a good reason that does not include "I don't want to write code tohandle this."</para><para>Care should be given to what name is used for a window. The main window ofyour program should include your program's name. Windows which were openedfrom a menu item should have the same name as that of the menu item withoutthe ellipsis. Document windows should include the document's name. The firstnew document in the application should use the name "Untitled" withsubsequent new documents appending a number. A titled window should neverhave an empty title bar.</para><para>The size of a window depends on a number of factors. An application windowshould have an initial size which is the minimum needed to see all controlsin it without overcrowding. Controls should never overlap. This initial sizeshould also be the minimum size for the window which is passed toSetSizeLimits. The initial size for a document window should be large enoughto see the entire document or at least a significant portion of the documentif it is larger than the screen. Do not arbitrarily restrict resizing unlessit does not make sense to allow resizing in a particular direction. If awindow allows resizing, its size should generally be saved when closed orthe program quits and restored to that size when shown again.</para><para>Zooming is similar to resizing, but there are differences in which shouldpermit zooming and how it should be done. Utility windows, for example, arenot intended to be the main focus of the program, so they should not allowzooming even though they should allow resizing except where inappropriate.Document windows should expand to fill the most sensible space to allowviewing or editing. Often times this is the entire screen, but some forsome programs, this doesn't make sense. An image viewer, for example, shouldset its size to fit exactly the image currently being shown at its currentzoom level.</para><para>The placement of a window on the screen also varies depending on itsusage. Program windows should initially either show themselves in the centerof the screen or just a little above it (use BWindow::CenterOnScreen).The same goes for the initialplacement of a document window. Additional document windows should duplicatethe most recent document window's frame offset by the window tab height in bothdirections. As with size, a program should generally remember the screenplacement of the windows and movement should not be restricted unless thereis a good reason for it.</para><para>A window need not always be visible. Duh. Considering that it can behidden or closed altogether may be a bit confusing. Generally, a documentshould allow minimizing to make it possible for the user to get the document"out of the way" for a moment without having to close it entirely. Utilitywindows and program windows which are not the main window should normallynot permit minimizing and just allow closing. The main window should allowminimizing. Note that when a program is not the focus, utility windows withthe Floating:Subset and Floating:App behaviors will be hidden. Windowsshould normally be allowed to close unless there is a very good reason forit.</para><para>A number of times in this document it has been mentioned that you shouldnot prevent something unless there is sufficient reason to do so.Particularly on other platforms, developers have been known to just disallowresizing because they didn't want to bother themselves with writing handlercode. There are other instances where, for example, a window could not beclosed because the code had a design flaw which would cause a crash if thewindow were closed. Remember: the more work you do in making your programhelpful means the less work the user has to do, which means that yourprogram is easier to use.</para></sect1><sect1><title>B_ACCEPTS_FIRST_CLICK</title><para>In MacOS X, the feature this flag enables is called click-through. Itmeans that clicking on the window passes the click through to the controlthe mouse was under at the time even when the window does not have thefocus. As a rule, this behavior should not be used, but there are times whenit is quite useful, such as for system monitor programs, the Deskbar, and soforth. Typically, this flag is used for "helper" applications and utilitywindows. Note that the user can override this from the Mouse preferencesif they wish so, forcing all windows to accept the first click.</para></sect1><sect1><title>Modality</title><para>By default, windows in BeOS operating systems are modeless, meaning thatyou can click on other windows besides the one with the focus. Occasionally,there is a need to force the user to make a decision before moving on. Thisis an appropriate time to use a modal window. The need is far less oftenthan what many would believe, however. Most of the time the only reason touse a modal window would be if not doing so would make potential for theuser to lose data and there is nothing that can be done to the codearchitecture to prevent it. This follows the "no restrictions for no goodreason" way of thinking mentioned above -- modal windows place restrictionson what windows he can or can't click on. </para></sect1></chapter><chapter id="chapter11"><title>Special Purpose Windows</title><sect1><title>Alert Windows</title><para>Alert windows are the single easiest way to make usability mistakes. Mostoften, they are used to show error messages. The problem is that they areused *far* more often than they should be and the error messages that areused in them are too technical for a regular user to understand or are justplain useless. They are also used to ask the user a question. More oftenthan not, the question that is asked could have just as easily been answeredby the developer, had he thought ahead a bit. Do just about whatever ittakes to gracefully handle errors without bothering the user. Only when allother options have been exhausted should you show an error message. For helpon writing good error messages, see Chapter 6.</para><para>Before you ask the user a question, be sure that it is one which youhonestly can't answer yourself or can't do without possibly disturbing theway the user works. For example, it is good courtesy to ask the user if hewould like your program to be the default handler for a particular kind offile when your program is installed. It is *never* acceptable to ask theuser "Are you sure you want to quit?" If your program is asked to quit,handle unsaved documents and quit. "Are you sureβ¦" questions should beasked only if the action involves the undoable destruction of data, such asdeleting a file instead of moving it to the Trash. Avoiding these kinds ofsituations entirely is a better solution. If the confirmation is asked toooften, the user will develop the habit of confirming it without a secondthought and your asking the question will be rendered moot.</para><para>When you do use an alert window, please follow these guidelines:<orderedlist><listitem><para>On a notification, such as an error message, use "OK" for the label of the button</para></listitem><listitem><para>When asking a question, make the least destructive of the most common choices the default.</para></listitem><listitem><para>Avoid Yes / No button labels. It is much better to use the nameof the action in the label, such as Save Changes / Discard Changes. Onlyin *very* rare cases are Yes / No labels the bestchoice.</para></listitem></orderedlist></para></sect1><sect1><title>Find Windows</title><para>Windows used to search for data in a document are not very different fromothers, but how they are used can help, hinder, or annoy the user whensearching. It only needs to be shown when the user needs to set the searchterms. Once they are set, the window should itself disappear and the searchshould be performed. A find window which stays visible clutters the screenand often obscures part of the current document, even the result of thesearch. It also places the program in a separate mode, which shouldgenerally be avoided. The search itself should default to case-insensitivesearches with an option to allow case sensitivity. Search by regularexpression is an option that should normally be limited to programs whichhave programmers as the intended audience.</para></sect1><sect1><title>Settings Window Design</title><para>Windows to allow the user to change various program settings are anotherplace where developers commonly commit a usability faux pas or two. The mostcommon mistakes are poorly-chosen defaults, inappropriate language for thetarget audience, and too many choices. Here are some guidelines for making agood one:<itemizedlist><listitem><para>Choose defaults which fit the most number of people.</para></listitem><listitem><para>When possible, have changes take place immediately instead ofrequiring the user to click OK. If you do this, provide buttons torevert changes and also to set the default values.</para></listitem><listitem><para>Provide settings for significant features. This would includethings like default file format for CD ripper, European vs American dateformat (although the system-wide setting should be used instead),or the default account in a mail client. Unncessary settingsinclude "Use Ins key for paste" and "Confirm Program Quit".</para></listitem><listitem><para>Use language appropriate for the target audience as mentioned inChapter 2. For example, the web browser option "Move system caret withfocus/selection changes" requires some technical knowledge. A better wayto label such an option would be "Allow text to be selected with thekeyboard." Both refer to the same option. The difference is how manypeople can understand what it does.</para></listitem> </itemizedlist></para></sect1><sect1><title>Open and Save Panels</title><para>BFilePanel is used for both opening and saving files, but there is more tousing them well than merely showing a list of files. Remember the locationthe user was viewing, and if it is inaccessible for some reason, show theHome folder. When possible, make use of file filters to eliminate files yourprogram does not handle. By filtering out "bad" files, you eliminate errorsand at the same time reduce the amount of time the user needs to find thefile he wants by reducing the number of options. Offering a possible filename when saving a new document is another way to help the user. The titleof the panel needs to match the task, whether it is Import, Export as,Save as, Save, Open, or something else.</para></sect1></chapter><chapter id="chapter12"><title>Controls</title><para>BeOS operating systems, while perhaps not as fully-featured as others,possess controls which are the bread and butter of working with GUIprograms. Their basic usage is obvious to most, but for the sake of thosenot sure and for those who want their programs to be the very best, they arecovered in detail from the basics to advanced details.</para><variablelist><varlistentry><term>Buttons</term><listitem><para>Buttons are all around us in the computer world and in the real one, too. Abutton is used to invoke a command or, much less often, show a window.<table frame="all"><title>Do's and Don'ts of Buttons</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Use GetPreferredSize and ResizeToPreferred to reduce your work</listitem><listitem>Avoid using one button for opposite functions without appropriate feedback</listitem><listitem>Leave sufficient padding around them</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Make them too small or ridiculously large -- like 100 pixels squarefor the word 'OK' when the font size is 10 point.</listitem><listitem>Leave them blank</listitem><listitem>Show a menu with one</listitem><listitem>Use them for labels</listitem><listitem>Change the label font</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Checkboxes</term><listitem><para>Checkboxes are like a light switch with a label attached to it. Aside fromturning an option on or off, they can also be used for quickly choosingmultiple selections in a list of choices.<table frame="all"><title>Do's and Don'ts of Checkboxes</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Label checkboxes so that the user understands ahead of time what clicking on it will do.</listitem><listitem>Use care in calculating bounding boxes</listitem><listitem>Carefully choose label text</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use them for choosing one item from a list. Use a group of radio buttons instead.</listitem><listitem>Use a checkbox in place of a button</listitem><listitem>Use a list of checkboxes as a progress indicator</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Radio Buttons</term><listitem><para>Radio buttons are used to choose an exclusive choice from a list of choices.They can also be used to turn an option on or off if you have plenty ofspace.<table frame="all"><title>Do's and Don'ts of Radio Buttons</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Label radio buttons so that the user understands ahead of time what clicking on one will do.</listitem><listitem>Use care in calculating bounding boxes</listitem><listitem>Set a default value</listitem><listitem>Carefully choose label text</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use them individually or use them the same way as checkboxes</listitem><listitem>Use more than 5 or 6 in a group. Consider a list view instead.</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Control Groups</term><listitem><para>Control groups, namely, the BBox class, are often abused because they arenot well-understood. Control groups are for visually associating differentcontrols which work together for a common function. Unfortunately, they aremost often used just for fluff.<table frame="all"><title>Do's and Don'ts of Control Groups</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Label control group</listitem><listitem>Use control groups when there are lots of controls in window</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use a control group to label a single control</listitem><listitem>Nest control groups</listitem><listitem>Use a control group around all controls in a window</listitem><listitem>Mix control group border styles</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Sliders</term><listitem><para>Sliders are a good way to allow a user to choose a value that must be withina certain range, especially if the effect isn't exactly concrete or thevalue has no meaning to the user. Good uses for sliders include settingvolume, mouse acceleration, and movie playback position.<table frame="all"><title>Do's and Don'ts of Sliders</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Label the ends of the slider</listitem><listitem>Show tick marks for each value if your slider has distinct increments</listitem><listitem>Place the largest value at the right or top</listitem><listitem>Use the appropriate orientation</listitem><listitem>Label each slider position when the increment size changes, such as logarithmically</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use a slider for a progress indicator or scrollbar</listitem><listitem>Label each slider position for sliders with fixed increment sizes</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Labels</term><listitem><para>Labels help the user know what a particular control is for. Most of thecontrols in the BeOS API include and handle their own labels. This sectiondeals with both the labels included with controls and ones created on theirown.<table frame="all"><title>Do's and Don'ts of Labels</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Label controls</listitem><listitem>Use a separate label when layout makes it hard to use a control's built-in label.</listitem><listitem>Use proximity to associate labels with their controls</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use a label for large amounts of static text. Consider a read-only text view.</listitem><listitem>Use a separate label object for controls which have label functions built-in</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Text Controls</term><listitem><para>Text controls are one-line editable text boxes. They are useful for enteringtext into forms.<table frame="all"><title>Do's and Don'ts of Text Controls</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Disable characters you don't want in the field</listitem><listitem>Try hard to validate text entered</listitem><listitem>Make them large enough to accommodate the length of common entries</listitem><listitem>Allow clipboard operations when possible</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use a text control for a label</listitem><listitem>Make them too small</listitem><listitem>Use them for static text</listitem><listitem>Arbitrarily limit the number of characters without a very good reason</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Text Views</term><listitem><para>Text views are multiline text controls. They also provide undo, styled text,and a number of other useful text functions.<table frame="all"><title>Do's and Don'ts of Text Views</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Disable editing if you use one to display static text</listitem><listitem>Allow both undo and selection of text unless there is a good reason not to</listitem><listitem>Allow clipboard operations when possible</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use one for single-line input</listitem><listitem>Forget to pad the text rectangle inside the text view</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Lists</term><listitem><para>Lists are used to display lots of individual items, possibly in a hierarchy.They can also allow multiple or single selections.<table frame="all"><title>Do's and Don'ts of List Views</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Provide a way to select all items in multiple-selection lists.</listitem><listitem>Sort your list</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use just enough space to display just a couple of items</listitem><listitem>Try to use it to select from hundreds of items. Use a search instead.</listitem><listitem>Use list items to toggle options like a list of checkboxes</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Tabs</term><listitem><para>Tabs can be quite handy for displaying multiple views in a small space.Unfortunately, they seem to suffer from being too easy to abuse.<table frame="all"><title>Do's and Don'ts of Tabs</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Use tabs to manage and organize otherwise complex dialog windows</listitem><listitem>Use a list instead of tabs to manage large numbers of views</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use tabs to select a particular mode</listitem><listitem>Nest tab views</listitem><listitem>Use so many tabs that a scrolling is needed to see them all</listitem><listitem>Place confirm / cancel buttons inside tabs</listitem><listitem>Overlay toolbars by using tabs</listitem><listitem>Use vertical text with vertical tabs</listitem><listitem>Use tabs on more than one side at once</listitem><listitem>Use one tab all by itself</listitem><listitem>Use unlabelled icons for tab titles</listitem><listitem>Use a scrollbar to scroll a form inside a tab</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Scrollbars</term><listitem><para>Scrollbars, unlike tabs, tend to not be abused. Use them to display moreitems than can fit on the screen, but don't overuse them.<table frame="all"><title>Do's and Don'ts of Scrollbars</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Adjust range and step size when their target view is resized</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Scroll forms</listitem><listitem>Try to customize their look</listitem><listitem>Use them like a slider control</listitem><listitem>Nest BScrollViews</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Menu Fields</term><listitem><para>Menu fields are buttons which display a label and pop up a menu when clicked.<table frame="all"><title>Do's and Don'ts of Menu Fields</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Use them in place of radio buttons when space is limited</listitem><listitem>Remember to follow the menu construction guidelines mentioned in Chapter 9</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use them instead of a menu bar for the main program menu</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Pop-up Menus</term><listitem><para>Pop-up menus differ from regular menus in that they can be invoked fromanywhere on the screen.<table frame="all"><title>Do's and Don'ts of Popup Menus</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Make pop-up menus sticky</listitem><listitem>Use pop-up menus for context menus</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Show a pop-up menu by clicking on a button or do other similarnonsensical control daisy-chaining.</listitem><listitem>Use a pop-up menu as a tooltip</listitem><listitem>Use the primary mouse button to show a context menu</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Progress Meters</term><listitem><para>BStatusBars are used to show progress in BeOS operating systems.<table frame="all"><title>Do's and Don'ts of Progress Meters</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Choose a color carefully if you don't use the default</listitem><listitem>Use them whenever an operation has the potential to take a while</listitem><listitem>Properly label the progress bar</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Use a slider or scrollbar for a progress bar.</listitem><listitem>Use a progress bar as a control separator</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry><varlistentry><term>Toolbars</term><listitem><para>Toolbars are little more than a collection of graphicalbuttons. They are used for providing fast access to commonly-used functions.<table frame="all"><title>Do's and Don'ts of Toolbars</title><tgroup cols="2" align="left" colsep="1" rowsep="1"><colspec colname="c1" /><colspec colname="c2" /><thead><row><entry>Do</entry><entry>Don't</entry></row></thead><tbody><row><entry><itemizedlist><listitem>Use them to speed up access to common functions</listitem><listitem>Use icons from the standard set if possible</listitem><listitem>Make the function of each button obvious from the icons used</listitem><listitem>Follow the specific icon guidelines for toolbar icons</listitem></itemizedlist></entry><entry><itemizedlist><listitem>Add a toolbar just for looks</listitem><listitem>Scroll toolbars</listitem><listitem>Use put too many buttons in a toolbar or have too many toolbars on the screen</listitem></itemizedlist></entry></row></tbody></tgroup></table></para></listitem></varlistentry></variablelist></chapter><appendix><title>How to Make a Good Error</title><para>By nature of not being perfect, developers make mistakes and no program iswithout its bugs. As mentioned earlier, conditions which could cause errorsshould be anticipated and handled as much as reasonably possible. In thoseinstances where there is nothing left to be done except show an errormessage, be helpful, polite, and as non-technical as possible.</para><sect1><title>Examples of Good Error Messages</title><para>Uh-oh... MyMP3Ripper couldn't create the playlist/boot/home/playlists/foo. This may have happened for a number of differentreasons, but most often happens when making playlists on a non-BeOS drive,such as one shared with Windows. Certain characters, such as question marksand slashes cause problems on these disks. You may want to check the namesof the artist, album, and songs for such characters and put a goodsubstitute in its place or remove the character entirely.</para><para>MyApp can't copy your file to the disk because there isn't enough spacefor it. If you would like to copy it, move or delete files on thedestination disk and try again.</para><para>MyApp didn't recognize the data in the file '/boot/home/foo'. It might notbe a MyApp file or perhaps the file is corrupted.</para><para>(From a website):: O No! If you are reading this message, it means we havemade a mistake. Don't worry, you can be sure that as you are reading thispeople are freaking out around here - testing circuits, rebooting systems,and even typing resumΓ©s (just kidding). Please try back in 5 minutes, as westill have plenty of great stuff.</para></sect1><sect1><title>Real World Examples of Bad Error Messages</title><para>Wrong Button! This button doesn't work. Solution: Try another.</para><para>The project file "e:\ws\foo" may have been modified on disk by thepreceding Source Control operation. However, you also have made changes tothis project which have not been saved. If you reload the project you willlose your current changes, but if you don't, you risk overwriting the newchanges on disk, which is usually much worse. Do you want to reload it now?[Yes] [No]</para><para>Mail Engine: No Error</para><para>Spell Check Cancelled</para><para>Unexpected Error. Please investigate.</para><para>System Error 0x80004005 (02147467259). Unspecified error.</para><para>Question or information that needs the user's immediate attention.</para></sect1></appendix></book>