FileRequest mask for "All Supported Files" ?

Discuss any general programming issues here
Post Reply
User avatar
midwan
Posts: 74
Joined: Sun Jun 19, 2016 1:15 pm
Location: Sweden

FileRequest mask for "All Supported Files" ?

Post by midwan »

I've been searching for this but I couldn't see that it works - perhaps it's not supported?

When I open up a FileRequest() with a specified pattern, say "png|jpg|jpeg|iff|pcx|bmp", I get a requester which has each file type listed in a dropdown list separately.
What I would like to have in addition to that (or instead of that, doesn't matter) as the default option, would be the "All Supported Formats" option which would show all allowed file extensions together (instead of having to manually select a type from the dropdown list).

That's normally how other standard file requesters work when browsing for specific file types.

Indeed, that's what the sample "AnimPlayer" actually does as well. However, copying the same code from there behaves differently in my project:

Code: Select all

/* get additional anim file types supported by plugins */
Function p_GetPluginFiletypes()

	Local p = GetPlugins()

	freqmask$ = "anim|anim5|anim7|anim8|anim8w|anim8l|anim16|anim32|ham6|ham8"

	; iterate over all plugins that we have
	For Local k = 0 To ListItems(p) - 1
	
		Local ft = p[k].Filetypes
		
		; iterate over all file types that this plugin makes available
		For Local i = 0 To ListItems(ft) - 1
			
			; does this plugin support anims? Add its file type to our mask!
			If (ft[i].Type = #FILETYPE_ANIM) And (Not (ft[i].Flags & #FILETYPEFLAGS_SAVE))
				freqmask$ = freqmask$ .. "|" .. ft[i].extensions
			EndIf
		Next		
	Next	

EndFunction
and later on:

Code: Select all

Local files = FileRequest("Select Anim", freqmask$, #REQ_MULTISELECT)
I've tried removing the #REQ_MULTISELECT, but the result was still the same.

I even tried this:

Code: Select all

freqmask$ = "anim|anim5|anim7|anim8|anim8w|anim8l|anim16|anim32|ham6|ham8"
Local files = FileRequest("Select Anim", freqmask$, #REQ_MULTISELECT)
...but the result was the same.

Did I miss something? Is there a version issue here?
I'm using @VERSION 6,1 vs 5,3 in the example.
I'm also using RapaGUI, but I don't think that matters for the FileRequest().

EDIT: Testing the last 2 lines on a completely empty project, actually gets me the desired result. There's something in my code for sure, but I haven't yet figured out what. :)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FileRequest mask for "All Supported Files" ?

Post by airsoftsoftwair »

Actually, this is caused by RapaGUI. Remember that RapaGUI completely overrides Hollywood's inbuilt display and requester adapters with custom versions and it seems like RapaGUI behaves differently than Hollywood here. I'll fix this in RapaGUI.
User avatar
midwan
Posts: 74
Joined: Sun Jun 19, 2016 1:15 pm
Location: Sweden

Re: FileRequest mask for "All Supported Files" ?

Post by midwan »

Thanks for confirming this!
I noticed that it works as expected on a real Amiga, using the same code.
Perhaps it's limited to Windows platforms (I didn't test Mac/Linux or others yet).
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FileRequest mask for "All Supported Files" ?

Post by airsoftsoftwair »

Yes, it won't happen on AmigaOS because on AmigaOS it's possible to integrate foreign toolkits like MUI seamlessly into Hollywood's existing program design. On all the other platforms this isn't possible which is why on Windows, Linux and Mac OS RapaGUI has to replace much more core components with custom versions than on AmigaOS.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: FileRequest mask for "All Supported Files" ?

Post by airsoftsoftwair »

Code: Select all

- Fix [Windows/MacOS/Linux]: FileRequest() filters were laid out in a different way than
  filters in file requesters managed by Hollywood; this inconsistency has now been fixed
Post Reply