Differenze tra le versioni di "Se l'Evento MouseDown() della ListBox non funziona"

Da Gambas-it.org - Wikipedia.
(Creata pagina con "Con il variare delle versioni di Gambas l'Evento "_MouseDown()" può non funzionare. La spiegazione di questo fatto è così data da B. Minisini nella Mailing List ufficiale...")
 
 
(Una versione intermedia di uno stesso utente non è mostrata)
Riga 2: Riga 2:
  
 
La spiegazione di questo fatto è così data da B. Minisini nella Mailing List ufficiale di Gambas:
 
La spiegazione di questo fatto è così data da B. Minisini nella Mailing List ufficiale di Gambas:
  ''Compound non-native controls usually eat some of the low-level events.
+
  « ''Compound non-native controls usually eat some of the low-level events.''
 +
  ''You should normally never try to handle low-level events on complex controls.''
 
   
 
   
  You should normally never try to handle low-level events on complex controls.''
+
  ''Controls written in Gambas are usually made with a container and other controls inside.''
 +
  ''So the low-level events are the one from that container, and you usually do not see them, because the inner controls cover the container.''
 +
  ''Controls written in Gambas that are not a container, but based on a UserControl, usually use the low-level events for their own use, so you do not see them too.'' »
 +
 
 
Vedasi: https://lists.gambas-basic.org/pipermail/user/2023-December/080959.html
 
Vedasi: https://lists.gambas-basic.org/pipermail/user/2023-December/080959.html
  

Versione attuale delle 08:52, 9 dic 2023

Con il variare delle versioni di Gambas l'Evento "_MouseDown()" può non funzionare.

La spiegazione di questo fatto è così data da B. Minisini nella Mailing List ufficiale di Gambas:

« Compound non-native controls usually eat some of the low-level events.
 You should normally never try to handle low-level events on complex controls.

 Controls written in Gambas are usually made with a container and other controls inside.
 So the low-level events are the one from that container, and you usually do not see them, because the inner controls cover the container.
Controls written in Gambas that are not a container, but based on a UserControl, usually use the low-level events for their own use, so you do not see them too. »

Vedasi: https://lists.gambas-basic.org/pipermail/user/2023-December/080959.html

A tal riguardo è stata proposta la seguente soluzione, per ottenere il risultato richiesto:

Public Sub Form_Open()

 Dim hobs As Observer = New Observer(ListBox1.Children[0]) As "ListBox1Inner"

End


Public Sub ListBox1Inner_MouseDown()

 Object.Raise(ListBox1, "MouseDown")

 Stop Event   ' Blocca ulteriori immediate sollevazioni dell'Evento

End


Public Sub ListBox1_MouseDown()   ' Ora l'Evento "_MouseDown()" funziona

 Debug "got mousedown"

End