NAME

TUI::Views::Util - utility functions for Turbo Vision views

SYNOPSIS

use TUI::Views::Util qw(message);

my $handled_by = message(
  $receiver,
  evMessage,
  cmScrollBarChanged,
  $sender
);

DESCRIPTION

TUI::Views::Util provides low-level utility functions used throughout the Turbo Vision view system.

The functions in this module operate on views and events and are intended to simplify common interaction patterns such as message dispatching and command broadcasting between views.

This module is purely functional and does not define any classes or objects.

FUNCTIONS

message

my $view | undef = message($receiver | undef, $what, $command, $infoPtr);

Sends a message event to a view and returns the view that ultimately handled the message, or undef if the message was not handled.

The function constructs a message event using the supplied what, command, and infoPtr parameters and invokes the event handling mechanism starting at the specified receiver.

receiver

The target view that receives the message. If undef, the message is sent to the current view context. (TView | undef)

what

The event type being sent. This is typically evMessage or evBroadcast. (Int)

command

The command identifier associated with the message. This usually corresponds to a cmXXXX constant. (Int)

infoPtr

Optional reference to additional contextual information associated with the message.

This value may be used to pass a data structure, an object, or a reference to the sending view, depending on the semantics of the command. (Ref | undef)

USAGE NOTES

The message function is a convenience wrapper around the Turbo Vision event dispatch mechanism.

Messages are delivered by invoking the handleEvent method of the receiver. If the receiver does not handle the message, it may be propagated to child views depending on the event type and view hierarchy.

The return value indicates which view actually processed the message. This allows callers to detect whether a command was handled and by whom.

This function is intended for use within a running Turbo Vision application. Calling it outside of a valid view context will have no useful effect.

SEE ALSO

TUI::Drivers::Event, TUI::Views::View, TUI::Views::Group

AUTHORS

Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2021-2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).