Condizioni di notifica
Evento notificato dall'albero quando un nodo viene tirato su un altro nodo.
Utilizzo consigliato
L'evento di OnDropDoc può essere utilizzato per gestire le operazioni di Drag & Drop di nodi in un albero.
Argomenti
Sorgente | E' il documento che è stato tirato. Il valore del parametro è derivato dalla libreria IDDocument. |
Destinazione | E' il documento su cui è stato tirato il documento Sorgente. Il valore del parametro è derivato dalla libreria IDDocument. |
Tasto Shift | E' un valore booleano che indica se, al termine dell'operazione di D&D, il tasto SHIFT era premuto. |
Tasto Alt | E' un valore booleano che indica se, al termine dell'operazione di D&D, il tasto ALT era premuto. |
Tasto Control | E' un valore booleano che indica se, al termine dell'operazione di D&D, il tasto CONTROL era premuto. |
Cancel | E' un parametro di uscita booleano. Se lo si imposta a True viene comunicato al sistema che non occorre proseguire con la gestione automatica dell'operazione di Drag&Drop. |
Esempio di codice
// ****************************************************************************
// Fired when a document node is dropped onto another document node (only if
// the Drag And Drop propriety is True)
// ****************************************************************************
event AlberoDO.Documenti.OnDropDoc(
IDDocument SourceDocument // Source document that has been dropped
IDDocument DestinationDocument // Destination document that receives the...
boolean ShiftKey // True if the SHIFT key was pressed duri...
boolean AltKey // True if the ALT key was pressed during...
boolean ControlKey // True if the CONTROL key was pressed du...
inout boolean Cancel // Set to True to cancel further processing
)
{
OggettoAlbero oaSrc = null //
OggettoAlbero oaDest = null //
//
oaSrc := OggettoAlbero.Cast(SourceDocument)
oaDest := OggettoAlbero.Cast(DestinationDocument)
//
// Espando il nodo destinazione (quello su cui ho tirato)
Documenti.ExpandDoc(oaDest, ??)
//
// Se premo CONTROL ne inserisco una copia
if ControlKey
{
oaSrc.Duplicate(C9999, oaDest.OggettiFigli, True)
}
else // Altrimenti lo sposto
{
oaDest.OggettiFigli.Add(oaSrc)
}
//
// Ho già gestito io l'operazione. Il framework non deve proseguire
Cancel := True
//
// Inserisco l'evento
insert values into EventiDO
set Descrizione := FormatMessage(MSG Tirato DO, oaSrc.Nome, oaDest.Nome, ??, ??, ??)
set AppTick := ClickCounter()
}
// Fired when a document node is dropped onto another document node (only if
// the Drag And Drop propriety is True)
// ****************************************************************************
event AlberoDO.Documenti.OnDropDoc(
IDDocument SourceDocument // Source document that has been dropped
IDDocument DestinationDocument // Destination document that receives the...
boolean ShiftKey // True if the SHIFT key was pressed duri...
boolean AltKey // True if the ALT key was pressed during...
boolean ControlKey // True if the CONTROL key was pressed du...
inout boolean Cancel // Set to True to cancel further processing
)
{
OggettoAlbero oaSrc = null //
OggettoAlbero oaDest = null //
//
oaSrc := OggettoAlbero.Cast(SourceDocument)
oaDest := OggettoAlbero.Cast(DestinationDocument)
//
// Espando il nodo destinazione (quello su cui ho tirato)
Documenti.ExpandDoc(oaDest, ??)
//
// Se premo CONTROL ne inserisco una copia
if ControlKey
{
oaSrc.Duplicate(C9999, oaDest.OggettiFigli, True)
}
else // Altrimenti lo sposto
{
oaDest.OggettiFigli.Add(oaSrc)
}
//
// Ho già gestito io l'operazione. Il framework non deve proseguire
Cancel := True
//
// Inserisco l'evento
insert values into EventiDO
set Descrizione := FormatMessage(MSG Tirato DO, oaSrc.Nome, oaDest.Nome, ??, ??, ??)
set AppTick := ClickCounter()
}
- Attenzione: L'evento viene notificato solo se stato è attivato il Drag&Drop, mediante la proprietà DragAndDrop, e se il contenuto dell'albero è document-oriented.
-
Se l'operazione di Drag&Drop non viene interrotta (mediante l'assegnazione del valore True al parametro Cancel) il sistema effettua le seguenti operazioni:
- notifica l'evento OnDrop sul documento identificato dal parametro Destinazione;
- se anche questo evento non viene interrotto il sistema prosegue identificando un buon padre per il documento di destinazione. Per fare questo controlla se il documento di destinazione (o il padre del documento di destinazione qualora il tasto SHIFT sia stato premuto) può accettare come figlio il documento sorgente. La risposta è affermativa se il documento (o il padre di questo se il tasto SHIFT è stato premuto) posseggono una collection che contenga documenti dello stesso tipo del documento tirato. Se viene trovato un buon padre per il documento Sorgente il sistema lo sposta (o lo copia se è stato premuto il tasto CONTROL).
Ultima modifica: 28/11/2022 / Validità: da 6.5.2680