Dialogs.EditBoxes

There are two kinds of edit boxes.  A full edit box is one Dialogs.Boxes.Containers with an edit box for user input complete with ?dialog box title, status bar for error messages, optional menu bar and a browser button to locate folders or file names depending on the BrowseForFolder parameter.   Dialogs.EditBoxes.MinContainers consists of an edit box covering the entire dialog box. It is used as an ?overlay area where input is expected.  For example, to mimic in place editing of a list box entry.  Pressing the enter key causes the input to be accepted while the escape button is for cancellation.

Changing Edit Box Colors
An edit box can have colors for the text, the text background, the highlighted text and highlighted background. Text background and background brush colors should be the same.  ColorHandler only affects text and text background colors. Setting the background color is a bit more difficult.  The BackgroundBrush parameter must be set to an appropriate brush for painting.  The most direct way is to use SetDCBrushColor.  However, the current linker does not recognize this system call.  Using system colors would affect the background of other controls.  This is solved by using OS.Brushes.CreateSolidBrush.  When Dialogs.EditBoxes.GetText exits, the background brush is automatically finalized.

Highlighting the input text involves too much housekeeping code if subclassing is used.  For example input areas needing highlight dependson the position of the caret.  Changing system colors is an easy way out until another solution is found.

Handlers For FullContainers

function FormattedTextHandler(Container : FullContainers;
                                                   InputText : Wide_String) return Wide_String;
--
-- Modifies InputText to a user defined format to be displayed in the edit box.  For
-- example, causes all text to be capitalized.
--

procedure InitInputBoxHandler(Container : in out FullContainers);
--
-- Initializes all user defined controls etc before Container becomes visible.
--

procedure InputMouseHandler(Container   : in out FullContainers;
                                                EditBox       : OS.Windows.Controls.EditBoxes.Controls'Class;
                                                Event          : OS.Mouse.Events;
                                                State           : OS.Mouse.States;
                                                Point           : OS.Points.Points;
                                                Handled       : out boolean);
--
-- Actions to be taken when a mouse button is clicked.
--

procedure InputValidationHandler(Container             : in out Containers;
                                                      EditBox                 : OS.Windows.EditBoxes.Controls'Class;
                                                      RawInputText       : Wide_String;
                                                      FormattedText      : Wide_String;
                                                      Accepted               : out boolean;
                                                      UserErrorMessage : awStrings.awStrings);
--

-- Checks if EnteredText (raw text as typed into the edit box) is a valid value.  If it is valid, Accepted
-- is true and EnteredText is formatted by FormattedTextHandler.  UserErrorMessage is used to
-- indicate the reason of the rejection and is displayed on the statusbar of the dialog box.
--

HandlersMinContainers

There are only two handlers for MinContainers, InitInputBoxHandler and InputMouseHandler.  They have the same functionality as those for FullContainers.  The responsibility of input validation and text formatting are relegated to the calling application since there is no way to display any errors since there is no statusbar.

Home
Back To Dialogs.Boxes
Dialogs.ListBoxes