To order Alpha Four or Alpha Five, click above to go directly to Alpha, or call 800.451.1018 or 781.229.4500

             
Alpha Newsletter

Monday, July 1, 2002 Issue 5   VOLUME 1 ISSUE 5  
HOME
TOPICS
News & Notes
Tips & Tricks
Tech Corner
Xbasic CliniX
CONTENTS
Version 5 is REALLY Close!!
Alpha Plans Integration between Alpha Five and QuickBooks
Xbasic CliniX
Get a Handle on Alpha Five's Files
Understanding Referential Integrity
Bubble Help in Alpha Five version 5
Define a Starting Position for Labels
Auto-Increment Improved Again
Custom Toolbars
Barcoding in Alpha Five - Part 1
Solving a Word Processor Challenge
Pass the Objects Please
Custom Toolbars
TC056
by Bill Warner

The toolbar is a very convenient way to perform many tasks.  However, not every application is suitable for use with every button in the standard toolbar.  Therefore, designing a custom toolbar is a quick way to provide the user with the buttons they need, while eliminating the buttons that you don't want them to use.

First of all, let's look at the default toolbar used with a form:



You probably know that you can move your mouse pointer over one of the buttons, and after a second or so a "tool tip" will appear.  This is a little box that tells you what this button will do.

As you look at this toolbar, you might identify some buttons that you don't want.  For example, the Form View button isn't particularly useful, since you're already in the form.  Also, the last button will take you to the control panel. This might not be desireable for users who shouldn't have access to it.

Also, there might be some tasks that you would like the user to do by clicking a button, but that button isn't on the toolbar.  For example, a button that allows the user to select a different index could be handy.  As it turns out, there are many buttons that aren't in the default toolbar.  And, if you want to perform a task for which no button exists, you can create one and attach a script to it.

As an example, here's a toolbar that I use for many of my customers:



First, let's look at what I have removed.  The first space looks blank, as if there should be a button there.  In fact, the Design button really is there, but it doesn't show.  I did this (see below for how) so I could easily edit a customer's form, but the customer would not see, and could not access this button (since all my customers' apps are in Runtime, the design button doesn't function anyway).  I could have left the button there, but there are always customers that ask, "What's this for??"  Since the button isn't visible, they don't ask.

I also removed the Form button (as explained above), plus the three buttons that relate to printing.  If a customer wants to print the contents of a form, I design a report for them.  I don't want them to print the form.  Then I removed the Cut, Copy, and Paste buttons (although a few of my customers like them, so I leave the buttons in for them).

Next, I took out the Query Genie button.  I don't like to include this, because it shows the customer a screen in which they have to select the fields for the query.  This might be OK for a simple app, but many times the apps evolve over time, and sometimes the field names become somewhat cryptic.  I would prefer that the customer not be bothered with this.  I feel that Query by Form is a suitable alternative.1

Finally, I removed Find by Form.  I think this is redundant when using Find by Key, which I prefer.

Now, for the buttons I have added:

First of all, I added Undo and Redo.  While these can be emulated by using ALT-BKSPACE, I feel that the buttons are more intuitive.  I also added Refresh, because there are some occassions where this is useful (i.e., this will update, or refresh, a field on the parent that is posted from the child).

Then I added Index and Locate.  I think that Index is almost indispensible, since there are very few times when a user does not want to change indexes, and subsequently find a record using Find by Key.  Plus, Locate is also very useful when you want to find a text string in a field.

Finally, I added the Statistics button, and an Exit button.  Statistics is useful for some (but not all) applications.  The Exit button, however, is something I always include.  Even though many Windows users are used to clicking on the X in the upper right corner, many of my customers aren't that familiar with Windows.2  Therefore, I want my forms to be as intuitive as possible.

All the buttons I that added, except for the Exit button, are available as built-in actions.  By this, I mean that you can select these buttons from the Toolbar Design screen (shown below).  However, the Exit button needs to have a script attached to it.  So, that takes us to:

HOW TO CREATE A CUSTOM TOOLBAR

From the Control Panel, click on the Code tab, then click on New to see the types of Code Objects available, select Toolbar, and click Next.  When prompted for the type of toolbar, I usually select Form view Toolbar (since I'll be using many of the default buttons).  Then click on Finish.  You will see a screen that looks like this:



In the top left corner, I have checked both Dockable and Docked, with Top selected under Docked on:.  Below this, in the Category window, is a list of items, and the buttons available for each item are shown to the right.  As you move your pointer over each button, its actions are shown in the Description box below.  As you select different items in Category, different buttons appear to the right.  This is a good starting point for adding buttons.  When you find a button you want to add, click and drag the button to the location you want in the toolbar shown at the top.

In the picture shown, the first button, Design, is shown under Control on the right side of the screen.  Below that, the Tool Tip (the text that shows when you move your pointer over the button) is shown, and the bitmap that will appear on the button is shown below that.  On my toolbar, the Design button is blank.  I got this by clicking on each button (below Bitmap and Pressed Bitmap), and then scrolling down the list until I found a blank (this is also where I found the Exit bitmap).

To add the buttons I wanted, I went to each category, looked at the buttons, and dragged them into place on the toolbar.  To remove buttons, I clicked on the button, and dragged it below the toolbar, then released the mouse button.

For the Exit button, I first selected a random button (since I changed it, the button that was selected is unimportant) and placed it on the toolbar.  Then I selected the button bitmap for this button as described above.  Then, under the bitmaps, I clicked on the arrow next to Type and selected Play Xbasic Commands.3  Here I put:

parentform.close()

This completed the buttons on my custom toolbar.  However, I decided to make one more change to the buttons.  

All the buttons have a Tool Tip (I had to add "Exit" for the Exit button).  But some of the tool tips aren't as intuitive as they could be.  For example, Enter is not the first thing that comes to mind when I think of creating a new record.  I think New is more obvious, and New record is even better.  So, I changed that Tool Tip.  I also changed others to make them easier to understand.  For example, I changed Next to Next record, etc.  Admittedly, these choices reflect my personal preferences.  But my point here is that you can change the Tool Tips to whatever you want.

Finally, my tool bar was complete.  I saved it and named it, so I could use it with all my forms.  I have also designed tool bars that are customized versions of this tool bar for special forms.  I also have a slightly different one for browses.

Hopefully, you can see from this example how versatile the tool bars can be.  You can even design your own bitmap if you wish.  Just let your imagination be your guide, and chances are Alpha Five will give you a way to do it.


1 Actually, most of my customers use Query by Form, finding it very intuitive.

2 I design apps so someone who has never used a computer can use the app with minimal training.  You'd be amazed at how many compliments I get on this simple idea!

3 The Exit button is a very simple example of what can be done with toolbar buttons.  You'll notice that under Type, you can also play a global script.  Just imagine the different things you can do with that!!

[PRINTER FRIENDLY VERSION]
Powered by iMakeNews.com