realbasic-nug.fr
[Top] [All Lists]

Re: Gestion du clavier dans une ListBox (Re: Petites questions(suite))

To: REALbasic NUG French <realbasic-nug dot fr at lists dot realsoftware dot com>
Subject: Re: Gestion du clavier dans une ListBox (Re: Petites questions(suite))
From: Francois Van Lerberghe <fvanlerberghe at freegates dot be>
Date: Sat, 31 May 2008 18:03:50 +0200
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug dot fr-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug dot fr-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug dot fr at lists dot realsoftware dot com
le 31/05/08 17:15, Sébastien Debiève <heero3 at mac dot com> a écrit :

> Donc le code que je dois mettre dans l'event KeyDown de la listbox
> serait bien celui-ci :
> 
>  If Keyboard.AsyncKeyDown(31) then //bas
>    ListBox1.ListIndex = min(ListBox1.ListIndex + 1,
> ListBox1.ListCount-1)
>    return true
>  end if

Oui.
Ou encore, comme l'event Keydown te passe en paramètre le caractère tapé
(Key), tu peux aussi faire :

  dim k As Integer
  
  k = asc(Key)
  
  If k = 31 then //bas
     ListBox1.ListIndex = min(ListBox1.ListIndex + 1,
ListBox1.ListCount-1)
     return true
   end if

Ceci dit, comme c'est justement le comportement par défaut de la ListBox,
pourquoi y mettre ce code ?

François Van Lerberghe
Rue Thier Monty, 15 A
4570 Marchin
Belgique



<Prev in Thread] Current Thread [Next in Thread>