Announcement

Collapse
No announcement yet.

Confusion about %BS_DEFAULT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Confusion about %BS_DEFAULT

    Fellows,
    I'm becoming rather confused about the %BS_DEFAULT / %BS_DEFPUSHBUTTON issue. This is what the PBDLL help file says:
    "%BS_DEFAULT - Creates a button with a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option. You can only have one Default button per dialog."
    Unfortunately, the heavy black border only appears when the button has the %IDOK identifier. Any other value does not create a button with a black border, despite the %BS_DEFAULT style.
    Now my problem: I want to create a dialog with, say, 3 buttons, Yes, No and Cancel. 'No' is the most likely option here, so this one should show up with the black border. To assign this genuine default look to it, I have to give it the %IDOK identifier. No problem, so far but when the user activates the button it returns 1, while my CALLBACK FUNCTION expects 7 (= %IDNO).
    Has anybody struggled with this thing? And, if so, what is the most reliable trick to achieve both, a good looking button and the correct return value as well??

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

  • #2
    Ummm..

    If you are assigning %IDOK to the NO button in order to
    get the %BS_DEFAULT style, shouldn't your callback be expecting
    %IDOK as a the control ID for that button?

    ------------------
    Bernard Ertl

    [This message has been edited by Bern Ertl (edited March 19, 2001).]
    Bernard Ertl
    InterPlan Systems

    Comment


    • #3
      Bern,
      No. I want to write a generic set of MsgBox functions where OK = OK and NO = NO. In other words, the NO button must always return %IDNO, not %IDOK.

      In the meantime I solved the problem. This matter was discussed before here, but initially I did a wrong search for it.
      It appears not to be possible to set a default button (other than OK) while adding the control to the dialog. But once the control is set, you can launch the following message, in order to achieve what you want:
      Code:
      CONTROL SEND hDlg, BtnID, %BM_SETSTYLE, %BS_DEFPUSHBUTTON, %TRUE
      CONTROL SET FOCUS hDlg, BtnID
      Lance posted this solution earlier in this forum. Thanks Lance!


      ------------------
      mailto:[email protected][email protected]</A>
      www.basicguru.com/zijlema/

      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
      http://zijlema.basicguru.eu
      *** Opinions expressed here are not necessarily untrue ***

      Comment

      Working...
      X