Set up category hierarchy in a custom form

Hi

I am creating a form with sales orders and would like to use the built in category hierarchy (this ) in to be able to sort out the sales orders according to categories. How can I do that?