- This topic has 3 replies, 2 voices, and was last updated 8 years, 6 months ago by Support.
-
AuthorPosts
-
May 14, 2016 at 4:20 pm #36966HeDiBoParticipant
The sMessageDlg function does not show the buttons it should.
In this project [attachment=7704:acTestDialog.zip] the test for Dialog1 should show a Cancel button (it shows OK) and Dialog2 should show an Abort button (it actually shows three buttons :a1:
May 23, 2016 at 6:43 am #55020SupportKeymasterHello, Dick!
This behaviour exists becase sMessageDlg is based on Windows API MessageBox function.
But MessageBox function has only these combinations of buttons:
Code:MB_ABORTRETRYIGNORE – The message box contains three push buttons: Abort, Retry, and Ignore.
MB_CANCELTRYCONTINUE – The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
MB_HELP – Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
MB_OK – The message box contains one push button: OK. This is the default.
MB_OKCANCEL – The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL – The message box contains two push buttons: Retry and Cancel.
MB_YESNO – The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL – The message box contains three push buttons: Yes, No, and Cancel.MessageBox used in the AlphaControls package, because this dialog box has automatically translated buttons and captions.
You can use the Delphi VCL MessageDlg dialog still, this dialog has correct buttons, but not translated automatically to the system language.
May 23, 2016 at 11:45 am #55037HeDiBoParticipantI understand.
But accepting parameters that cannot be handled properly, may be not a good idea.
In the meantime, I made my own message routine: [attachment=7708:Message.zip]
The function Cardinality used goes like this:
Code:function Cardinality(var Tar; Size: Integer): Integer;const // nibble table
// Number of bits for values:0 1 2 3 4 5 6 7 8 9 A B C D E F
Ca: array[0..15] of Integer=(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);
var
ab: TByteArray absolute Tar;
j: integer;
begin// Returns the number of bits set in the Size bytes starting from Tar.
Result := 0;
for j := 0 to Size – 1 do begin
Inc( Result, Ca[ab[j] and $0F] + Ca[ab[j] shr 4]);
end;
end;Hope it is usable.
May 24, 2016 at 4:06 pm #55042SupportKeymasterThanks for files, I will check them.
Main feature of the sMessageDlg is automatic using of the current system language.
Otherwise, Delphi MessageDlg may be used.
-
AuthorPosts
- You must be logged in to reply to this topic.