Asset - Extension Dialog Module (for Windows, macOS, and Ubuntu)

Samuel Venable

Time Killer
Version 8.2.0 Released!

Just released the Linux re-write, added new functions, and updated both the extension and demo executable uploads on both stores.


Here's what's new:
  • show_message_cancelable(str) same as show_message() but has a cancel button.
  • show_question_cancelable(str) same as show_question() but has a cancel button.
  • show_attempt(str) shows a special type of error message, that unlike show_error(), it does not provide a way to abort the application. Instead, it has a 'Retry' and a 'Cancel' button.
  • message_get_caption() returns a custom message caption that was previously set by the developer, if one was set. Otherwise, it will return an empty string.
  • message_set_caption(str) sets a custom message caption for the message, question, attempt, error, and input, and hidden input dialogs. Set str to an empty string to restore the default value, which is either the game window title, game executable name, or "Error" depending on the dialog type and platform in use.


Button returned values:
  • 'X' close button may vary in return value.
  • 'Abort' aborts the app; no return value.
  • 'OK' and 'Yes' return 1.
  • 'No' and 'Retry' return 0.
  • 'Cancel' and 'Ignore' return -1.
 
Last edited:

Samuel Venable

Time Killer
Hey y'all! Localization features are going to be in the works soon as the next top priority.

New functions planned:
  • string l10n_get_language() returns the current language in use for dialog localization.
  • real l10n_set_language(string lang) sets the current language to use for dialog localization. Returns 1 on success and zero on failure. It will only fail if the lang argument specifies a misspelled or unsupported language string.
Supported languages:
  • "lang_english_us"
  • "lang_english_uk"
  • "lang_spanish"
  • "lang_german"
  • "lang_portuguese"
  • "lang_chinese"
  • "lang_japanese"
  • "lang_russian"
  • "lang_ukrainian"
And I think that's a good starting point for now. I'm opened to suggestions if your preferred language(s) to support are not listed here.
 
Last edited:

Samuel Venable

Time Killer
Here's some important information that I forgot to address previously with asset's description.

After showing a dialog you must clear the keyboard and mouse state since GameMaker Studio 2 doesn't do that on its own:
Code:
keyboard_clear(keyboard_lastkey);
mouse_clear(mouse_lastbutton);
 

Samuel Venable

Time Killer
I discovered a bug with the color picker dialog on Mac that I'm really surprised I haven't discovered sooner. Pressing the escape key will close the dialog, but the game window will remain frozen in a modal state, as if the dialog is still there. I haven't looked at my code for this in a while, but I'm pretty sure I know what the issue is and I'll have it sorted out most likely before the end of tomorrow. I have several people requesting me to make extensions for them and I really need to deliver on that as my next priority after I get this fixed. I would have gotten these things done a lot sooner if I weren't so busy these past couple days so I apologize.
 
Last edited:

Samuel Venable

Time Killer
I fixed the bug mentioned in my previous comment with the Mac color picker functions. The update on all sites is now publicly available.
 

Samuel Venable

Time Killer
It was brought to my attention that the latest K Desktop Environment is completey broken, so if you are using KDialog on Linux I strongly recommend switching to Zenity until the next KDE update that should hopefully address those issues is released. Note this is not a bug with my extension or KDialog but rather all of KDE. KDE developers are working hard to get everything working and back to normal again so please stay tuned to this topic, and I will let everyone know when I discover that update has arrived.
 

Samuel Venable

Time Killer
I have updated my K Desktop Environment recently, and it appears the KDE Developers fixed it. KDialog should now be 100% usable again for everyone. My apologies for any inconvenience this former bug may have caused. I recommend updating your KDE install for these fixes to take place:
Code:
sudo apt-get install keditbookmarks kdialog
 
Last edited:
Hi Samuel,

Thank you for the great extension. Having a file browse window always on top is exactly what I was after.

I do have a problem implementing this into an existing project that currently uses GMFileSystem to break the sandbox. Once you access a non-sandboxed file with GMFileSystem it would allow access to it using the original file path. For some reason, using your extension (get_open_filename_fmns) to browse for a file disables the non-sandboxed access given by GMFileSystem. Any file accessed prior to using get_open_filename_fmns is still accessible afterwards but anything added afterwards cant be accessed.

Do you have any idea on how to work around this? Does the 'FileManager' extension come in to play here?

Using GMS 1.4.9999
 

Samuel Venable

Time Killer
I don't know much about that other extension, but I do know using File Manager you may copy files in and out of the sandbox directory to give them loading and saving access while in it. You can copy them to your sandbox directory using the built-in directory variable game_save_id which will return the sandbox location.

Also, if you are ok with no longer having access to the directory browser functions, I updated the extension for 1.4 which mostly works except the directory browser functions now crash the game (Windows-only bug) and all functions using obsolete function names need to be renamed manually in the resource tree. Other than those several oddities of using GMS 1.4 it is still functional.

If you want this update, which you might not because it sounds like you have an older version that doesn't have these issues, you may download it here:

https://www.dropbox.com/sh/h1z7qmn2r7semj7/AABEdXp58KL_4YqN_M2v1JVea?dl=0

However there are new functions in this version which you might want. Keep a backup of the older version before updating to see which one you prefer.

If you upgrade to GMStudio 2.x at any point in time, please note all of the aforementioned bugs and issues are no longer present in 2.x, which is partially why I am only officially supporting GMStudio 2.x going foward with this extension.
 

Samuel Venable

Time Killer
Hey guys, the terminal command for installing KDialog has changed recently for all Ubuntu and Debian-based Linux distributions.

The correct package install command is now:
Code:
sudo apt-get install keditbookmarks kdialog
Cheers,
Samuel
 
Last edited:

Samuel Venable

Time Killer
Light.png Dark.png

Something cool that I wasn't originally aware of about the KDialog Widget System, if your desktop environment is KDE, it will change visually according to whether you are using KDE's Light or Dark themes. On other desktop environments like Unity, GNOME, or XFCE, you will notice you only have the light theme as an option, as that is the default on non-KDE desktop environments. Zenity will always use the Light theme on OS's with KDE as the desktop environmemt.
 

Samuel Venable

Time Killer
I made get_password() and get_passcode() on Windows look more appealing by using the "black circle" character rather than an asterisk. This update can be downloaded from the itch.io link in the OP. I have yet to upload it to the GameMaker Marketplace because their uploader built-in to GMS2 keeps on failing in the middle of the upload process. I'm going to submit a ticket to sort this out on their tracker soon. I'll be updating the screenshots soon to reflect these changes, and I already did so with the online docs - http://dialogmodule.weebly.com/ I'll let everyone know when the GM Marketplace gets this update. To apply the update simply replace the Windows DLL with the new one, and the source code ZIP as well optionally for those of you who want the new source. This update only effects the Windows version so nothing else needs replacing. :)

get_password() - before update

07_original.png

get_password() - after update

07.png

get_passcode() - before update

09_original.png

get_passcode() - after update

09.png
 

Samuel Venable

Time Killer
This asset became corrupt on YoYo's servers since the last time I updated it. I uploaded a new version to fix it, as well as some general bug fixes and improvements have been added to the previously, non-corrupted, version. I hope everyone enjoys this update! :D
 

Samuel Venable

Time Killer
There's something important everyone should know when using this extension on Linux - you need to check if zenity or kdialog is installed at runtime, depending on which one you use to create dialogs, because if they are not installed, the user will still be able to play your game, however no dialogs will be visible, so you will need in such a case to draw text to the game window an error explaining they need to install the missing dependencies.

Here's an example code to do this:
Code:
// Draw Event
if (widget_get_system() == "Zenity" && !file_exists("/usr/bin/zenity")) {
  draw_text(32, 32, "Error: Zenity is not installed! Required dialog boxes will not show. Install Zenity with: sudo apt-get install zenity");
} else if (widget_get_system == "KDialog" && !file_exists("/usr/bin/kdialog")) {
  draw_text(32, 32, "Error: KDialog is not installed! Required dialog boxes will not show. Install KDialog with: sudo apt-get install kdialog");
}
You may create in your game options screen a setting the gamer can change to allow them to choose whether to use zenity or kdialog, if both are installed:
Code:
if (file_exists("/usr/bin/zenity") && file_exists("/usr/bin/kdialog")) {
  widget_allow_user_to_choose_system = true // when this is true, allow the option using your own code
}
Or, if you only want to use KDialog only when you are using a KDE Desktop Environment:
Code:
if (widget_get_system() == "Zenity") {
    if (environment_get_variable("XDG_CURRENT_DESKTOP") == "KDE")
        widget_set_system("KDialog");
}
 
Last edited:

Samuel Venable

Time Killer
Updated the visual appearance of the macOS dialogs a bit. Some of them are now sheet modal, while others open in the center of the game window's position.

<image removed>

Also an important note regarding this special update - please make sure you use this new function call at game start:
Code:
widget_set_owner(hwnd_main);
This will ensure that the dialogs attach to your game window. Otherwise it might not attach to the correct window on your screen, (or in mac's case, attach to no window at all). This should only happen if your game window is not in focus above all other windows and you are not calling the function above with the specified argument.

This function was always necessary on Windows and Linux to prevent that bug, I just haven't added it until now because I didn't find there to be many possible cases where the issue would end up happening regardless. On mac with the sheet modal additions, it became 100% necessary, so here you go, after all this time I did it. :D
 
Last edited:

Samuel Venable

Time Killer
I'm on vacation right now, but when I get back I'll be able to resume what I was working on with this asset.

The following functions will be available in the next update:
  • widget_set_icon(icon) will be expanded to work with X11/GTK+
  • widget_set_position(x, y) set the positon of the dialogs
  • widget_set_size(width, height) set the size of the dialogs
  • widget_set_centered(center) whether to override position with center
  • widget_set_embedded(embed) whether to embed dialogs in their owner window
  • widget_set_showborder(show) whether to show the border in the dialogs
The following is planned for the version released thereafter:
  • widget_set_icon(icon) will be expanded to work with Win32
  • show_error() will be replaced to have a better implementation
  • show_message_ext(str, btn1, btn2, btn3) will be implemented
  • get_calendar() will be implemented
 

Samuel Venable

Time Killer
I just released a new version which allows you to set a custom icon for the Win32 dialogs as well (note all platforms support this now, and only PNG images are supported for the icon file on each platform). I also fixed a bug with the InputBox dialogs on multiple monitor setups; now all the dialogs will show up on the correct monitor.
 

Samuel Venable

Time Killer
I extended to 50% off sale for the next several months. It might end without warning, so get it cheap while you can!

I fixed a couple small bugs with the macOS and Linux ports, related to window positiong on Linux and a problem with macOS Catalina and multiple monitors that needed my attention.

Can't publish this update until YoYo fixes the extension uploader. I keep on getting errors every time I try to upload the package.
 

Samuel Venable

Time Killer
Added a new link to the OP for those who want GameMaker Studio 1.4 support and/or don't wish to pay for the GameMaker Studio 2 version:
Download for GameMaker Studio 1.4/GameMaker Studio 2 (Google Drive)*

*By downloading for free you acknowledge you are not supporting further development.
Note this download includes newly added support for *ASYNC* versions of every function; works the same as in GMStudio's built-in functions.
 
Last edited:

Samuel Venable

Time Killer
Updated the FileManager extension version that is bundled with this extension. It has been re-written in C++17 using the std::filesystem library. Download Free the from Google Drive (or purchase from the GameMkaer Marketplace/itch.io to place a donation): https://drive.google.com/drive/folders/1nx62yTl3BUGXgCYhnFDjoMo3Yw5GGRPZ

The main benefits of this update are:
  • Minor bugfix to allow copying directories from a source directory to a destination inside the source.
  • Cross-platform error printing to console, using the original C++17 std::filesystem library error codes.
  • Most of the code is portable now, written once, compile everywhere - it can even be compiled for Mobile and Consoles with minimal tweaking necessary, (not counting DialogModule itself, FileManager-only). Source code is included for the libraries so try it out! :D
 
Last edited:

Samuel Venable

Time Killer
The File Manager extension bundled with Dialog Module now includes several new functions and macros, which are listed below:

program_filename - current executable filename, not including the directory it is in

program_pathname - the absolute path to the current executable file, including the executable's filename. This string is guaranteed to not be truncated, with no character limit, (except on Windows due to the MAX_PATH 260 OS-level character limitation).

directory_contents_ext(dname, pattern, includedirs) - displays the contents of a specified directory dname, filtered by the specified allowed file types pattern. An example of a pattern can be "*.png;*.jpg;*.jpeg;*.gif" while each file type is separated by a semicolon. Use an asterisk to include all file types, e.g. "*.*" or simply "*". includedirs is whether to include directories in the list. The string returned by this function uses a new line character "\n" as the delimiter between each file or directory, each in the form of an absolute path, while not recursive. Parsing this string must be done manually using other GML functions for it to be particularly useful.

filename_absolute(fname) converts a relative path to an existing file or directory to an absolute path. If the path specified is a directory a trailing slash is append if there isn't one already. If the file or directory doesn't exist, an empty string is returned. Also can be used to resolve symbolic links on Unix-like platforms such as Mac, Linux, and BSD.

The update may be downloaded here: https://drive.google.com/drive/folders/1nx62yTl3BUGXgCYhnFDjoMo3Yw5GGRPZ
 
Last edited:

Samuel Venable

Time Killer
Improved the asynchronous dialog implementations to work more like the built-in functions + added button localization functions.

GML:
widget_get_button_name(type);
widget_set_button_name(type,name);
// "name" is the button name string
// "type" can be one of the following:
btn_abort
btn_ignore
btn_ok
btn_cancel
btn_yes
btn_no
btn_retry
 
Last edited:
Top