Object / Element / Area / Border / Window

This class generates windows, a place where widgets feel at home. It handles the complicated task of window resizing fully automatic, you don't need to worry about that. Windows borders are not restricted to intuition, they can be skinned to your taste using decorators.

Windows are children of an application, you cannot use a window without having a parent application. On the other side, the widgets in a window are children of the window, you cannot use widgets without having a parent window.

Creating a window does not mean to open it instantly. This is done later by setting the Open attribute. If your application has several windows, the usual way is to create them all at once at startup time and open/close them later just by setting the attribute.

There is no difference in talking to gadgets whether their parent window is open or not. If you e.g. set the contents of a string gadget in an open window, the gadget will refresh immediately. If the window is closed, the gadget just remembers its new setting and displays it later.

Attributes

Style properties

Overrides

Implements

ActiveObject -- (01.00) [.SG], FObject

Set the active object in a window as if the user would have activated it with keyboard. You can either provide a widget pointer or one of the following specials values:

Special values

FV_Window_ActiveObject_None
FV_Window_ActiveObject_Next
FV_Window_ActiveObject_Prev

Example

F_Set(window, FA_Window_ActiveObject, okaybutton);

Backdrop -- (01.00) [I.G], bool32

Make the window a backdrop window, stuck in the back of the screen.

Borderless -- (01.00) [I.G], bool32

Make the window borderless, removing even the frame that may still exists when setting the GadNone attribute to TRUE.

CloseRequest -- (01.00) [.S.], bool32

When the user hits a windows close gadget, the window isn't closed immediately, instead its CloseRequest attribute is set to TRUE.

Usually, you setup a notification that automatically closes the window when a close request appears, but you could e.g. pop up a confirmation requester or do some other things first.

Example

Automagically close a window when the close gadget is pressed

F_Do
(
    window, FM_Notify,
    FA_Window_CloseRequest, TRUE, window,
    FM_Set, 2, FA_Window_Open, FALSE
);

Open -- (01.00) [ISG], bool32

Use this attribute to open or close a window.

To automatically open a window when an application is ran, you can set this attribute to TRUE when creating the object. The attribute is more a wish than an order. Actually, it depends much on the application's state, if it's running and awake or not. Thus, if the application is running and awake, setting this attribute have immediate results, otherwise it is difered.

When a window is closed, it saves the coordinates and dimensions of its box. If the window opens again it gets back its previous box (if possible). If the object has an Id and some suitable persistent attributes, it can save its box during the SavePersistentAttributes method, and retreive them during the LoadPersistentAttributes method.

Don't use this attribute to know is a window is opened or not, use the System attribute instead.

ScreenTitle -- (01.00) [ISG], STRPTR

This text appears in the screens title bar when the window is active.

System -- (13.00) [.G], struct Windnow *

A pointer to the Intuition's Window structure.

Since the user can close your window at any time (e.g. iconification), you must be prepared to receive a NULL pointer as result.

Title -- (01.00) [ISG], STRPTR

The title of the window.

decorator -- (12.00)

This style-property defines the decorator class to use for the window's frame.

AddChainable -- (13.00)

IFEELIN F_Do(Obj, FM_Window_AddChainable, FObject Widget);

Function

Add a widget to the window's cycle chain.

Each widget added to the cycle chain must be removed with the RemChainable method before it can be disposed.

Inputs

A widget created from a subclass of the Widget class. If the widget is already member of the cycle chain, a message of FV_LOG_DEV importance is logged to indicate the error.

CreateEventHandle -- (13.00)

IFEELIN F_DoA(Obj, FM_Window_CreateEventHandle, TAGS);

Function

Create an handle for your object to receive events.

Subclasses of the Widget class should rather use their ModifyEvents method, which provides an nice interface to the CreateEventHandle and DeleteEventHandle methods. A good place to add/remove event handlers is the Setup / Cleanup method pair of your class.

Event handlers are used by the DispatchEvent method to dispatch the events it receives from the WinServer object.

Tags

FA_EventHandle_Events (bits32)

Exclusive OR of all events flags you want this handler to react on.

FA_EventHandle_Target (FObject)

The target object which should receive the HandleEvent method.

FA_EventHandle_Class (FClass *)

Use this attribute to invoke the target object with as of the provided class (with the F_ClassDoA() function). Use this to bypass any subclasses you might have and directly hand the input event to the dispatcher.

FA_EventHandle_Priority (int8)

Event handlers are inserted according to their priority. The default value for this attribute is 0, which is fine in almost all cases.

Result

An abstract event handler pointer.

Don't forget to remove the event handler before you delete its target. You must match each CreateEventHandle method with exactly one DeleteEventHandle method.

DeleteEventHandle -- (13.00)

IFEELIN F_Do(Obj, FM_Window_DeleteEventHandle, APTR Handle);

Function

Delete an event handle created by the CreateEventHandle method.

RemChainable -- (13.00)

IFEELIN F_Do(Obj, FM_Window_RemChainable, FObject Widget);

Function

Remove a previously added widget from the window's cycle chain.

Inputs

The widget previously added to the cycle chain using the AddChainable method.

Development