PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Programmed drag and drop between two tables
Programmed drag and drop between two tables
Débuté par Wilfried, 21 oct. 2014 14:40 - 3 réponses
Posté le 21 octobre 2014 - 14:40
Hello,

I've been breaking my head over this one. probably due to lack of experience.

I have two memory tables filled by programming. I want to make a drag and drop between them so taht when i drop a line of table_1 in table_2 i can start a procedure that does some things. I want to give taht procedure the Id i have in table_1 as a parameter.

Since the two tables are totaly different from each other i must use programmed drag and drop.

I read the complete helpfile on the subject. Done word for word what it says, but nothing works. The target table does not accept my drop.

I can't find a useful example with a similar situation, only DnD between listboxes, no tables.

Can anyone help me ?

Thanks a lot in advance,


Wilfried
Posté le 21 octobre 2014 - 15:20
Did you check the window Window_DND provided with windev?

It's between treeviews (source) and tables (target) but it can give you some hints on how to program drag/drop
Posté le 21 octobre 2014 - 16:58
Hi.
I had some difficulties the first time too.

This is my actual code:

Table 1 dndDragOver process
nHoveredRow is int =gproc_HoveredRow(MySelf..Name) IF nHoveredRow < 0 THEN DnDCursor(dndNone) RETURN END IF TABLE_Facturas..NewLine THEN DnDCursor(dndNone) RETURN END IF nHoveredRow = TABLE_Facturas THEN DnDCursor(dndNone) RETURN END DnDCursor(dndCopy) Table 1 dndDrop process
IF _DND.SourceControl <> TABLE_facturas_lineas..Name THEN RETURN nHoveredRow is int =gproc_HoveredRow(MySelf..Name) IF YesNo("yess = Copyy, Noo = Movee") THEN FOR EACH SELECTED ROW OF TABLE_facturas_lineas HReadSeekFirst( QRY_table_facturas_lineas,facturas_lineasID,TABLE_facturas_lineas.COL_facturas_lineasID) QRY_table_facturas_lineas.IDfactura = TABLE_Facturas[nHoveredRow].COL_IdFactura HAdd( QRY_table_facturas_lineas) END ELSE FOR EACH SELECTED ROW OF TABLE_facturas_lineas TABLE_facturas_lineas.COL_IDfactura = TABLE_Facturas[nHoveredRow].COL_IdFactura TableSave(TABLE_facturas_lineas) END END TableDisplay(TABLE_facturas_lineas)
Table 2, the one where i click to drag the rows out of it have no code at all.

Drag and Drop "Is Target" and "Is Source" options are disabled on both tables.

Regards,
José Antonio.
Posté le 29 octobre 2014 - 12:06
Thanks,

finally figured it out. Your reply was very helpfull.


Wilfried