You must of course be modern and code for the AmigaOS 3.9 API, not 3.1! What is the point of an advanced operating system such as OS3.9 if nothing is written to take advantage of it!?
I have done some example programs to help beginners; they are dev/src/GadgetExample.lha (demonstrates OS1.x, OS2.x, and OS3.5+ buttons) and dev/src/TextEditorExample.lha (demonstrates ReAction text editor gadget). There are also other good resources on Aminet which will be of assistance to you, and of course the ADCD2.1 is a must. I have made a superior front end: docs/hyper/Companion.lha.