Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / [Plugin] FileExplore (File, Folder and System-Drives Handling)

Author
Message
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 27th Apr 2023 18:50 Edited at: 27th Apr 2023 18:54
So now here is an update as requested
The short overview of the new functions.

EnumDesktopModes()
Before the other DesktopModes commands can be executed,
EnumDesktopModes must be done at least once.
This lists all resolution modes internally.
However, this is limited to 32 bit colour depth.
These can be retrieved with the commands GetDesktopModeWidth,GetDesktopModeHeight,GetDesktopModeFrequency and GetDesktopModeJSON.
The return value is the number of modes that were found.

All following commands can only be called if EnumDesktopModes has been called at least once before.

GetDesktopModeWidth(Integer mode)
Returns the width in pixels of the resolution from the specified mode.

GetDesktopModeHeight(Integer mode)
Returns the height in pixels of the resolution of the specified mode.

GetDesktopModeFrequency(Integer mode)
Returns the screen refresh rate of the resolution from the specified mode.

GetDesktopModeJSON(Integer mode)
Returns the width, height, bits per pixel and screen refresh rate in the form of a JSON string.

GetDesktopMode(Integer width, Integer height)
This command is used to find out which mode is best suited to the specified resolution.

GetDesktopMode()
Returns the mode that matches the current resolution set.

SetDesktopMode(Integer mode)
Sets the specified mode. The desktop resolution is set according to the mode.

RestoreDesktopMode()
Restores the desktop resolution according to the registry.

I hope this is what was wanted.

Here is a small example with which I have tested it.




See first post for download.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th Apr 2023 01:53 Edited at: 28th Apr 2023 02:07
working so far but something odd where it seems to be returning a number of duplicates?

running your code on my system returns 750 different modes.
if i filter for frequency 30 it returns 94 but if i check for uniqueness, there seems to be only 32 unique modes at that F:


this is completely fine since we can run filters and provide options to the user which was the whole point of the request but i want to make sure that i'm not missing something?

something i'm also afraid of is, i run on a laptop and pipe it to a 55" tv. it's only returning what the display adapter is capable of, correct?

then, i don't know what this means:
Quote: "RestoreDesktopMode()
Restores the desktop resolution according to the registry."

does this mean it will set it back to what it was before we changed it in-game/app?

ie, this would be ideal for confirming that the user wants to keep the changed mode and, if not, Restore to the original, right? vs manually finding & recording the original mode, prompting the new one, then manually setting it back if they didnt want to keep the new one?

as is, on Exit, it returns to "Registry" DesktopMode, i expect? i don't want to assume

regardless, this returns SetScreenResolution() for WIN and thanks for that
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 28th Apr 2023 21:26
Ok, now the duplicates are filtered out. But I don't know how far the duplicate modes differ that they are listed multiple times by the system.

Quote: "something i'm also afraid of is, i run on a laptop and pipe it to a 55" tv. it's only returning what the display adapter is capable of, correct?"

Only the modes that are possible in combination with monitor/TV and graphics card are listed. It is comparable with the display setting of the desktop.

Quote: "then, i don't know what this means:
Quote: "RestoreDesktopMode()
Restores the desktop resolution according to the registry."

does this mean it will set it back to what it was before we changed it in-game/app?

ie, this would be ideal for confirming that the user wants to keep the changed mode and, if not, Restore to the original, right? vs manually finding & recording the original mode, prompting the new one, then manually setting it back if they didnt want to keep the new one?

as is, on Exit, it returns to "Registry" DesktopMode, i expect? i don't want to assume "

Yes, that is correct.
If you change your resolution in the desktop then this is written into the registry.
Exactly this is then restored with RestorDesktopMode.
I had thought about it, if a game uses a lower resolution. Then it would be good if the original resolution is restored when exiting.

download in the first post.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 28th Apr 2023 22:18
Quote: "I had thought about it, if a game uses a lower resolution. Then it would be good if the original resolution is restored when exiting."


A question I'd have is will the plugin prevent the user's icons from being shuffled around on the desktop as in the past with FSE screen modes below an original setting? What happens if the game/app crashes before it has a chance to reset the resolution back to native? In the past, forcing a full screen resolution could have a number of negative impacts to the end user if it's not kept 1:1 with their original desktop setting. Such behaviors were likely some of the reasons such methods were retired in recent OS/API environments.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 29th Apr 2023 05:09
@SFSW:
The behavior you describe is correct.
This is the consequence of changing the desktop resolution.

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th May 2023 16:14
request access to Windows/Fonts via FE.ChooseFileDialog() where system resources seem unavailable otherwise:

i've run as Admin, etc, to no avail
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th May 2023 21:59
Ok,
I am working on the problem. But it is more complicated than I thought.
But I have the feeling I'm close to a solution.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 2nd Jun 2023 19:57
So,
I think I will not be able to solve this without adding an additional function.

The problem looks like this:
The font directory is a system directory and on normal way IFileOpenDialog has no permission to read in it.
Only if I set the flag FOS_ALLNONSTORAGEITEMS I am allowed to look at the content.
Then you have the problem that the fonts are summarized in font families. This also serves the overview. I think that's ok.
But the selected fonts do not return the correct filenames. But I have already solved this.
Now it is so that ZIP files cannot be selected. They are treated like directories and the content is shown on double click.
To select them you have to set the flag FOS_FORCEFILESYSTEM then the selection works. The disadvantage is that you don't have access to the font directory.

My solution would be another function (ChooseFileDialogEx) where you can specify the flags you need.
For the compatibility to the older code the ChooseFileDialog command remains.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Jun 2023 22:26
as always, thanks for your efforts, MadBit.

i expect your preferred beverage has gone up in price like everything else so i sent a little extra this time.

please enjoy
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 3rd Jun 2023 06:32 Edited at: 3rd Jun 2023 12:18
Thank you and everyone else who supports me.

The mentioned change is ready and new version is available for download.

The flags that can be set with ChooseFileDialogEx can be found with description on the MS page.

Here is the list of flags as constants. For convenient copy/paste .

#Constant FOS_OVERWRITEPROMPT = 0x2
#Constant FOS_STRICTFILETYPES = 0x4
#Constant FOS_NOCHANGEDIR = 0x8
#Constant FOS_PICKFOLDERS = 0x20
#Constant FOS_FORCEFILESYSTEM = 0x40
#Constant FOS_ALLNONSTORAGEITEMS = 0x80
#Constant FOS_NOVALIDATE = 0x100
#Constant FOS_ALLOWMULTISELECT = 0x200
#Constant FOS_PATHMUSTEXIST = 0x800
#Constant FOS_FILEMUSTEXIST = 0x1000
#Constant FOS_CREATEPROMPT = 0x2000
#Constant FOS_SHAREAWARE = 0x4000
#Constant FOS_NOREADONLYRETURN = 0x8000
#Constant FOS_NOTESTFILECREATE = 0x10000
#Constant FOS_HIDEMRUPLACES = 0x20000
#Constant FOS_HIDEPINNEDPLACES = 0x40000
#Constant FOS_NODEREFERENCELINKS = 0x100000
#Constant FOS_OKBUTTONNEEDSINTERACTION = 0x200000
#Constant FOS_DONTADDTORECENT = 0x2000000
#Constant FOS_FORCESHOWHIDDEN = 0x10000000
#Constant FOS_DEFAULTNOMINIMODE = 0x20000000
#Constant FOS_FORCEPREVIEWPANEON = 0x40000000
#Constant FOS_SUPPORTSTREAMABLEITEMS = 0x80000000
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 3rd Jun 2023 12:24 Edited at: 3rd Jun 2023 12:39
i look forward to playing with the new stuff soon, MB. thanks!

meanwhile, can you please explain SetWorkingDirectory() and why we need it? most times i don't use it but when i do, i don't see a difference? i really don't know what it does.

otherwise, i've tamed the images in your sig down a bit to bring the overall closer to the max 600x120 sig rule.
note the "t" just before ".png" in the imgur urls which uses a 160px wide "thumbnail" version of the original. see your last post which depicts the changes.
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 3rd Jun 2023 18:35
SetWorkingDirectory
You simply change your working directory. All relative paths would start from this directory. The operation is similar to SetFolder (SetCurrentDir), except that you can choose a directory that is accessible anywhere from the system. I don't think this is possible with the native AppGameKit commands. Not sure.

Quote: "note the "t" just before ".png" in the imgur urls which uses a 160px wide "thumbnail" version of the original. see your last post which depicts the changes."

How did you know about the 't'. That was new to me. Thanks for the information and the change.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Laughing Coyote Software
6
Years of Service
User Offline
Joined: 30th Jun 2018
Playing: Pillars of Eternity 2
Posted: 14th Jun 2023 02:23
Thanks for the plugin. I'm trying really hard to use explore.setInitialDir() but it seems like it's doing nothing. The chooseFileDialog always opens up to the last working directory. I tried using the full directory, partial, etc., as well as both backslashes and forward slashes. Can anyone tell me what I'm doing wrong? Thanks.



This also does nothing:



Also tried setWorkingDirectory, plus a lot more. I don't know what I'm missing.

Thanks.
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 14th Jun 2023 20:19
No you are not doing anything wrong. After I had changed the way of the DialogBox the function SetInitialDir was functionless.
I will now include it again.
Note that when a directory is set with SetInitialDir, the last selected path is also overwritten.
If you want the last selected path to be valid again then you have to pass an empty string to SetInitialDir.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Laughing Coyote Software
6
Years of Service
User Offline
Joined: 30th Jun 2018
Playing: Pillars of Eternity 2
Posted: 16th Jun 2023 01:59 Edited at: 16th Jun 2023 02:00
Thank you! Are you going to upload another version on the first post? I see the last version was from 3 June 2023.

It's gonna do wonders for my world editor to bring users to the exact folder to select entities and scripts. Thanks again.
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 18th Jun 2023 06:55
It's done.

That's right - download in the first post.

Have fun.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Laughing Coyote Software
6
Years of Service
User Offline
Joined: 30th Jun 2018
Playing: Pillars of Eternity 2
Posted: 18th Jun 2023 09:45 Edited at: 18th Jun 2023 09:45
Works perfectly. Thank you very much.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Jul 2023 18:10 Edited at: 22nd Jul 2023 18:11
I have just stumbled accross this;

I am using Studio V2022.12.12

When i use the full screen option SetWindowSize( GetMaxDeviceWidth(), GetMaxDeviceHeight(), 1 )

The OpenFile Dialog box does not appear ontop of my screen. ie. it is hidden behind my app's screen
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 22nd Jul 2023 23:04
This seems to be a known problem. Dialogue boxes do not work in a fullscreen app.
The only possibility is to jump out of the fullscreen before you call the dialogue and back into the fullscreen after you have finished the dialogue.
I have not found any other solution at the moment.

Or you can also "hide" the window with the plugin.
fe.SetWindowPosition(0,0,1,0,0,0x000293)

After ending the dialogue
fe.SetWindowPosition(0,0,0,0,0,0x000043)
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)

Donations are always welcome.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Jun 2024 00:55 Edited at: 2nd Jun 2024 00:58
is there any way for us to change the title on the color picker?

i have 3-4 different hotkeys for changing colors in a new version of EZ_Subs that i'm working on and would like to change the title for each so folks know theyve chosen the correct hotkey.

if not (currently), a beverage of your choice is being offered as you might be thirsty

Login to post a reply

Server time is: 2024-11-21 10:06:18
Your offset time is: 2024-11-21 10:06:18