Win32::GUI Common Options

Back to the index


This document illustrates the options available when creating an object (in particular, windows and controls). Here you'll find the general options, the ones that apply to every window class; for class-specific options, refer to that package reference.


List of available options


-background => COLOR

Defines the background color for the control. Note that not all controls support background and foreground colors.


-class => CLASS

Specifies the window class (which is different from the Perl's object class, eg. Win32::GUI::Button) for the window; all the predefined objects have hardcoded class names (eg. ``BUTTON'' for Win32::GUI::Button), so you shouldn't want to pick a different one unless you are familiar with window classes and you want to subclass an existing one. This technique is documented in the Microsoft Platform SDK Reference, and (at a lighter level) in guiclasses.pod. The CLASS parameter can be either a name or a reference to a Win32::GUI::Class object. As for many other options in Win32::GUI, its use is not recommended unless you know what you're doing.


-disabled => 0/1

Sets the initial enabled state for the control; by default this option is 0 (the control is enabled). Set it to 1 to create a control which is initially disabled.


-font => FONT

Defines the font for the control; must be a Win32::GUI::Font object.


-foreground => COLOR

Defines the foreground color for the control. Note that not all controls support background and foreground colors.


-group => 0/1

[TBD]


-height => NUMBER

Specifies the height of the window in pixels.


-left => NUMBER

Specifies the left position (X coordinate) for the window, in pixels. For Windows and DialogBoxes is absolute (screen position), while for controls is relative to the client area of their parent window.


-menu => MENU

[TBD]


-name => STRING

Defines the name for the control. The name is used to callback its events and to access its methods, so it is absolutely necessary, and each name must be unique in your application.

Example:

        $Window->AddButton(
                -name => "Button1",
                # ...
        );

        # methods...
        $Window->Button1->Hide();

        # events...
        sub Button1_Click {
                # ...
        }


-style => NUMBER

[TBD]


-tabstop => 0/1

If 1, the control can be enabled by pressing the TAB key to switch between controls. Note that this functionality is available in DialogBox objects only, not in Window, so the control must be child of a DialogBox for this option to be effective.


-text => STRING

Specifies the STRING that will appear on the window's caption or in the control's body (eg. a Label text, a Button caption, a Textfield content, and so on). Its use depends of course on the control type; some controls, like ProgressBars, makes no use of it at all.


-title => STRING

A synonim for -text.


-top => NUMBER

Specifies the top position (Y coordinate) for the window, in pixels. For Windows and DialogBoxes is absolute (screen position), while for controls is relative to the client area of their parent window.


-visible => 0/1

Sets the initial visibility state for the control; by default this option is 1 (the control is visible). Set it to 0 to create a control which is initially hidden.


-width => NUMBER

Specifies the width of the window in pixels.