Condizioni di notifica
Queto evento viene notificato al documento quando l'utente esegue una operazione di drop di un altro documento su questo, in un albero con drag & drop attivo. Da notare che il documento tirato potrebbe essere visualizzato anche in una diversa visualizzazione ad albero.
Utilizzo consigliato
Questo evento può essere usato per personalizzare le azioni di drag & drop fra documenti visualizzati in alberi.
Argomenti
Source Document | Documento tirato su questo documento |
Shift Key | Vero se l'utente teneva premuto il tasto Shift durante l'operazione di drop. |
Alt Key | Vero se l'utente teneva premuto il tasto Alt durante l'operazione di drop. |
Control Key | Vero se l'utente teneva premuto il tasto Control durante l'operazione di drop. |
Cancel | Se lo si imposta a True si impedisce l'esecuzione della procedura standard di Drop come descritto nelle note. |
Esempio di codice
// **********************************************************************************************
// Fired when a document node in a tree is dropped onto another document node (only if the Drag
// And Drop tree propriety is True)
// **********************************************************************************************
event Categoria.OnDrop(
IDDocument SourceDocument // Document that has been dropped
boolean ShiftKey // TRUE if the SHIFT key was pressed during the drop
boolean AltKey // TRUE if the ALT key was pressed during the drop
boolean ControlKey // TRUE if the CONTROL key was pressed during the drop
inout boolean Cancel // Set to True to cancel further processing
)
{
// Se era un prodotto...
if Prodotto.IsMyInstance(SourceDocument)
{
Prodotto p = null // What data will you store here?
//
p := Prodotto.Cast(SourceDocument)
//
if p.Sospeso = True
{
Cancel := True
EsempiDO.MessageBox(MSG Possibile Spostare)
}
}
}
// Fired when a document node in a tree is dropped onto another document node (only if the Drag
// And Drop tree propriety is True)
// **********************************************************************************************
event Categoria.OnDrop(
IDDocument SourceDocument // Document that has been dropped
boolean ShiftKey // TRUE if the SHIFT key was pressed during the drop
boolean AltKey // TRUE if the ALT key was pressed during the drop
boolean ControlKey // TRUE if the CONTROL key was pressed during the drop
inout boolean Cancel // Set to True to cancel further processing
)
{
// Se era un prodotto...
if Prodotto.IsMyInstance(SourceDocument)
{
Prodotto p = null // What data will you store here?
//
p := Prodotto.Cast(SourceDocument)
//
if p.Sospeso = True
{
Cancel := True
EsempiDO.MessageBox(MSG Possibile Spostare)
}
}
}
- Se l'evento non cancella l'operazione, viene eseguito uno "Standard Drop" che consiste nel vedere se il documento tirato può essere contenuto in una delle collection del documento su cui viene tirato, oppure in una delle collection del documento padre di quello su cui viene tirato. In questo caso il documento viene spostato o copiato se era stato premuto il tasto Control. Se sia il documento che il suo parent possono accettare il documento tirato, allora viene preferito il documento, a meno che non fosse stato premuto il tasto Shift.
- E' anche possibile gestire l'operazione di drop direttamente nella videata on cui è contenuto l'albero utilizzando l'evento di OnDropDoc dell'oggetto albero stesso.
Ultima modifica: 23/03/2021 / Validità: da 6.5.2680