Aug 182018
 

Based on an idea and partial implementation submitted by Sven Harazim from Landrix Software I have just added support for GNUGetText to the GExperts Message Dialog expert. It now looks like this:

And generates Code like this:

MessageDlg(_('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);

Or, if you’d rather use the Windows API:

which generates code like this:

MessageBox(0, PChar(_('first line'+#13#10+'second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);

There are even two new configuration options:

Depending on the settings the code could look like any of this:

MessageDlg(_('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);
MessageDlg(GetText('first line'+#13#10+'second line'), mtWarning, [mbOK], 0);
MessageDlg(_('first line')+#13#10+_('second line'), mtWarning, [mbOK], 0);
MessageDlg(GetText('first line')+#13#10+GetText('second line'), mtWarning, [mbOK], 0);

or this:

MessageBox(0, PChar(GetText('first line')+#13#10+GetText('second line')), PChar(GetText('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(_('first line')+#13#10+_('second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(_('first line'+#13#10+'second line')), PChar(_('The Caption')), MB_ICONWARNING or MB_OK);
MessageBox(0, PChar(GetText('first line'+#13#10+'second line')), PChar(GetText('The Caption')), MB_ICONWARNING or MB_OK);

It also generates code for C++, but I have no idea whether it works:

MessageDlg(GetText("first line\nsecond line"), mtWarning, TMsgDlgButtons() << mbOK, 0);
MessageBox(0, GetText("first line\nsecond line"), GetText("The Caption"), MB_ICONWARNING|MB_OK);

I hope it will be useful for some. I myself don't use that expert at all.

There is no release with this feature yet. If you want to use it, you will have to compile your own DLL.

 Posted by on 2018-08-18 at 16:52