Recent

Author Topic: Problem with MessageBox  (Read 12859 times)

Raiden

  • Newbie
  • Posts: 5
Problem with MessageBox
« on: May 11, 2004, 04:30:17 pm »
Hi...

Firstly, I'm Spanish, so I can't write in English very well, but I try it  :wink: ...and a begginer with delphi.

I have been testing Kylix before Lazarus. With Kylix, that sintax:

Code: [Select]
application.messagebox('Text','Title');

doesn't produce any error, but in Lazarus I have that error message:

Code: [Select]
Error: cannot access a private field of an object here

I don't know how to avoid this error...could you help me?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Problem with MessageBox
« Reply #1 on: May 12, 2004, 08:29:47 am »
The error message is misleading (or wrong). You need to specify a third parameter called Flags. You can give it the value: MB_OK.

HTH,
Vincent.

Raiden

  • Newbie
  • Posts: 5
Problem with MessageBox
« Reply #2 on: May 13, 2004, 12:03:42 am »
I tried that before

Code: [Select]
application.messagebox('texto','title',MB_OK);

and Lazarus says me:

Code: [Select]
Error: identifier not found "MB_YES"

I don't know why that works in Kylix but in Lazarus doesn't...

Raiden

  • Newbie
  • Posts: 5
Problem with MessageBox
« Reply #3 on: May 13, 2004, 12:35:49 am »
I've founded the solution for my problem!

I don't know why, but I had an idea: put a number (1 for example) instead of MB_OK, and that works!!!

If you put 0, only appears the OK button
If you put 1, appear OK and Cancel button
If you put 2, appear OK, Cancel and... I don't remember  :roll:

Bye!!!

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Problem with MessageBox
« Reply #4 on: May 13, 2004, 09:36:50 am »
If is says identifier not found, then the unit in which MB_OK is declared, isn't in your uses clause. What I did is a Find in files in the lazarus\lcl directory. That way I found MB_OK is defined in lcltypes. So add lcltypes to your uses clause and use the constants, so you don't have to remember 0 is OK, etc.

Raiden

  • Newbie
  • Posts: 5
Problem with MessageBox
« Reply #5 on: May 13, 2004, 03:51:05 pm »
Perfect! That works  :lol:

I'm very grateful for your help Vincent  :roll:

See you!

 

TinyPortal © 2005-2018