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

Re: Simulazione doppio click mouse da codice

To: REALbasic NUG Italian <realbasic-nug.it@lists.realsoftware.com>
Subject: Re: Simulazione doppio click mouse da codice
From: Massimo Valle <maxduepuntozero@yahoo.it>
Date: Wed, 24 Jun 2009 11:52:45 +0200
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug.it-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug.it-bounces@lists.realsoftware.com; domainkeys=pass (test mode) header.From=maxduepuntozero@yahoo.it
Delivered-to: listarchive@realsoftware.com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.it; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-Id:From:To:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mime-Version:Subject:Date:References:X-Mailer; b=6lm1iKee92u7QpSNAom2MvMhF5CB5PAtOyhg4jUnZlhAnxEt4fc85IdHgiXmZWylM/gKTDLT/a2nehGqqy69P39Nayk5njXIzbTwlwmuD/9NmoPjqmORAM1DFI9ggiVwomNDdjDtsxiv4dIpOFIKm3piCVFfZChqq715GdZxlLk= ;
Domainkey-status: good (test mode)
In-reply-to: <26d1d61d0906240221l7aead346i779efc42bd93bfc7@mail.gmail.com>
References: <26d1d61d0906240027j39338fd7u9441abb03e6a21a8@mail.gmail.com> <676A7F58-99A7-44D6-9A71-0634DDDEFFD1@yahoo.it> <26d1d61d0906240221l7aead346i779efc42bd93bfc7@mail.gmail.com>
Reply-to: REALbasic NUG Italian <realbasic-nug.it@lists.realsoftware.com>
Sender: realbasic-nug.it-bounces@lists.realsoftware.com

L'evento in question (CellKeyDown) vuole un valore di ritorno di tipo Boolean per capire se tu vuoi gestire autonomamente la pressione dei tasti oppure vuoi lasciar il comportamento di default. E infatti è definito come:

CellKeyDown(row as Integer, column as Integer, key as String) As Boolean

In pratica ti basta ritornare un True dopo aver selezionato il campo, se invece lo lasci così, di default viene ritornato false e avviene la pressione del tasto freccia in basso che provoca lo spostamento del cursore a fine riga, rendendo inutile la tua selezione.

In pratica il tuo codice va modificato così:
indexR = row
 //freccia in basso
 if Asc(key) = 31 then
   if indexR = me.ListCount-1 then
     indexR = 1
   else
     indexR = row+1
   end if
me.CellType(indexR,column)=me.TypeEditable // sicuro che sia necessaria questa riga?
   me.editCell(indexR,column)
   me.activeCell.selStart = 0
   me.activeCell.selLength = len(me.activeCell.text)
   return true
 end if

Massimo Valle


On 24/giu/09, at 11:21, Massimo Lista wrote:

In effetti me.activeCell.selLength dovrebbe funzionare, ma non va.Anzichè
selezionare il contenuto della cella, posiziona il cursore alla fine
Lo uso in questo contesto:Su CellKeyDown

indexR = row
 //freccia in basso
 if Asc(key) = 31 then
   if indexR = me.ListCount-1 then
     indexR = 1
   else
     indexR = row+1
   end if
   me.CellType(indexR,column)=me.TypeEditable
   me.editCell(indexR,column)
   me.activeCell.selStart = 0
   me.activeCell.selLength = len(me.activeCell.text)

 end if

Il giorno 24 giugno 2009 09.56, Massimo Valle <maxduepuntozero@yahoo.it > ha
scritto:


On 24/giu/09, at 09:27, Massimo Lista wrote:

Con quale istruzione simulo il doppio click del mouse su una cella
editabile
di una listbox ?
Con il doppio click viene selezionato il contenuto della cella per cui
digitando, il nuovo valore si sostituisce a quello precedente.
Per ottenere lo stesso risultato via codice ?
 me.ActiveCell.SelStart=0
 me.ActiveCell..............................

Grazie.


  me.activeCell.selStart = 0
  me.activeCell.selLength = len(me.activeCell.text)

Massimo Valle





--
Massimo





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