Link to home
Start Free TrialLog in
Avatar of max-hb
max-hbFlag for Germany

asked on

messagedlg question

Hi there!
Something's wrong with the result of the messagedlg() function?

messagedlg('Text',mtConfirmation,[mbYes,mbNo],0)

gives me an integer result of 3 when pressing "Yes" in the dialog at runtime.
This should correspond to the constat "mrYes", but this has an integer value of 6 so

if (messagedlg('text',mtconfirmation,[mbyes,mbno,0)=mryes)
 then // Yes clicked

does not work properly.

Any ideas?

Avatar of max-hb
max-hb
Flag of Germany image

ASKER

In qcontrols.pas i found the following definition:
Const
  mrNone     = 0;
  mrOk       = mrNone + 1;
  mrCancel   = mrOk + 1;  
  mrYes      = mrCancel + 1;

... but still inttostr(mrYes)="6" ... strange
ASKER CERTIFIED SOLUTION
Avatar of robert_marquardt
robert_marquardt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jellison
jellison

In my source files:  (Delphi 3)

In Controls.pas

mrYes = idYes;

and in Windows.pas

IDYES = 6;

Which might explain why you get a 6.  Which version are you using?

John
Avatar of max-hb

ASKER

Yes, that's it!
Never do something like

uses controls,qdialogs;

It results in the problem I stated above.