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?
«1

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.
  • I have this working on everything except where I wanted it to work. By way of example it works fine on an SRP OLE Edit line, I can not seem to get it to work on a SRP OLE Ribbon control. Is it not supported on the Ribbon, or am I doing something wrong?
  • We don't have an editline control. I think you meant OI EDITLINE. As far as I know, none of our controls supports the DROPFILES event because that's an OI event and we can't raise those events. The SRP Picture Control is the only one with an OnFileDrop event for the purposes of catching drag-n-drop of files.
  • I just retested using SRP.EditTable.1, set ACCEPTDROPFILES for the entire from and the SRP OLE Edit Table does fire the DROPFILES event.
  • Jim - I want to make sure I'm up to speed. Please confirm if this is accurate:
    • You set the ACCEPTDROPFILES property for the form.
    • You can successfully drop files on OI controls and most SRP controls and this will trigger the DROPFILES event.
    • The one exception, thus far, is the SRP Ribbon control.
    If that is correct, I imagine the SRP Ribbon control isn't responding because the OI form does not see the SRP Ribbon as a child control. The nature of the SRP Ribbon control is that it subclasses the OI form, and thus becomes its parent. Note, I am only now coming to understand how this is working internally so this is why I was more optimistic earlier in the thread.
  • I think that is accurate, however I did not test all the OLE controls you provide.

    Is it likely that the Ribbon can be made to see this event, or should I look at another way of doing this?

    What I was trying to do was find a way of adding icons to the ribbon without a lot of typing in the XML file.
  • I wasn't expecting you to test all OLE controls. Just establishing a pattern based on what we know.

    Help me understand your use case. You want to add icons to the ribbon without typing in the XML file. How exactly would this work out? Let's say the DROPFILES event worked. Then what?
  • edited October 2
    I only mentioned I had not tested all the controls just for completeness as other controls might also not work with the DROPFILES event, I was trying to be accurate.

    Well I was hoping the event would report the button that the png file was dropped on, then I would write code to modify the xml accordingly.
Sign In or Register to comment.