User Tools

Site Tools


toolbar_declare_a_tool_bar_.htm
Navigation:  Language Reference > 6 - Windows >====== TOOLBAR (declare a tool bar) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

TOOLBAR [,AT( )] [,USE( )] [,CURSOR( )] [,FONT( )] [,NOMERGE] [,COLOR] [,LAYOUT]
[,WALLPAPER( )] [,   TILED    ]
CENTERED
controls
END

blk2blue.jpg

TOOLBAR Declares tools for an APPLICATION or WINDOW.
AT Specifies the initial size of the toolbar. If omitted, default values are selected by the runtime library.
USE A field equate label to reference the toolbar in executable code (PROP:USE). At runtime, PROP:TOOLBAR can also be used to return the Field Equate Label of a window's toolbar.
CURSOR Specifies a mouse cursor to display when the mouse is positioned over the TOOLBAR. If omitted, the WINDOW or APPLICATION structure's CURSOR attribute is used, else the Windows default cursor is used.
FONT Specifies the default display font for the controls in the TOOLBAR.
NOMERGE Specifies tools merging behavior.
COLOR Specifies a background color for the TOOLBAR and default background and selected colors for the controls in the TOOLBAR.
LAYOUT Specifies the control's left-to-right or right-to-left display orientation (PROP:LAYOUT)
WALLPAPER Specifies the background image to display in the toolbar (PROP:WALLPAPER). The image stretches to fill the entire toolbar unless the TILED or CENTERED attribute is also present.
TILED Specifies the WALLPAPER image displays at its default size and is tiled to fill the entire toolbar (PROP:TILED).
CENTERED Specifies the WALLPAPER image displays at its default size and is centered in the toolbar (PROP:CENTERED).
controls Control field declarations that define the available tools.

The TOOLBAR structure declares the tools displayed for an APPLICATION or WINDOW. On an APPLICATION, the TOOLBAR defines the Global tools for the program. If the NOMERGE attribute is specified on the APPLICATION's TOOLBAR, the tools are local and are displayed only when no MDI child windows are open; there are no global tools. Global tools are active and available on all MDI “child” windows unless an MDI “child” window's TOOLBAR structure has the NOMERGE attribute. If so, the “child” window's tools overwrite the Global tools.

On an MDI WINDOW, the TOOLBAR defines tools that are automatically merged with the Global toolbar. Both the Global and the window's tools are then active while the MDI “child” window has input focus. Once the window loses focus, its specific tools are removed from the Global toolbar. If the NOMERGE attribute is specified on an MDI WINDOW's TOOLBAR, the tools overwrite and replace the Global toolbar. On a non-MDI WINDOW, the TOOLBAR is never merged with the Global menu. A TOOLBAR on a non-MDI WINDOW always appears in the WINDOW, not on any APPLICATION which may have been previously opened.

Events generated by local tools are sent to the WINDOW's ACCEPT loop in the normal way. Events generated by global tools are sent to the active event loop of the thread which opened the APPLICATION. In a normal multi-thread application, this means the APPLICATION's own ACCEPT loop.

TOOLBAR controls generate events in the normal manner. However, they do not retain focus, and cannot be operated from the keyboard unless accelerator keys are provided. As soon as user interaction with a TOOLBAR control is done, focus returns to the window and local control which previously had it. Toolbar controls are not part of the normal TAB key navigation sequence, and act like controls with the SKIP attribute applied. In addition, toolbar buttons/radios/checks cannot hold input focus (again like a SKIPped control). Focus is moved to a toolbar control by one of the following methods:

·by clicking on the control with the mouse

·by an explicit SELECT statement (i.e., SELECT(?ToolbarButton))

·by hotkey ' (but it is important to know that the prompt and the control it references are treated as two different controls.)

Therefore, pressing of the hotkey defined by the prompt will not automatically move focus to the next control. If you need to emulate TAB navigation among toolbar controls, TAB and Shift-TAB keystrokes must be trapped and translated to the required SELECT statements.

Dynamic changes to tools which reference the currently active window affect only the currently displayed toolbar, even if global tools are changed. Changes made to the Global toolbar when the APPLICATION is the current window, or which reference the global APPLICATION's window affect the global portions of all toolbars, whether already open or not. This means that, when an MDI child window is active, the APPLICATION frame's TOOLBAR controls displayed on the APPLICATION frame are actually copies of the frame's controls. This allows each MDI child to modify its own set of toolbar controls without affecting the controls displayed for other MDI child windows. The events for these controls are still processed by the APLICATION's ACCEPT loop. For example, assuming a button declared in the APPLICATION's TOOLBAR has a field number of 150. The MDI Child window's procedure can modify the appearance of that button by directly setting the properties of control number 150, which would change its appearance only while the MDI Child window's procedure is active and has focus.

When a WINDOW's TOOLBAR is merged into an APPLICATION's TOOLBAR, the global tools appear first, followed by the local tools. The toolbars are merged so that the fields in the WINDOW's toolbar begin just right of the position specified by the value of the width parameter of the APPLICATION TOOLBAR's AT attribute. The height of the displayed toolbar is the maximum height of the “tallest” tool, whether global or local. If any part of a control falls below the bottom, the height is increased accordingly.

Example:

!An MDI application frame window containing the

! main menu and toolbar for the application:

MainWin APPLICATION('My Application'),SYSTEM,MAX,ICON('MyIcon.ICO'),STATUS |

 ,HVSCROLL,RESIZE

        MENUBAR

         ITEM('E&xit'),USE(?MainExit)

        END

        TOOLBAR

         BUTTON('Exit'),USE(?MainExitButton)

        END

       END

!An MDI child window with toolbar for the window, merged into the

! application's toolbar:

MDIChild WINDOW('Child One'),MDI

        TOOLBAR

          BUTTON('Cut'),USE(?CutButton),STD(STD:Cut)

          BUTTON('Copy'),USE(?CopyButton),STD(STD:Copy)

          BUTTON('Paste'),USE(?PasteButton),STD(STD:Paste)

         END

         TEXT,HVSCROLL,USE(Pre:Field)

         BUTTON('&OK'),USE(?Exit),DEFAULT

        END

!An MDI window with its own toolbar, overwriting the main toolbar:

MDIChild2 WINDOW('Dialog Window'),MDI,SYSTEM,MAX,STATUS

          TOOLBAR,NOMERGE

           BUTTON('Cut'),USE(?CutButton),STD(STD:Cut)

           BUTTON('Copy'),USE(?CopyButton),STD(STD:Copy)

           BUTTON('Paste'),USE(?PasteButton),STD(STD:Paste)

          END

          TEXT,HVSCROLL,USE(Pre:Field),MSG('Enter some text here')

          BUTTON('&OK'),USE(?Exit),DEFAULT

         END

toolbar_declare_a_tool_bar_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1