Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

File open dialog

Is there a way from RBasic to open the standard Windows file open dialog with large icons displayed, so that the user can select a file?

Comments

  • I think you are looking for this. They mention flags you can set, which are about halfway down this page.
  • Kind of, I had looked at that (and used it before).

    However, this gives me something that looks like this


    What I want is something that looks like this:


    Maybe I have to call the Win API directly to get this modern file open dialog? I was hoping OI had some simple to use wrapper.
  • Jim - This is OI 9, correct? I discovered the same issue when I tried to implement a file picker. For some reason the OI code only displays that older looking UI. I gave up and implemented a drag-n-drop solution, which worked even better since the Windows Explorer window doesn't have to be modal.
  • Don - Yes OI 9. Can I drag and drop onto the OLE Ribbon control? If so, that might indeed a much better solution.
  • Jim - I think so. I've done this for other OLE controls. Just set the ENABLEDROP property and then use the DROPFILES event.
  • Don- OK let me give it a try.
  • Don,

    That doesn't seem to work.

    From the above link:
    ENABLEDROP
    Applies to
    All Controls except OLE controls.
  • Jim - Did you try it and it didn't work or are you only going off of the documentation?

    I think when I implemented it, I didn't restrict it to a specific control. I enabled it for the window, and this seemed to work for all controls on the window. Will that suffice?
  • edited August 22
    Don,
    I have never used the dragdrop functionality before. I created a test form. Added an edittable. In create event set ENABLEDROP property of edittable to 1. Add a debug event to DROPFILES event. Then run the form. Then drop a file on the table. I get a drop to the debugger in a POSCHANGED event. What on earth am I doing wrong?

    Thanks for the help btw this is driving me nuts, I thought this would be easy :)
  • Jim - Just so I can do an apples-to-apples test, is this an OI edittable or the SRP EditTable?
  • Don,
    I got rid of the POSCHANGED event, no idea where that was coming from. I deleted the form and started with a new form from scratch.
    I set the ENABLEDROP on an editline and a standard edittable on the form and confirm property is set by doing a get_property. Add debugs to both DROPFILES and DRAGDROP events on both controls.
    Drag and drop a png file from explorer to each control and nothing happens. I get a stop icon when hovering over the control.
    Does it need to be told somehow what files can be dropped?
  • >> I think when I implemented it, I didn't restrict it to a specific control. I enabled it for the window, and this seemed to work for all controls on the window. Will that suffice?<<

    Maybe i need to enable it for the entire window. Let me test.
  • Don,
    Nope enabled it for entire window. Still no event fires.
  • Jim - My apologies. That property is a good property, but not 100% for what you are looking to do. I should have pointed you to this property:

    ACCEPTDROPFILES
  • Don,
    Ah ha, let me try that tomorrow.
  • If you intend to go to OI10 then before going down the drag & drop approach you need to make sure that drag & drop has been added to OI10. Last I heard, drag & drop was to be implemented at a later date.
  • I had forgotten about that. I just confirmed that it is still missing in OI 10.2.2.

    An alternative that will work in OI 9 and OI 10 is putting the SRP Picture control on your form and using its OnFileDrop event. This isn't as convenient of a solution because you are creating space on your form specifically to be a dropzone rather than the form itself being the dropzone.
  • Chris- thanks for the heads up. This is just a quick piece of code to make assigning icons easier. It's not going to be used on an ongoing basis.
  • DROPFILES event is active in OI10
  • Barry - did you actually test this or are you simply going by the existence of the event?
  • Event Existence
  • edited August 24
    DROPFILES test works for editline (with AcceptDropFiles property set to True)
  • Ah...yes it does work. I was testing for the form and it still does not appear to work.
Sign In or Register to comment.