ModPlug Central

OpenMPT => Development Corner => Topic started by: Saga Musix on July 08, 2009, 09:14:11

Title: Too many modal message boxes
Post by: Saga Musix on July 08, 2009, 09:14:11
When you start up OpenMPT without a default.mkb in MPT's folder, you get three messageboxes. If you don't have plugins installed and load a tune with many vst plugins, you get a lot of messageboxes (the double amount if you're in debug mode even). Modal dialogs are evil. Especially if they keep buggin you all the time. There are more of them, but I think those two are the most annoying ones. What shall be done?
Title: Too many modal message boxes
Post by: LPChip on July 08, 2009, 12:33:49
I would go for a logfile. Make every error one line, and when all the errors have been given (unless they are severe errors, then display) show one dialog with a textbox showing the log entries.

Like:
-----------------
During startup, the following non-critical errors have been triggered:

SYSTEM:
Could not load C:\modplug\default.mkb

PLUGINS:
Could not find C:\Deleted\Directory\MyVST\plugin.dll
Could not find C:\Deleted\Directory\MyVST\plugin2.dll
Could not find C:\Deleted\Directory\MyVST\plugin3.dll
Could not find C:\Deleted\Directory\MyVST\plugin4.dll

A logfile has been generated: C:\modplug\errorlog.txt
--------------
   OK
--------------

The logfile contains:
=======================
2009-07-08 14:32 PM - The following non-critical errors were triggered:
-----------------------------------------
SYSTEM:
Could not load C:\modplug\default.mkb

PLUGINS:
Could not find C:\Deleted\Directory\MyVST\plugin.dll
Could not find C:\Deleted\Directory\MyVST\plugin2.dll
Could not find C:\Deleted\Directory\MyVST\plugin3.dll
Could not find C:\Deleted\Directory\MyVST\plugin4.dll
Title: Too many modal message boxes
Post by: Saga Musix on July 08, 2009, 13:31:49
creating a logfile is rather out of question because users won't read it anyway. this is more about code design than about redirecting these annoyances to a different location. apart from that, the VST messages appear when loading a tune, not when loading mpt. the annoying thing is that you get dozens of useles modal messageboxes (modal = you can't do anything until the dialog is closed), where one would be sufficient.
Title: Too many modal message boxes
Post by: LPChip on July 08, 2009, 15:35:05
Yes, I'm aware. I'm not saying that its a log file only, but since you're collecting info anyway, putting everything in a logfile is always handy. The idea is to also show this info on the screen so the user will read it. The logfile is purelly for reference since you want to close the dialog and then fix the issue.
Title: Re: Too many modal message boxes
Post by: Relabsoluness on July 08, 2009, 16:20:09
Quote from: "Jojo"When you start up OpenMPT without a default.mkb in MPT's folder, you get three messageboxes.
Yes, one should be enough; the two first ones could be written to a log that LPChip suggested. Currently there are some primitive logging in the code but I think a better and more verbose one which also (optionally) gets written to file could be useful for devs and users alike.

Quote from: "Jojo"Modal dialogs are evil.
Especially when misused. I think for example tooltip-style message windows would in many cases be a much better alternative compared to modal messageboxes. Due to the framework, however, it's just so much easier to create a modal messagebox.

Quote from: "Jojo"There are more of them, but I think those two are the most annoying ones. What shall be done?
I don't see the keyboard related problem that serious - this shouldn't be a common problem for users (and actually perhaps it would be feasible to include a read-only default keymap in the executable's resources in addition to the actual file. Then there would always be at least some default keymap available). The VST problem affects more people: for now, perhaps just gather all the 'this is missing'-notices and show them all in one window; ability to search for each of them individually from KVR doesn't seem that essential feature.
Title: Too many modal message boxes
Post by: Saga Musix on July 08, 2009, 19:26:50
And still, one could open several browsers / tabs with the name of the missing plugin. i think the feature is useful, but that's not a reason for me to show 20 modal messageboxes.
Title: Too many modal message boxes
Post by: LPChip on July 08, 2009, 21:47:49
Agreed. One positive thing about model messageboxes, is the copy feature. Whenever you have a message popped up, press CTRL-C and it'll copy a textform of that messagebox into the clipboard. :)

I use it alot at work to copy errors in textform into our call-registration system.
Title: Too many modal message boxes
Post by: Saga Musix on July 08, 2009, 21:53:47
I don't think that this works with default messageboxes. At least it never worked for me. No matter if they're modal or not.
Title: Too many modal message boxes
Post by: LPChip on July 08, 2009, 22:07:04
Quote from: "Jojo"I don't think that this works with default messageboxes. At least it never worked for me. No matter if they're modal or not.

Yes it will. Only if an application uses a different than the default windows popup box (even the javascript:alert('msg'); works), then it can't be used.

Try it.

Find a program/game/whatever... and copy its content using CTRL-C, then paste into notepad.

An example of a net send dialogbox:

---------------------------
Messenger-service
---------------------------
Bericht van LPCHIP1 aan LPCHIP op 9-7-2009 0:05:19



this is a test
---------------------------
OK  
---------------------------

Try it: do net send xxxx this is a test

(replace xxxx with either your username/computername).

Note: you need to have the messenger service enabled for this to work, or you'll get an error.
Title: Too many modal message boxes
Post by: Saga Musix on July 08, 2009, 22:13:58
Well, I wonder where OpenMPT gets its messageboxes from, because they do *not* show up in the clipboard.
Title: Too many modal message boxes
Post by: Sam_Zen on July 09, 2009, 00:27:13
Nice tip, LP.. At least with the .mkb message it works.
And this message is generated by OMPT, because, if minimized to the taskbar, it shows the red icon.
Caught from clipboard :
Can't open file keyboard config file c:\nnnnn\sndtools\ompt_beta53\default.mkb  for reading.

And a smooth idea by Realab to include a read only default keymap in the package.
It's often better to avoid these messages in the first place.

Anyway, this message looks odd, because it comes when opening OMPT beta 54..
When updating the version, I wrote the new exe over the old one, with the .mkb file still in the root.
Checked, the path to the .mkb appeared to be still the old one in the ini-file.
After editing the ini-file, the message was gone.

So I guess, if the path for the VST plugins is not correct in the ini-file, one gets messages too.
Of course, when a needed plugin doesn't exist on the system anywhere, it's obviously causing a message.
Title: Too many modal message boxes
Post by: Saga Musix on July 09, 2009, 15:56:53
Quote
And a smooth idea by Realab to include a read only default keymap in the package.
I don't know where you downloaded modplug ( :nuts: ) but there's several keymaps included with modplug. However, if you're compiling the sourcecode you normally don't have a keymap in that directory, or if you move the exe to a different directory, no "readonly" or whatever keymap will ever prevent you from not copying the keymap with the exe file.

And Sam, this is not about modplug not finding stuff, it's about a very bad programming practice, namely using modal (http://en.wikipedia.org/wiki/Modal_window) notifications where they are not needed, in some cases even popping up dozens of them.
Title: Too many modal message boxes
Post by: Relabsoluness on July 09, 2009, 20:38:28
Quote from: "Jojo"However, if you're compiling the sourcecode you normally don't have a keymap in that directory, or if you move the exe to a different directory, no "readonly" or whatever keymap will ever prevent you from not copying the keymap with the exe file.
Perhaps you missed the essential part in my post: "include a read-only default keymap in the executable's resources". In practice this means that the text of default.mkb would be included in the exe-file itself as resource so keys would always work without any additional file, and of course an editable file would be created after first run and that would be used thereafter to load the keymap.
Title: Too many modal message boxes
Post by: Saga Musix on July 09, 2009, 21:00:54
Well yeah, I was just looking at Sam's post.
Title: Too many modal message boxes
Post by: Sam_Zen on July 09, 2009, 22:12:10
Quote..it's about a very bad programming practice, namely using modal notifications where they are not needed..
I understand.
Title: Too many modal message boxes
Post by: Saga Musix on July 21, 2009, 18:52:11
It's a first try...

(http://sagagames.de/ithumb/show/plugins1612as85.png)
Title: Too many modal message boxes
Post by: Sam_Zen on July 22, 2009, 00:12:28
Looks good !
Title: Too many modal message boxes
Post by: bvanoudtshoorn on July 22, 2009, 00:17:33
Perhaps you should include in that message something to the effect that the track will still load, but may not sound as the composer intended -- in other words, make sure the user knows it's not a critical error.

Oh, and I think that making the default button "No" would also be a good idea. :)

Edit: And while I'm at it... Perhaps see if you can make the KVR link clickable.

Edit: OK, last edit, I promise. Perhaps offer to search for the plugins manually -- either by using a file-open dialog (for each individual plugin, or if there's only one plugin) or by scanning a directory chosen with a directory-selection dialog.
Title: Too many modal message boxes
Post by: Sam_Zen on July 22, 2009, 00:45:48
The warning is ok, as is the default no.
Title: Too many modal message boxes
Post by: Saga Musix on July 22, 2009, 08:02:43
Quote
Oh, and I think that making the default button "No" would also be a good idea.
That IS actually the default button.
Also, you can't make links clickable when using default MessageBoxes.

Searching for plugins is a completely different feature, but I planned on working on this at some point.
Title: Too many modal message boxes
Post by: Relabsoluness on July 22, 2009, 13:41:14
Indeed a nice improvement.