Announcement

Collapse
No announcement yet.

Confusion about %BS_DEFAULT

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

  • Egbert Zijlema
    replied
    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/

    Leave a comment:


  • Bern Ertl
    replied
    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).]

    Leave a comment:


  • Egbert Zijlema
    started a topic Confusion about %BS_DEFAULT

    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/
Working...
X