MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MForms - mini forms library

Introduction

MForms is a small GUI toolkit library written for use in the MySQL Workbench project. It is small and cross-platform, while providing access to fully native controls (through .NET in Windows, GTK in Linux and Cocoa in MacOSX). It is not meant to be a full-fledged control library, but instead a light-weight and simple library that allows writing simple forms that will work in any supported platform. It is used by Workbench in some specific parts where the UI requirements are not very complex, such as in wizards, simple confirmation dialogs and the Administrator feature. The library is written in C++, but a Python wrapper is available, making it possible to easily write cross-platform plugins with simple to moderately complex GUIs.

Layouting

Because each platform has widgets of different sizes, with different layout characteristics, using absolute coordinates and sizes for layouting would not work very well. A dialog written in Windows containing text and a couple of buttons could look fine in the OS where it was written in, but would look cluttered and probably too small on Mac OS X. To work around that, MForms uses dynamic layouting containers instead of static coordinates to place and size controls, similar to what GTK uses. Basically, there are several types of containers where you can place one or more controls inside, each having a specific layouting behavior.

  • Form - A top level window which can contain a single control (usually another container). The window will be sized automatically to fit its contents, but can also be set to a size by hand.
  • Box - A container that can be filled with one or more controls in a vertical or horizontal layout. Each child control can be set to either use only the minimal space required by it or to fill up all space available in the box in the direction of the layout. In the direction perpendicular to the layout (ie vertical in a horizontal box and vice-versa), the smallest possible size that can accommodate all child controls will be applied to all its contents.
  • Table - A container that can organize one or more controls in a grid. You may set the number of rows and columns in the table and place your controls in specific cells of that grid.
  • ScrollView - A container that can contain a single other control and will add scrollbars if the contents don't fit the available space.
MySQL Workbench 6.1 documentation