User Tools

Site Tools


toolbox_set_toolbox_window_behavior_.htm
Navigation:  Language Reference > 9 -  Window and Report Attributes > Window and Report Attributes >====== TOOLBOX (set toolbox window behavior) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

TOOLBOX

blk2blue.jpg

The TOOLBOX attribute (PROP:TOOLBOX) specifies a WINDOW that is “always on top” and may be docked if the DOCK attribute is also present. Neither the WINDOW nor its controls retain input focus. This creates control behavior as if all the controls in the WINDOW had the SKIP attribute.

Normally, a WINDOW with the TOOLBOX attribute executes in its own execution thread to provide a set of tools to the window with input focus. The MSG attributes of the controls in the window appear in the status bar when the mouse cursor is positioned over the control.

Example:

PROGRAM

MAP

 UseTools

 Tools

END

MainWin APPLICATION('My Application')

        MENUBAR

         MENU('File'),USE(?FileMenu)

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

         END

         MENU('Edit'),USE(?EditMenu)

          ITEM('Use Tools'),USE(?UseTools)

         END

        END

       END

Pre:Field       STRING(400)

UseToolsThread  BYTE

ToolsThread     BYTE

CODE

OPEN(MainWin)

ACCEPT

 CASE ACCEPTED()

 OF ?MainExit

  BREAK

 OF ?UseTools

  UseToolsThread = START(UseTools)

 END

END

UseTools PROCEDURE                         !A procedure that uses a toolbox

MDIChild WINDOW('Use Tools Window'),MDI

         TEXT,HVSCROLL,USE(Pre:Field)

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

        END

CODE

OPEN(MDIChild)                            !Open the window

DISPLAY                                   !and display it

ToolsThread = START(Tools)                !Pop up the toolbox

ACCEPT

 CASE EVENT()                             !Check for user-defined events

 OF 401h                                  !posted by toolbox controls

!append date to end of field

  Pre:Field = CLIP(Pre:Field) & ' ' & FORMAT(TODAY(),@D1)

 OF 402h

!append time to end of field

  Pre:Field = CLIP(Pre:Field) & ' ' & FORMAT(CLOCK(),@T1)

 END

 CASE ACCEPTED()

 OF ?Exit

  POST(400h,,ToolsThread)                 !Signal to close tools window

  BREAK

 END

END

CLOSE(MDIChild)

Tools PROCEDURE  !The toolbox procedure

Win1 WINDOW('Tools'),TOOLBOX

     BUTTON('Date'),USE(?Button1)

     BUTTON('Time'),USE(?Button2)

    END

CODE

OPEN(Win1)

ACCEPT

 IF EVENT() = 400h THEN BREAK.            !Check for close window signal

 CASE ACCEPTED()

 OF ?Button1

  POST(401h,,UseToolsThread)              !Post datestamp signal

 OF ?Button2

  POST(402h,,UseToolsThread)              !Post timestamp signal

 END

END

CLOSE(Win1)

See Also:

DOCK

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