Re: Problem in Dialog

Eduardo Gutierrez de O <[email protected]> Sun, 15 Apr 2018 21:30:48 +0200
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
Daniel,

You're right. I meant to paste a snippet from one of my apps and by mistake I pasted from a custom one.

Nonetheless, the important part is that you need to share the bit of code giving you trouble. Otherwise it's shooting in the dark.

For what it's worth, the User Guide example works ok for me:

Dim f As FolderItem
Dim m As New Movie

Dim jpegType As New FileType
jpegType.Name = "image/jpeg"
jpegType.MacType = "JPEG"
jpegType.Extensions = "jpg;jpeg"

Dim pngType As New FileType
pngType.Name = "image/png"
pngType.MacType = "PNG "
pngType.Extensions = "png"

f = GetOpenFolderItem(jpegType + pngType)
If f<> Nil Then
  MsgBox("Open worked. File is "+f.NativePath)
Else
  MsgBox("Open failed.")
End If

I just created a new project and assigned this to the "Action" event of a simple button. It then shows only PNG and JPG files and complains if I don't pick anything.

Eduo

> On 15 Apr 2018, at 19:32, Daniel Drijard <[email protected]> wrote:
> 
> Eduardo, 
> 
>    You mention 2 functions (or commands ?), SetupOpenDialog and DealWithFile, which I do not know and which are declared as well unknown by the current HELP of XOJO. 
> Daniel
> 
>> On 15 04 2018, at 18:51, Eduardo Gutierrez de O <[email protected] <mailto:[email protected]>> wrote:
>> 
>> I think you're talking about different things.
>> 
>> James is talking about Getfolderitem, which allows you to define a folderitem from a path. 
>> 
>> OpenDialog (and FolderItemDialog, for a customizable version) is defines into, and opens, its own modal window.
>> 
>> Without seeing a bit of your code it's impossible to find what you may be missing
>> 
>>   dim o as opendialog
>>   dim f,r as folderitem
>>   o = new opendialog
>>   o.prompttext = "Select a file to open"
>>   SetupOpenDialog(o)
>>   r = o.showmodal
>>   if r <> nil then
>>     f = o.result
>>     MsgBox "Selected file is "+f.name
>>   end
>> 
>> (with "DealWithFile" being a function to deal with the file :D )
>> 
>> Eduo
>> 
>>> On 15 Apr 2018, at 17:17, Daniel Drijard <[email protected] <mailto:[email protected]>> wrote:
>>> 
>>> Hello, james
>>>    GetFolderItem will not allow me to choose a file inside a directory as a Dialog will instead.
>>> Daniel
>>>> On 15 04 2018, at 17:10, Jim Wagner <[email protected] <mailto:[email protected]>> wrote:
>>>> 
>>>> Hello, Daniel -
>>>> 
>>>> That has never been how you access the file system. Try GetFolderItem() or one of its relatives.
>>>> 
>>>> Jim
>>>> James Wagner
>>>> Oregon Research Electronics
>>>> http://www.orelectronics.net <http://www.orelectronics.net/>
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Apr 15, 2018, at 7:21 AM, Daniel Drijard <[email protected] <mailto:[email protected]>> wrote:
>>>>> 
>>>>>    I create a Dialog by OpenDialog, then define a starting Directory, then trigger ShowModal(). I get an empty window, transparent and movable which does not show the Directory I defined.
>>>>>   Any clue ? Thanks in advance. 
>>>>>   I use an iMac with Sierra
>>>>> Daniel
>>>>> 
>>>>> Daniel Drijard
>>>>> Thoiry téléphone : 
>>>>>   04 50 41 22 75
>>>>>     international
>>>>>   +33/4 50 41 22 75
>>>>> Courriel :
>>>>>    [email protected] <mailto:[email protected]>
>>>>> Thoiry F-01710
>>>>>    48, rue des Savoies
>>>>> 
>>>> 
>>> 
>>> Daniel Drijard
>>> Thoiry téléphone : 
>>>   04 50 41 22 75
>>>     international
>>>   +33/4 50 41 22 75
>>> Courriel :
>>>    [email protected] <mailto:[email protected]>
>>> Thoiry F-01710
>>>    48, rue des Savoies
>>> 
>> 
> 
> Daniel Drijard
> Thoiry téléphone : 
>   04 50 41 22 75
>     international
>   +33/4 50 41 22 75
> Courriel :
>    [email protected] <mailto:[email protected]>
> Thoiry F-01710
>    48, rue des Savoies
>