On 12/09/12 15:16, Graeme Geldenhuys wrote:

Now what return result is TWidgetSet.PromptUser() supposed to return?


OK, from the LCL API help it says MessageDlg returns the button the user pressed - expressed as an integer.

   http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/messagedlg.html

wouldn't it also be better to define .PromptUser()'s return type as a TMsgDlgBtn type? Thus removing any possible confusion.


NOTE:
The help doesn't seem to make sense in reality - or maybe I'm just not understanding LCL workings very well (quite possible).

Button enums are defined as follows...

TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
                    mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose);


I wrote code as follows...

Result := MessageDlg('My caption','error dialog with custom buttons', mtError, [mbOK, mbYesToAll, mbAbort, mbHelp], '');
  Writeln('Result = ', Result);


At runtime I click on the "Abort" button and the console output is 3 ???? I'm using LCL-GTK2.

So what is 3? It's not the enum value of mbAbort, it is also not the set value of mbAbort in the button set I passed to MessageDlg(). Sets start from value zero correct? So where does the value 3 come from?



Regards,
  - Graeme -




--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to