Application.MessageBox cancel button problem

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36153
    Chris
    Participant

    I am running version 8.53 on Delphi 2010.

    Here is how to see the problem that I am having with Application.MessageBox:

    Create a new unskinned project and add this to a button event:

    i := Application.MessageBox('Do you want to answer this question?',

    'My Message Title', MB_YESNO + MB_ICONQUESTION);

    if i = IDYES then

    ShowMessage('Yes')

    else

    ShowMessage('No');

    Run it, click the button and instead of clicking either the Yes or No button, click the cancel button (the X) at the upper right corner of the dialog windows. Nothing happens because it is disabled (and it appears disabled). This is correct behavior.

    Now alphaskin the project, and try again. The X doesn't do anything, but it is not completely disabled. I see animation happening when I click on it, which will confuse my customers. They will think something is wrong.

    Can the dialog's cancel button be set to disabled in this situation?

    Thanks!

    -Chris

    #51972
    Support
    Keymaster

    Hello

    Style of this windows has not information about the Close button status.

    It's a reason why we don't know when button is disabled. I has no idea how to solve it at the moment, unfortunately.

    #51974
    CheshireCat
    Participant

    Hello Chris,

    there is a way to remove the button, maybe it will help you:

    Code:

    procedure TForm1.sButton1Click(Sender: TObject);
    var
    msgDialog: TForm;
    begin
    msgDialog := CreateMessageDialog('Replace this with the message to be displayed', mtInformation, [mbYes,mbNo]);
    try
    msgDialog.Caption := 'Title of the dialog';
    msgDialog.BorderIcons := []; // Message-Box have no title buttons
    msgDialog.ShowModal;
    finally
    msgDialog.Hide;
    msgDialog.Free;
    end;
    end;

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