Recent

Author Topic: QuestionDlg does strange things?  (Read 437 times)

SA.Blackmon

  • Jr. Member
  • **
  • Posts: 50
  • Just an old retired guy practicing what he enjoys.
QuestionDlg does strange things?
« on: February 14, 2026, 09:59:45 pm »
I'm using QuestionDlg and the responses are wonky as well as the button captions, if I don't provide them.
As you can see from the testQuestionDlg.doc attachment, the buttons have no relation to the code that created them. If I do not provide the caption for the first button, mbYes, I get an error that says there is no caption but I have used the dialog before and the default captions worked fine.

I have zipped up the small app I wrote to test the responses.

Thanks for your help,
Sherril :(
Thank you for your help,
Sherril

Bart

  • Hero Member
  • *****
  • Posts: 5701
    • Bart en Mariska's Webstek
Re: QuestionDlg does strange things?
« Reply #1 on: February 14, 2026, 11:56:06 pm »
I think tyou are supposed to have ModalResults, not TMsgDlgBtn in the Buttons array.
Code: Pascal  [Select][+][-]
  1.   aResp := QuestionDlg('information', 'test response', mtInformation,
  2.   [mrYes,  'Yes', mrNo, mrCancel, mrAbort], -1);
  3.  

That should work.
Notice that the ordinal value of mbYes = 0, which turns out to be the same value as mrNone...

Bart

SA.Blackmon

  • Jr. Member
  • **
  • Posts: 50
  • Just an old retired guy practicing what he enjoys.
Re: QuestionDlg does strange things?
« Reply #2 on: February 15, 2026, 12:01:44 am »
That was dumb. Thank you, Bart.
Thank you for your help,
Sherril

SA.Blackmon

  • Jr. Member
  • **
  • Posts: 50
  • Just an old retired guy practicing what he enjoys.
Re: QuestionDlg does strange things?
« Reply #3 on: February 15, 2026, 12:07:46 am »
Bart, I just looked again and I do have the buttons there:

 aResp := QuestionDlg('information', 'test response', mtInformation,
  [mbYes,  'Yes', mbNo, mbCancel, mbAbort], -1);
  //[mbYes, 'Yes', 'IsDefault', mbNo, 'no', mbCancel, 'cancel', mbAbort], -1);

So, I'm still stuck with the same issues.
Thank you for your help,
Sherril

wp

  • Hero Member
  • *****
  • Posts: 13396
Re: QuestionDlg does strange things?
« Reply #4 on: February 15, 2026, 12:55:35 am »
Bart, I just looked again and I do have the buttons there:

 aResp := QuestionDlg('information', 'test response', mtInformation,
  [mbYes,  'Yes', mbNo, mbCancel, mbAbort], -1);
  //[mbYes, 'Yes', 'IsDefault', mbNo, 'no', mbCancel, 'cancel', mbAbort], -1);

So, I'm still stuck with the same issues.
Bart told you to use the mrXXXX values, but you're still using mbXXXX...

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12170
  • Debugger - SynEdit - and more
    • wiki
Re: QuestionDlg does strange things?
« Reply #5 on: February 15, 2026, 01:16:29 am »
IIRC, you can either
- use ANY NUMERIC values, together with a string as name
- MR constants


The mb values, are IIRC enum, but that translates to ordinal, so they are numeric for the purpose here. So the code works, but without the strings the captions will not be what you want.

SA.Blackmon

  • Jr. Member
  • **
  • Posts: 50
  • Just an old retired guy practicing what he enjoys.
Re: QuestionDlg does strange things?
« Reply #6 on: February 15, 2026, 03:41:21 pm »
Thank you  :(for sticking with me.

What you were saying finally penetrated.

"QuestionDlg has the same functionality as MessageDlg
 except for the parameter Buttons which is of a different type." That per LHelp.

Ya think I don't always read instructions carefully; even when I've got a bunch of people trying to steer me in the right direction.

I am very grateful for you.
Thank you for your help,
Sherril

 

TinyPortal © 2005-2018