PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Petrus Vorster on February 13, 2015, 08:28:09 AM

Title: Copy and paste a section of a listview control to another application
Post by: Petrus Vorster on February 13, 2015, 08:28:09 AM
hi all

I prefer my Listview to be fullrowselect, but now I need to be able to select more than one row, copy it and paste it in that "sectioned" format into an e-mail for example. (In other words retain the tabular look when pasting)

The more than one row selection is easy, but how can you make it copy and paste into another app?
There might have been posts here that i have missed.

Title: Re: Copy and paste a section of a listview control to another application
Post by: David Kenny on February 13, 2015, 07:46:08 PM
This might get you started on the correct path:

    Local Table As String
    Local i,j   As Integer
   
    For i = StrartRow To EndRow             'This is just an example, you would need to set the values as you need
        For j = 0 To ColumnCt -1            'This assumes you want all columns (you need to set the ColumnCt also)
            Table += FF_ListView_GetItemText( MainForm_ListView1, i,j) + $Tab
       
        Next j
        Table = Left$(Table,-1) + $CrLf     'Take off the last Tab before adding the $CrLf
    Next i
    Table = Left$(Table,-1)                   'Take off the last Carrage-return Linefeed                                             
    FF_ClipboardSetText Table               'Copy the Table to the Clipboard
   


This will copy the selected items into the Clipboard, ready for you to paste into another program.  I made some assumptions when making this snippet, let me know if you need more info or explanation.
Title: Re: Copy and paste a section of a listview control to another application
Post by: Petrus Vorster on February 14, 2015, 03:07:04 PM
Wow, that simple?
Thanks David.
Title: Re: Copy and paste a section of a listview control to another application
Post by: David Kenny on February 15, 2015, 04:11:51 AM
You are welcome Peter.

Were you able to get that working for you?
Title: Re: Copy and paste a section of a listview control to another application
Post by: Petrus Vorster on February 18, 2015, 12:36:51 PM
Hi David.

Been away for work & on the road until Sunday. It makes perfect sense if you read it.
It has to work!
Cant wait to get busy with this!