1. Christopher Craft
  2. PowerBuilder
  3. Wednesday, 4 January 2023 01:05 AM UTC

PB 2019 R3 2728

I am implementing a drag/drop file feature using DragAcceptFiles() but have run into a problem.  I am using a ListView to display a list of document types for the user to drop files onto.  This will then auto associate those files to the document type they dropped it on.  What I am running into is I cannot get the ListView Index once the file has been dropped.  I thought there would be a GetObjectAtPointer() call but that is only valid for the DW.  The pbm_lButtonUp event has the X/Y position but I am unable to figure out how to get the ListView index from that. It seems all the ListView events that deal with drag/drop are only fired if starting in that control – not when coming from the outside.  Has anyone done anything like this?

 

I know I can use a DataWindow control which has the GetObjectAtPointer() but I need this list to auto expand/collapse depending on the size of the window so it rules that out (unless I have no other option).

Thank you,

Chris Craft

Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 4 January 2023 16:26 PM UTC
  2. PowerBuilder
  3. # 1

What 'view' are you using? The values are: ListViewReport!, ListViewList!, ListViewLargeIcon!, ListViewSmallIcon!.

 

The dragdrop event gives you the item index. I'm actually working on a window right now that has drag drop between two listview controls.

Comment
  1. Christopher Craft
  2. Wednesday, 4 January 2023 16:41 PM UTC
I am using ListViewLargeIcon!



If you are dragging between 2 controls within your application then I can get the Index using the DragWithin event. The issue is I am dragging from File Explorer into the ListView which does not trigger that event. If I could get that event to fire then I would be good!
  1. Helpful
  1. mike S
  2. Wednesday, 4 January 2023 16:50 PM UTC
it triggers pbm_dropfiles (custom event) not dragdrop
  1. Helpful
  1. mike S
  2. Wednesday, 4 January 2023 17:00 PM UTC
Chris basically needs to know what index the pointer is on in the listview. The fact that this is occurring in a pbm_dropfiles event is irrelevant.
  1. Helpful
There are no comments made yet.
Christopher Craft Accepted Answer Pending Moderation
  1. Wednesday, 4 January 2023 01:40 AM UTC
  2. PowerBuilder
  3. # 2

I attached an example.  The ListView will auto adjust from 2 rows with 2 items on a row to 1 row with 3 items on the row when the window expands.  The DW does not do this.

Attachments (1)
Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 4 January 2023 03:13 AM UTC
FWIW: I would just change the DWO (and thus it's type / display ) as the DC's resized and space dictates. Food for thought. ;-)
  1. Helpful
  1. Christopher Craft
  2. Wednesday, 4 January 2023 15:56 PM UTC
So you are telling me it is impossible to determine the Index in the ListView from a drag/drop situation. I will log an Enhancement request for this.

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 4 January 2023 16:13 PM UTC
No, just that the DWO (IMHO) is normally easier & more flexible to use.

For the ListView you have... .

1) Clicked Event

2) ColumnClick Event

3) ITEM[] array property

4) GetItem() / SetItem() methods, etc..

5) GetColumn(), SetColumn(), methods, etc.

So with the above, you should be able to introspect the LV Control entries. Just my W$0.02

Regards ... Chris



  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 4 January 2023 01:18 AM UTC
  2. PowerBuilder
  3. # 3

Hi Chris;

  I don't understand why the DC/DWO approach would not work! Especially, on the auto expand/collapse feature aspect which the ListView does not have. Are you talking about a TreeView control instead?

    Can you expand on the overall design aspects (look & feel) that your after? Maybe that would clarify your question better. Thanks!

Regards .... Chris 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.