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

S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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);
 
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

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

Sam (Deleted User)

Guest
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.
 
S

Sam (Deleted User)

Guest
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 by a moderator:
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
 
S

Sam (Deleted User)

Guest
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.
 
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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.
 
S

Sam (Deleted User)

Guest
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
 
S

Sam (Deleted User)

Guest
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
 
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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
 
S

Sam (Deleted User)

Guest
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.
 
S

Sam (Deleted User)

Guest
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.
 
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
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 by a moderator:
S

Sam (Deleted User)

Guest
A few updates on this.

macOS 11.0.1 Big Sur compatibility

First and foremost Apple didn't deprecate anything used in Dialog Module's source code this year, which unlike the last couple years that means I won't have to apply any maintenance for a whole year (yay). As Steve Jobs once said, I'm delighted to announce it 'just works'.

Ubuntu 20.04 LTS Focal Fossa Compatibility

As for users running their Linux desktops under the KWin Window Manager using Desktop Environments such as KDE and LXQt, the author of KDialog added support for --ok-label due my request since the release of Ubuntu 20.04 LTS Focal Fossa. This means if you are using KWin any dialogs that previously did not show up is because I was using the --ok-label feature which was still in the process of being added to various Linux distributions. Those dialogs will now work properly on systems that upgraded to Focal Fossa. Also I really recommend KDE neon over Kubuntu for newer stuff from KDE, but that's just a matter of taste and the new stuff won't be as stable. KDE in general is honestly just beautiful. For Ubuntu 20.04 LTS Focal Fossa and KDE neon support, upgrading to the GameMaker Studio 2.3.1 Beta is currently required. Download on itch.io.
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
Wanted to give everyone the heads up I am publish an important patch right now for this extension that addresses the following issues that arose:

1) Zenity (GTK+) dialogs on Linux stopped showing due to a command line option that is no longer available which all of the dialogs used.

2) Both Zenity (GTK+) and KDialog (Qt) dialogs didn't stay on top of the game window on any session that uses the Wayland Window Compositor. This is also now fixed.

Publishing the hotfix update now as we speak. Will be ready within 10-15 minutes. Don't forget to update before people who bought or downloaded your game start to complain.

Edit:

Published!
 
Last edited by a moderator:
S

Sam (Deleted User)

Guest
Now available for the Raspberry Pi.

Install the extension as normal either from itch or the marketplace and replace the libdlgmod.so linux library under the extensions subfolder of your project with the one found in zip file available here labeled with "raspbian": https://github.com/time-killer-games/libdlgmod/releases/tag/v1.0.0.0

Same can be done with the bundled file manager extension, get the raspbian port of that here: https://github.com/time-killer-games/libfilesystem/releases/tag/v1.0.0.0
 
S

Sam (Deleted User)

Guest
Updated the macOS file and directory selection dialogs to use Dear ImGui instead of the native Cocoa dialogs; this is largely due the fact my code has been broken since the release of macOS 12 and it took way too freaking long to figure out how to fix it going the native route. I managed to write a wrapper for an ImGui dialog much faster than it took me to make zero progress with figuring out the native solution. Still supports UTF-8, but the downside is you need to package all the Noto Sans fonts with your game for every language iteration you want to support in order for those languages to display properly. Preview screenshot below...



You can optionally replace the Noto Sans fonts under included files and resize the font(s) you choose by modifying the appropriate environment variables:

GML:
// set the "IMGUI_FONT_PATH" environment variable to a directory which contains one or more *.ttf and/or *.otf font files. for all the
// fonts that are found in the folder this variable is set to, they will be combined into one singular font to support more languages.
environment_set_variable("IMGUI_FONT_PATH", working_directory + "fonts"); // the default load location is program_directory + "assets"

// set the "IMGUI_FONT_SIZE" environment variable to a size for the font; the font will only be resized to the size this variable is set
// to if and only if the "IMGUI_FONT_PATH" successfully loaded at least one custom *.ttf and/or *.otf font file. Otherwise it won't set.
environment_set_variable("IMGUI_FONT_SIZE", string(30)); // the default size is string(30) when a custom font was successfully loaded ok
Get all updates for this asset from itch.io instead of the marketplace until further notice...

 
Last edited by a moderator:

Nyako

Member
Hey, is there a way to hide the icon in message boxes? Like, the information/warning/error signs to the left of the text. If I remember correctly, in the Windows API, you can remove the icon by not passing in MB_ICONEXCLAMATION/MB_ICONWARNING/MB_ICONINFORMATION/ whatever it is.
 
S

Sam (Deleted User)

Guest
Hey, is there a way to hide the icon in message boxes? Like, the information/warning/error signs to the left of the text. If I remember correctly, in the Windows API, you can remove the icon by not passing in MB_ICONEXCLAMATION/MB_ICONWARNING/MB_ICONINFORMATION/ whatever it is.
Yeah, that sounds correct. The extension is open source. Sounds like you already know what to edit in the source: https://github.com/time-killer-games/libdlgmod

Although with the current API's used there is no way to do this in a way that will be cross-platform without a bit of a rewrite. If you want me to make a custom version for your needs I am happy to do so, but I am not going to be including this as a part of the official distribution.
 

Nyako

Member
Yeah, that sounds correct. The extension is open source. Sounds like you already know what to edit in the source: https://github.com/time-killer-games/libdlgmod

Although with the current API's used there is no way to do this in a way that will be cross-platform without a bit of a rewrite. If you want me to make a custom version for your needs I am happy to do so, but I am not going to be including this as a part of the official distribution.
A custom version would be very appreciated; I'm on a time limit (I'm doing a game jam with my friends) so I wouldn't want to take the time trying to figure out how to make the changes.
I would only need Windows and Linux versions, but I don't know enough about Linux to compile the library for that platform.
When I was trying to do it myself, I added a use_icons variable to every dialog box function, since I didn't care about it being pretty; I just needed something that worked. However I gave up pretty quickly because I got pretty lost.
 
Top