Datagrid Multiline Copy, Paste

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gilar
Posts: 96
Joined: Sat Sep 26, 2015 12:59 pm

Datagrid Multiline Copy, Paste

Post by gilar » Sat Oct 24, 2020 5:04 pm

I'm trying to select multi line in Datagrid
then copy into memmory (local var) as an Array
and paste the Array into anoter line in Datagrid its self

COPY ----------------------------------------------------------

Code: Select all

local tJumlahMultiLine
local tMultiLineHilited --- (Array)
on dataGrid_MultiLineHilited
   put the dgHilitedLines of group tDataGridName of card tCardName of stack tStackName into pLines --- mencari line
   put the number of items of pLines into tJumlahMultiLine
   put item 1 of pLines - 1 into tImbuhan
   repeat with i = 1 to tJumlahMultiLine
      put the dgDataOfLine [i+tImbuhan]of group tDataGridName of card tCardName of stack tStackName into tMultiLineHilited [i]
   end repeat
end dataGrid_MultiLineHilited
PASTE ----------------------------------------------------------

Code: Select all

on dataGrid_MultiLinePaste--- Sudah konsisten, tapi blm bener (bener kalo load file save nya)
   --- cari index tertinggi buat ngisi ID
   put the dgData of group tDataGridName of card tCardName of stack tStackName into tDataRundown
   put the number of elements of tDataRundown into tLines
   repeat with i = 1 to tLines
      --- repeat tapi semua index harus masuk
      put the dgDataofline [i] of group tDataGridName of card tCardName of stack tStackName into tArrayLine
      put tArrayLine["ID"] & comma after tDeret
   end repeat
   get max(tDeret) -- find max value
   put it into tMaxIndex
   ----
   put the dgHilitedLines of group tDataGridName of card tCardName of stack tStackName into pLines --- mencari line
   repeat with i = 1 to tJumlahMultiLine
      put (tMaxIndex + i) into tMultiLineHilited[i]["ID"]
      dispatch "AddData" to group tDataGridName of card tCardName of stack tStackName with tMultiLineHilited [i], pLines+i 
   end repeat
end dataGrid_MultiLinePaste
the code above not work as i expected
it think i missed something here
Could anyone helpe to solve the problem?

comment & help would be appreciate



Best Regards

Gilar
Gilar | from INDONESIA

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”