Flexible message windows

No application can do without message windows (also known as message boxes or dialog boxes). Be it to inform the user, ask for confirmation or request a decision.

As part of our own developments, we have implemented a module for the flexible programming of message windows, which I would like to present to you in this article.

Advantages

Dialog boxes can already be displayed with function WinDialogBox() in conzept 16. The SysMsg module attached as a download at the end of the article offers several advantages over this function:

  • Placeholder
    Placeholders can be used in the title and text, which are replaced by replacement texts and control characters. Examples:
    \1” – 1. Replacement text
    \n” – Line break
    \t” – Tabulator
  • Text alignment
    The message text can be aligned to the left, right or centered and at the top, bottom or middle.
  • Enlargeable
    The message window can be enlarged by the user.
  • Localizability
    The button labels can be displayed in different languages.
  • Query messages
    The message window can prompt the user to enter a character string or a number that can be validated during input.
  • Own objects
    You can add your own objects to the message window.
  • Own buttons
    You can add your own buttons to the message window.

Examples

Information
Information message with replacement text
SysMsg:Msg.Info(
  'Empty directory', // Title
  'The directory "\1" was successfully emptied.', // Text
  _Msg.Escape | _Msg.SoundNone, // Options
  0, // Parent window
  'MyDir' // 1. Replacement text
);
Warning
Warning message with cancel, repeat and ignore button
switch (SysMsg:Msg.Warn(
  'Save file', // Title
  'A file with the name "\1" is already available.', // Text
  _Msg.Escape | _Msg.ButtonsAbortRetryIgnore, // Options
  0, // Parent window
  'MyFile.txt' // 1. Replacement text
))
{
  // Cancel (Exit)
  case _Msg.IDAbort  : { /*...*/ }
  // Repeat
  case _Msg.IDRetry  : { /*...*/ }
  // Ignore
  case _Msg.IDIgnore : { /*...*/ }
}
Error
Error message with left-aligned text
SysMsg:Msg.Error(
  'Import file', // Titel
  'The file "\1" could not be imported.\n' +
  'An error occurred while reading the XML document:\n' +
  '\n' +
  'Error\t: \2' +
  'Line\t: \3\n' +
  'Column\t: \4', // Text
  _Msg.Escape | _Msg.TextAlignLeft, // Options
  0, // Parent window
  'MyFile.xml', // 1. Replacement text
  XMLError(_XMLErrorText), // 2. Replacement text
  XMLError(_XMLErrorLine), // 3. Replacement text
  XMLError(_XmlErrorColumn) // 4. Replacement text
);
Confirmation
Confirmation message with No button as default button
if (SysMsg:Msg.Confirm(
  'Delete file', // Title
  'Should the file “\1” really be deleted?\n' +
  '\n' +
  'Typ\t\t: \2\n' +
  'Size\t\t: \3\n' +
  'Modification date\t: \4', // Text
  _Msg.Escape | _Msg.TextAlignLeft | _Msg.ButtonDefault2 | _Msg.Closable, // Options
  0, // Übergeordnetes Fenster
  'MyFile.txt', // 1. Replacement text
  'XML-Dokument', // 2. Replacement text
  '23,11 KB', // 3. Replacement text
  'Mo., 3. Feb. 2014, 15:46 Uhr' // 4. Replacement text
// Ja
) = _Msg.IDYes)
{
  // ...
}
Query
Query message with invalid input
if (SysMsg:Msg.PromptAlpha(
  var tName, // Value
  'Rename directory', // Title
  'Name:', // Text
  0, // Parent window
  0, // Options
  '', '', '', '', '', '', '', '', // Replacement texts
  __PROC__ + ':PromptValidate' // Validation function
// OK
) = _Msg.IDOK)
{
  // ...
}
Customized message
Customized message with list object and own button
// Configure message
SysMsg:Msg.Config(
  'Export directory', // Title
  'The “\1” directory could not be exported completely.\n' +
  'The following errors have occurred:', // Text
  _Msg.Escape | _Msg.IconError | _Msg.TextAlignLeft | _Msg.Resizable | _Msg.ButtonsNone, // Options
  0, // Parent window
  'MyDir' // 1. Replacement text
);
// Generate button
tWinButton # SysMsg:Msg.ButtonCreate('I like this!', _Msg.IDOK);

tWinButton->wpDefault # true;
tWinButton->WinFocusSet();
// Change text arrangement
SysMsg:Msg.TextAlignGroupingSet(_WinAlignGroupingTop);
// Increase minimum height
SysMsg:Msg.HeightMinSet(120, true);

tWinDataList # WinCreate(_WinTypeDataList);
tWinDataList->wpTabStop # false;

tWinDataList->wpAlignMarginTop # 8;

tWinColumn # WinCreate(_WinTypeListColumn, '', 'Datei', tWinDataList);
tWinColumn->wpClmWidth # 120;
tWinColumn # WinCreate(_WinTypeListColumn, '', 'Fehler', tWinDataList);
tWinColumn->wpClmStretch # true;

tWinDataList->WinLstDatLineAdd('MyFile.xml');
tWinDataList->WinLstCellSet('File already exists and is locked.', 2);

// ...

// Add object
SysMsg:Msg.ObjectAdd(tWinDataList);
// Display message
SysMsg:Msg.Run();

tWinDataList->WinDestroy();

Conclusion

With this module, you can design message windows according to your needs. The spacing and colors can also be individually defined in the source code. You are welcome to try out the module and give us feedback here =).

Note: Version 5.7.07 of the conzept 16 client is required to run the module correctly.

Download

Zum downloaden hier klicken SysMsg.zip (65.03 KB)
Sie müssen angemeldet sein, um die Datei herunterladen zu können.

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

[cleverreach_signup]
WordPress Cookie Notice by Real Cookie Banner