Setting Focus Into Field Control

From: [at]} <Cuno>
Date: Fri, 25 Sep 1998 05:40:33 -0400

Hi,

here is a more general and more elegant procedure for focusing a
particular control in a container. It is more general in that it
uses the generic container iterator mechanism, so it works on
texts and forms etc. The loop iterates as long as v is not NIL and
the desired control is not found yet.

Cuno Pfister

Oberon microsystems, Inc.


MODULE TestNav;

        IMPORT Views, Containers, Controls;

        PROCEDURE Do*;
                VAR c: Containers.Controller;v: Views.View;
        BEGIN
                c := Containers.Focus();
                IF c # NIL THEN
                        c.GetFirstView(Containers.any, v);
                        WHILE (v # NIL) & ~((v IS Controls.Control) &
(v(Controls.Control).label = "magic string")) DO
                                c.GetNextView(Containers.any, v)
                        END;
                        IF v # NIL THEN
                                c.SetFocus(v)
                        END
                END
        END Do;

END TestNav.
Received on Fri Sep 25 1998 - 11:53:42 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:42 UTC