What does the “|” in “int style = SWT.APPLICATION_MODAL | SWT.OK;” do (and how to Google it)?

前端 未结 7 828
囚心锁ツ
囚心锁ツ 2021-01-12 23:14

I can\'t search for | in Google. If you had found it in a software source code that you are trying to interpret, you didn\'t know what it does and you couldn\'t ask other pe

7条回答
  •  感动是毒
    2021-01-12 23:39

    It is a bitwise OR, it provides a means for you to pass a number of flags to the SWT component as a single int, rather than having to overload the type with loads of setter methods.

    The two properties you list indicate you have a dialog or other window that should be displayed modally over the parent shell, and use the ok button. You could combine it with SWT.CANCEL to display an OK and Cancel button for instance

提交回复
热议问题