I have created a menu utilizing a database table to create the appropriate nodes in a TreeView control. What I am wishing to do is instantiate an existing form based on a node click.
I have the package information for each form attached to my node. For example:
I click on Order node in the tree I receive "com.entities.OrderForm" as a character string.
Can I instantiate the appropriate object from this or do I need more?
My first thought was that I could define and instantiate a generic Progress.Windows.Form and cast it but I am obviously not on the right track here.
Any suggestions would be greatly appreciated.
Did you look at the DYNAMIC-NEW() statement?
If you have a variable of type Progress.Windows.Form (and com.entities.OrderForm inherits from it) you should be able to instantiate the form into it.
DEF VAR currentForm AS Progress.Windows.Form NO-UNDO.
METHOD OnClick (INPUT theForm AS CHARACTER):
currentForm = DYNAMIC-NEW theForm ().
END METHOD.
If you use a multi-window configuration you will probably accumulate the forms in a temp-table with a field defined as type Progress.Lang.Object, if you need to track it at all.
This looks to be exactly what I needed. Not sure how I missed DYNAMIC-NEW in browsing for a solution.
Thanks a lot!