29
Fri, Nov
0 New Articles

Graphical Controls: An Introduction

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

One of my favorite war stories is about the user who asked to have his reports printed sideways. (This was in the days of band printers.) The user said he could get his reports printed sideways on his PC, why couldn't he do the same thing on the S/38?

The point I'm illustrating with that story is that users have certain expectations based on their experiences with personal computers. One of the worst questions that you may have to face as a client/server programmer is why the application you developed works differently from Word, Excel, or whatever application the user works with.

For pure green screen programming, the standard is Systems Application Architecture (SAA). It defines, among other things, that F3 is exit and F1 is help. Users come to expect conformance to this standard. On the PC side, Microsoft has set standards about the way the Windows user interface works. If you want happy users (who doesn't?) you'll have to learn and conform to those standards.

When you start moving into graphical user interface (GUI) client/server development, you may encounter confusion about how all of the different types of graphical controls should be used. For most GUI development tools, you have a choice of labels, text boxes, and command buttons, just to name a few. Anything you put in a window is a control.

Each control, including the window itself, has a specific purpose and has events associated with it. An example of an event is mouse over, which is triggered when the user moves the mouse over a control. You might use this event to place help text for the control in the status bar. This article describes some of the controls found in most GUI development tools and the kinds of situations they are used in.

The accompanying figure shows a window demonstrating some of the controls. I created this sample window using Microsoft's Visual Basic (VB), but the controls I will discuss are also available in products like Powersoft's PowerBuilder and Gupta's SQLWindows. The names of the controls may differ among tools, but the concepts apply to almost any product you select.

From the Top

The figure displays extracts from an imaginary window. It shows data from a fictitious magazine's author database, including the author's name, gender, and title. I've created a list of the controls that might be on this window and I will start with the first one, which is a label.

The majority of the controls on this window are labels. For example, the column headings are labels. A label, though a simple thing, is possibly the most prevalent control in a graphical environment. A label is an output only field that doesn't really care about the type of data it shows. It is analogous to a constant field on a display file. The first label field in the figure is a box showing the value "Enter your name:"

The second control is a text box. This control allows the user to enter data for the program to use. A text box is similar to an input/output field on a display file. In the example, the entry is an author's name.

There are different kinds of text boxes. For example, a masked text box allows you to create a mask that defines what kind of data the user can enter in that field. You might restrict the user to enter only alphabetic characters or only numeric characters. The support for different kinds of controls varies depending on the development tool that you select. For example, not all development tools include a masked text box.

The third type of control illustrated is a command button. AS/400 programmers can relate a command button to a function key-it triggers some event to occur. In the example button shown, clicking on that button would exit the program.

On the button, the x in Exit is underlined. The underline defines the access key. It tells the user that holding the Alt key and pressing X is equivalent to clicking the Exit button.

When I typed "Exit" as the caption for the button, I put an ampersand (&) in front of the x. VB translates that into an underline and automatically intercepts an Alt-X and triggers the exit button's click event. This technique is common in most Windows development tools. Some tools use characters other than the ampersand to indicate the access key.

The fourth group of controls in the window consists of three check boxes. Check boxes indicate a true or false value. Some, none, or all of the values can be true.

For example, regarding the fictitious author, all three check boxes are selected, showing that the author is a programmer, a technical editor, and an all around good guy. None of those values are necessarily mutually exclusive. That's where check boxes differ from radio buttons.

Halfway There

The fifth group of controls demonstrates the use of radio buttons-in this case to allow the user to select the gender of the author. A radio button permits the user to select only one option from the list of choices. If the user clicks the Female radio button, the Male radio button is automatically deselected.

If you have more than one group of radio buttons, you will often need to create a frame around each group of radio buttons. (A frame is a method for grouping together controls that have the same purpose.) You might have one set of radio buttons to indicate gender and another set to indicate employment status. The frame groups the gender radio buttons separately from the employment status buttons so that when you tell the application the person has quit, the gender radio buttons remain unaffected.

The sixth control demonstrates a drop-down combo box. This control type lets the user select a value from a set of allowed values. In the example, the user is selecting a job title for our fictitious author from a list of certain job titles that the company has defined.

When the user clicks on the down arrow, the list of job titles drops down from the box, hence the name of the control. The user then clicks on the job title that's appropriate for the author. That job title is displayed in the box next to the arrow.

The seventh control is a list box. The easiest way to remember the purpose of a list box is to think of it as a simple subfile. One thing a list box doesn't handle well is multiple columns of data. The reason is that the normal font used for the data in the list box is a proportional font (meaning that each letter has a different size). With a proportional font, it's difficult to get the columns of data to line up properly.

Certain languages support a control, sometimes called a grid, that looks similar to a spreadsheet. The grid lets you put each column of data in a column on the grid so that it lines up correctly.

The last control is a scroll bar. It allows the user to control his positioning within a set of data. For example, the list box automatically has a scroll bar on the right side because there are more entries than the list box can display. The scroll bar lets the user move through the records in the list box.

You might use a scroll bar if the window is too small to show all the controls. The scroll bar would adjust the virtual position of the window, scrolling through the controls on that window.

Other Controls

Each tool has a slightly different set of controls; however, most tools have what I've described in this article. Many tools allow add-on controls similar to the masked text box that I described. You can purchase add-on controls for VB from many vendors and some of those controls work in other tools, like PowerBuilder and SQLWindows.

Each control has a specific purpose. If you use each control according to its designed purpose, your applications will behave more like the other applications your users are already using. This information about controls will allow you to design GUI applications that are more visually appealing and easier to use.

Jim Hoopes is a senior technical editor for Midrange Computing


Graphical Controls: An Introduction

Figure 1 Sample Controls

 UNABLE TO REPRODUCE GRAPHICS 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: