• Creator
    Topic
  • #4385
    ctaleck
    Participant

    I am looking for a sample solution to implement a drag and drop file attachment feature on a Formativ form.

    I see there are events for this in each of the controls, but I will need to interact with Windows to accept a file and get it’s full path so that I can later attach it to a message that I create in Formativ.

    Thank you for any help in this matter.

  • Author
    Replies
  • #8038
    Support 3
    Participant

    Unfortunately you can not drag and drop into the Formativ Form. I think it is working as designed, however, I have asked the engineers to comments on this issue.

    In Formativ Form, you can drag and drop in between controls (i.e. List View, etc). Let us know if you need sample code.

    For the moment, I think the only alternative is to include a browse button in your form to select the file. you can drop “Open dialog” to your Form (Formativ IDE – Dialogs) and use the code below to select the file.

      if (TestDialog.OpenFileDlg.execute) then
        msgbox TestDialog.OpenFileDlg.filename
      end if  
    

    Hope this helps.

    Regards,
    Advansys Support

    #8040
    ctaleck
    Participant

    The OpenFileDlg is the method I am currently using. The drag and drop feature was a user request which I thought would be useful.

    I have made a little progress on a solution using the DynamicWrapper ActiveX control that allows me to call Windows API.

      Dim UserWrap
      Set UserWrap = CreateObject("DynamicWrapper")
    
      UserWrap.Register "SHELL32.DLL", "DragAcceptFiles", "i=Hl","f=s"
      UserWrap.DragAcceptFiles Dlg.Handle, True
    

    This successfully shows a drag cursor on my Formativ form suggesting it can accept files dragged to it. However, I am still working on the code which allows me to capture the WM_DROPFILES messages from Windows to decode the actual file path using another Windows API: DragQueryFile.

    I see that most controls (including the form) have a method called WindowProc, but I am unsure how to override it in VBScript. Perhaps it is not even exposed in Formativ? Is there any way I can tap into the WindowProc so that I can receive those messages?

    I am using the following article as guide to my efforts: Drag and Drop from Windows Explorer

    [This message was edited by ctaleck on September 11, 2008 at 06:25 AM.]

    #8039
    Support 1
    Participant

    To the best of our knowledge, Formativ does not make it possible to override a control’s WindowProc method. This appears to be an essential part of implementing drag and drop to operate beyond the bounds of a form.

    Regards,
    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.