Regarding Controls

Question:

I have a window in which I've placed a number of SELF-ACT style radio buttons. When one of those buttons is clicked, I see the button flash but the previous control remains selected. What's going on?

Answer:

What you're seeing is correct, if confusing, behavior. Self-activating buttons have two traits: they don't generate CMD-GOTO events, and once the user is finished with them they reactivate the previously active control. In this case, clicking on the radio button turns it on and also completes the use, causing control to be returned to the previously selected radio button, turning off the button that was clicked. All this happens in a flash. The bottom line is, don't make radio buttons self-activating if you plan to ACCEPT them directly.

Question:

I have defined a TERMINATION-VALUE (or EXCEPTION-VALUE) for my push button. When I click on it, I get a status 96 instead of the value I have assigned. Is this a bug?

Answer:

What you are seeing is correct behavior. When you click on a push button with the mouse, two actions take place. First, when you press the mouse button down, the push button requests that the program activate it. It does this by generating a CMD-GOTO event, which is the status 96 that you are seeing. After it gains control, it waits for you to release the mouse button. At this point, the push button generates the termination or exception value that you have assigned to it. Although we talk about pushing a button, in reality, it is the act of releasing the button that is important. You can see this by running any Windows application and pushing a button down with the mouse. As long as you hold the mouse button down, nothing happens other than the push button appearing depressed and gaining the input focus. Once you release the mouse button, the program action associated with the push button takes place.

If you are using push buttons in a Screen Section entry, you usually don't see the CMD-GOTO events because the Screen Section handler responds to these events for you (although you can detect them in AFTER procedures and EVENT procedures). When you are managing the activation of controls directly in your program, it is your responsibility to detect these events and activate the appropriate controls.

Another possibility is to use the SELF-ACT style of push button. This style tells the button to automatically activate itself when pushed. It does not generate CMD-GOTO events.

Question:

I asked for a FRAME that was 20 characters wide. When I use the WIN3-GRID option, I can see that it is nowhere near that size. What's happening?

Answer:

Frames, like other controls, are normally measured in terms of their font. In the case of a frame, the font is the frame's title font (even if the frame is not given a title, it still has a title font). A frame of size 20 is a frame that is 20 title-font-characters wide. What the WIN3-GRID option shows you is the size of each character cell in the window. A window's character cell is normally the same as the size of its text font. If the window's text font and the frame's title font are not the same, a frame of size 20 will not occupy 20 character cells.

You can address this issue in one of four ways:

  1. You can use the CELLS option when specifying the frame's size (for example, SIZE 20 CELLS). This causes the frame to be measured using the window's cell size
  2. You can change the dimensions of the window's cell size to match the frame's title font (by using the CELL SIZE phrase when you create the window)
  3. You can make the frame's font and the window's text font the same
  4. You can use the PIXELS option when specifying the frame's size (for example, SIZE 200 PIXELS). This causes the frame to be measured using the screen's pixel size, and the resulting frame's size is unrelated to either the frame's title font or the window's text font.

Question:

How many items can I put in a standard list box or combo box?

Answer:

List box text limits are based on machine memory, which essentially equates to no limit.

A paged list box can handle an unlimited number of items. For more information, see Paged List Boxes.

Question:

When the runtime is putting data into a standard list box or combo box defined in the Screen Section, the last data item gets repeated. How do I prevent this?

Answer:

You need to move spaces to your ITEM-TO-ADD data item after you have finished filling the list box or combo box. Otherwise, the last data item it contains will be added to the box every time you DISPLAY that Screen Section box, or any of its parent group items.

Question:

When I use a property in a MODIFY statement, I get the compiler error Undefined data item: property-name. I know the property is the right one. Why do I get an error?

Answer:

The handle that you are specifying in the MODIFY statement is a generic handle (that is, USAGE HANDLE instead of USAGE HANDLE OF type). The compiler does not recognize style and property names when you reference a generic handle, because it does not know which set of names to use. To rectify this problem, declare the handle as a handle to the appropriate control type.

Question:

ACCEPT FROM SCREEN doesn't return anything!

Answer:

ACCEPT FROM SCREEN returns classical text-based fields, but not controls or the contents of controls (including entry fields). In other words, it reads the terminal emulator plane of the screen, but not the graphical plane. To determine the current contents of a control, use the INQUIRE verb.