sMessageDlg show wrong button(s)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36966
    HeDiBo
    Participant

    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:

    #55020
    Support
    Keymaster

    Hello, 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.

    #55037
    HeDiBo
    Participant

    I 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.

    #55042
    Support
    Keymaster

    Thanks 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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.