How to create a custom button which displays a dialog?

In this example, first we get the location of Italic button. Then we add a custom dialog after it.