Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 3 Jahren, 4 Monaten
Letzter Beitrag:
vor 3 Jahren, 3 Monaten
Beteiligte Autoren:
Wilfried, Jose Antonio Garrido, Paulo Oliveira

Programmed drag and drop between two tables

Startbeitrag von Wilfried am 21.10.2014 12: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

Antworten:

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

von Paulo Oliveira - am 21.10.2014 13:20
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)

FOR EACH SELECTED ROW OF TABLE_facturas_lineas
Trace(TABLE_facturas_lineas.COL_facturas_lineasID + " is being dropped to " + TABLE_Facturas[nHoveredRow].COL_IdFactura)
END



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.

Edit:
I forgot the code of the procedure:


//Used for drag and drop

PROCEDURE gproc_HoveredRow(sTable_Name is string)
nRow is int
nX,nY are int


nX= _DND.MouseXPos
nY = _DND.MouseYPos

// Define the name of the column
nRow = TableInfoXY(sTable_Name, tiLineNumber, nX, nY)

RESULT nRow


Edit2:
I deleted some rows in order to be more easy to read.

Regards,
José Antonio.

von Jose Antonio Garrido - am 21.10.2014 14:58
Thanks,

finally figured it out. Your reply was very helpfull.


Wilfried

von Wilfried - am 29.10.2014 11:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.