Forum > General
Problem with MessageBox
Raiden:
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: ---application.messagebox('Text','Title');
--- End code ---
doesn't produce any error, but in Lazarus I have that error message:
--- Code: ---Error: cannot access a private field of an object here
--- End code ---
I don't know how to avoid this error...could you help me?
Vincent Snijders:
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:
I tried that before
--- Code: ---application.messagebox('texto','title',MB_OK);
--- End code ---
and Lazarus says me:
--- Code: ---Error: identifier not found "MB_YES"
--- End code ---
I don't know why that works in Kylix but in Lazarus doesn't...
Raiden:
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:
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.
Navigation
[0] Message Index
[#] Next page