Forum > General

Text in MessageDlg not displaying

(1/1)

Graham Saint:
I am running Lazarus 2.2.2 on Windows 11 64 bit. I'm fairly experienced with Delph but I've just started Lazarus.

I am attempting to display a dialog box thus :

procedure TfmMain.btQuitClick(Sender: TObject);
VAR
  button_selected : integer;
begin
  button_Selected := MessageDlg('Quit Awari?','Do you wish to quit Awari?',mtConfirmation, [mbYes, mbNo], 0);
  IF button_selected = mrYes THEN
     application.terminate;
end;     

but when the code runs the box displays with a heading "confirmation" and the text is also "Conformation"

(Screen shot attached)

Okay, I have solved it. I renamed the original main unit from 'unit1' to 'main' but forgot to changes the names in the USES clause of the main program. Oddly, this didn't cause any compile errors. Once I changed the USES clause the code now works as expected.

Handoko:
Hello Graham Saint,
Welcome to the forum.

I tested it on Lazarus 2.2.0 64-bit Ubuntu Mate 22.04, I could not reproduce the issue. Need someone using Lazarus 2.2.2 Win11 to test.

dseligo:
I don't have Lazarus 2.2.2 yet, but I tested on 2.2.0 and on Windows 11.
It all looks OK.

I attached screenshot and test project. You can try my project to see if there is something with your Lazarus installation or with your project.

Graham Saint:
Okay, I have solved it. I renamed the original main unit from 'unit1' to 'main' but forgot to change the name in the USES clause of the main program. Oddly, this didn't cause any compile errors. Once I changed the USES clause the code now works as expected.

I found this only because further testing showed that widgets I was adding to the form weren't displaying when the form was executed.

I think the form was displaying a previous version of the dialog box which had generic messages.

Thank you for investigating.

Navigation

[0] Message Index

Go to full version