SelectionListWindow

Classe de sélection d'items parmi une liste.

Version: 1.0
Date: Le 13 août 1997
Rédaction: Jocelyn Houle
Direction: Jean Vaucher


Introduction

Les SelectionListWindows sont des zônes de texte dans lesquelles on peut sélectionner du texte par ligne.

Code
BEGIN
   EXTERNAL CLASS WindowTools;
   
   MainWindow CLASS MyMainWindow;
   BEGIN
      REF(SelectionListWindow) SLW;
      REF(Button) Ok;
      INTEGER i;
      
      PROCEDURE Selection_Handler(Wnd, Line, LineNbr);
         REF(XWindow) Wnd;
         TEXT Line;
         INTEGER LineNbr;
      BEGIN
         OutText(Line); OutImage;
      END;

      SetBackground("gray");
      SLW :- MakeSelectionListWindow.SetTextSize(25, 10);
      FOR i := 1 STEP 1 UNTIL 10 DO
          SLW.PutLine("Ligne " & int_as_text(i));
      Ok :- MakeButton("Ok").PlaceRightBelow(SLW);
      SetSizeToSubwindowSize;
      Show;
      Ok.Wait;
   END;
   
   NEW MyMainWindow("SelectionListWindow");
END;

La création d'une SelectionListWindow se fait à l'aide d'un MakeSelectionListWindow.

On a ensuite réglé la taille à 25 colonnes par 10 lignes. Puis on a inséré dix lignes numérotées de 1 à 10.


Informations sur les SelectionListWindows

On crée une SelectionListWindow à l'aide de MakeSelectionListWindow, qui n'a besoin d'aucun paramètre.
ref(SelectionListWindow) procedure MakeSelectionListWindow;
Retourne une nouvelle SelectionListWindow.

Pour que le Selection_Handler fonctionne, il faut que le définir dans une nouvelle classe. C'est pourquoi dans l'exemple, nous avons créé la classe MyMainWindow...

Pour d'autres fonctions accessibles dans les SelectionListWindows référez-vous aux TextAreas...


Exemples de programmes

[Retour à l'index de WindowTools...]