Drag and Drop on List Browser?

3 posts / 0 new
Last post
ktadd
ktadd's picture
Offline
Last seen: 8 months 2 weeks ago
Joined: 2010-12-01 01:20
Drag and Drop on List Browser?

Is it possible to have drag & drop associated with a list browser? Or is it only associated with a Window or a specified area of the Window?

Also, is there any example code demonstrating Drag & Drop anywhere?

I would like to implement dragging and dropping of video files into a list browser.
Thanks in advance to anyone who can help.

TSK
TSK's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 2011-06-28 02:06
Re: Drag and Drop on List Browser?

Associated to a window, maybe to area, as well. You need to write code yourself to put files name to a listbrowser list.

Something like this:

  1. // Create a message port and add it to a Window object: WINDOW_AppPort,MyAppIconPort,
  2.  
  3. // After opened the window:
  4. struct AppWindow *MyWindow_app=IWorkbench->AddAppWindow(0,0,MyWindow,MyAppIconPort,TAG_DONE);
  5.  
  6. // Before closing the window:
  7. if (MyWindow_app!=NULL) { IWorkbench->RemoveAppWindow(MyWindow_app); MyWindow_app=NULL; }
  8.  
  9.  
  10. // In your window message handler function:
  11. char filename[4095+1];
  12. struct AppMessage *MyWBAppMsg=(struct AppMessage *)IExec->GetMsg(MyAppIconPort);
  13. while(MyWBAppMsg!=NULL)
  14. {
  15. if (MyWBAppMsg->am_Type==AMTYPE_APPICON)
  16. {
  17. IExec->ReplyMsg((struct Message *)MyWBAppMsg);
  18. }
  19. else
  20. {
  21. if ((MainWindow!=NULL) && (MyWBAppMsg->am_Type==AMTYPE_APPWINDOW))
  22. {
  23. if ((MyWBAppMsg->am_NumArgs>0) && (MyWBAppMsg->am_ArgList!=NULL))
  24. {
  25. if (MyWBAppMsg->am_ArgList->wa_Lock!=ZERO)
  26. {
  27. IDOS->NameFromLock(MyWBAppMsg->am_ArgList->wa_Lock,filename,sizeof(filename));
  28.  
  29. IIntuition->SetGadgetAttrs((struct Gadget *)MyListBrowserObject,MyWindow,NULL,LISTBROWSER_Content,~0,TAG_DONE);
  30. IExec->AddTail(MyList,MyAllocListBrowserNode(filename));
  31. // Imaginate that MyAllocListBrowserNode() function yourself
  32. IIntuition->SetGadgetAttrs((struct Gadget *)MyListBrowserObject,MyWindow,NULL,LISTBROWSER_Content,MyList,TAG_DONE);
  33. }
  34. }
  35. else ;
  36. }
  37. else ;
  38. IExec->ReplyMsg((struct Message *)MyWBAppMsg);
  39. }
  40.  
  41. MyWBAppMsg=(struct AppMessage *)IExec->GetMsg(MyAppIconPort);
  42. }

That's out of memory without testing.

ktadd
ktadd's picture
Offline
Last seen: 8 months 2 weeks ago
Joined: 2010-12-01 01:20
Re: Drag and Drop on List Browser?

Thank you!

Log in or register to post comments