4D v15

Toolbar form windows

Home

 
4D v15
Toolbar form windows

Toolbar form windows  


 

 

Originally introduced in 4D v14 R5

4D v15 includes a set of implementations intended to help developers design and manage custom toolbars. Toolbars are windows with specific properties regarding their position and size.

The following commands support the creation and management of toolbars:

  • Open form window: accepts the new Toolbar form window type
  • Tool bar height: returns the custom toolbar height
  • HIDE TOOL BAR and SHOW TOOL BAR: previously deprecated, these commands have been reactivated to handle custom toolbars.

Theme: Windows

 

Open form window ( {aTable ;} formName {; type {; hPos {; vPos {; *}}}} ) -> Function result

 

The Open form window command can now create form windows of the Toolbar type. 

A new constant has been added to the "Open Form Window" theme and can be used as the type parameter:

ConstantTypeValue
Toolbar form windowLongint35

When the Toolbar form window constant is passed, the window is created with the location, size and graphical properties of a toolbar, i.e.:

  • The window will always be displayed just under the menu bar.
  • The window's horizontal size will be automatically adjusted to fill all available horizontal space on the desktop (on OS X) or inside 4D's main window (on Windows). The window's vertical size is based on the form properties like all other form window types.
  • The window has no border, cannot be moved and cannot be resized manually, and hPos, vPos and * parameters are ignored if present.

It is not possible to create two different toolbar windows at the same time. If Open form window is called with the Toolbar form window type while a toolbar window already exists, an error -10613 ("Cannot create two form windows of type toolbar") is generated.

Note about Toolbar form windows and OS X full screen mode: If your application displays both a toolbar window and standard windows that support full screen mode (Has full screen mode Mac option), interface rules require that you hide the toolbar when a standard window enters full screen mode. To know if a window has switched to full screen mode, just test whether its vertical size is exactly the same as the screen's height (see below).

Theme: Windows (command moved from "User interface")

 

Tool bar height -> Function result

ParameterTypeDescription
Function resultLongint<-Height (expressed in pixels) of tool bar or 0 if tool bar is hidden

 

This command now also works with custom toolbars created by the Open form window command using the Toolbar form window type.

This command returns the height of the current visible toolbar, expressed in pixels. It can be either the 4D Design mode toolbar, or a toolbar created by Open form window, depending on the context (the Design mode toolbar is automatically hidden if a custom toolbar created by Open form window is displayed).

If the toolbar is hidden, the command returns 0.

Theme: Windows (commands moved from "User interface")

 

SHOW TOOL BAR
Does not require any parameters


HIDE TOOL BAR
Does not require any parameters

 

These commands are no longer deprecated in 4D: they can now be used to handle custom toolbar form windows created with the Open form window command for the current process.

  • SHOW TOOL BAR: If a toolbar window has been opened (by calling Open form window with the Toolbar form window option), the command makes this window visible. If the toolbar window was already visible or does not exist, this command does nothing.
  • HIDE TOOL BAR: If a toolbar window has been opened (by calling Open form window with the Toolbar form window option), the command hides this window. If the toolbar window was already hidden or does not exist, this command does nothing.
Example  

On OS X, you have defined a custom toolbar form window and standard windows that have the Has full screen mode Mac option. When a standard window is maximized by a user while the toolbar window is displayed, you do not want the maximized window to be overlapped by the toolbar.

To prevent this, in the "On Resize" form event of the standard window, you need to detect when the window has entered full screen mode and then call HIDE TOOL BAR:

 Case of
    :(Form event=On Resize)
       GET WINDOW RECT($left;$top;$right;$bottom)
       If(Screen height=($bottom-$top))
          HIDE TOOL BAR
       Else
          SHOW TOOL BAR
       End if
 End case

The following constants related to Mac OS toolbar button support are now prefixed with _O_, since the corresponding option has been deprecated by Apple since OS X 10.6:

  • Has toolbar button Mac ("Open Form Window" and "Open Window" themes) has been renamed _O_Has toolbar button Mac.
  • On Mac Toolbar Button ("Form Events" theme) has been renamed _O_On Mac Toolbar Button.

 
PROPERTIES 

Product: 4D
Theme: Language

 
HISTORY 

 
ARTICLE USAGE

4D v15 - Upgrade (standard edition) ( 4D v15)