Recent

Author Topic: Text in MessageDlg not displaying  (Read 435 times)

Graham Saint

  • New Member
  • *
  • Posts: 13
Text in MessageDlg not displaying
« on: May 20, 2022, 12:29:13 pm »
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.

« Last Edit: May 20, 2022, 01:17:15 pm by Graham Saint »

Handoko

  • Hero Member
  • *****
  • Posts: 5153
  • My goal: build my own game engine using Lazarus
Re: Text in MessageDlg not displaying
« Reply #1 on: May 20, 2022, 12:37:13 pm »
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

  • Hero Member
  • *****
  • Posts: 1220
Re: Text in MessageDlg not displaying
« Reply #2 on: May 20, 2022, 12:50:14 pm »
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

  • New Member
  • *
  • Posts: 13
Re: Text in MessageDlg not displaying
« Reply #3 on: May 20, 2022, 01:21:36 pm »
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.

 

TinyPortal © 2005-2018