Why isn’t InputQuery returning bool?


I’ve followed the clear documentation to implement an input dialog box. It works fine. But, now i want to ignore the user input if they click cancel. Below is quote from that documentation.

“If the user clicks the OK button, InputQuery returns True; InputQuery returns False otherwise.”

So, i tried the following code and the error i’m getting is E2034 Cannot convert void to bool when i run on Win32 and bccaarm error 1711 value of type void is not contextually convertible to bool on Android.

if (InputQuery(caption, Prompts, sizeof(Prompts)/sizeof(Prompts[0]) – 1, Defaults, sizeof(Defaults)/sizeof(Defaults[0]) – 1, (TInputCloseQueryProc *)Met)){
// clicked OK
} else {
// clicked cancel

How can i test if OK or Cancel clicked? Below is the declaration for InputQuery and it should be bool. I’m confused.

extern DELPHI_PACKAGE bool __fastcall InputQuery _DEPRECATED_ATTRIBUTE1(“Use FMX.DialogService methods”) (const System::UnicodeString ACaption, const System::UnicodeString *APrompts, const int APrompts_High, System::UnicodeString *AValues, const int AValues_High, const _di_TInputCloseQueryFunc ACloseQueryFunc = _di_TInputCloseQueryFunc())/* overload */;

Comments are closed.