Peter Kohler ( peter.kohler@pixie.co.za ) found what causes the "Cannot create dialog box" and fixed it!
With the help of a utility program called DBWIN, Peter has found the solution for the "Cannot create dialog" error. The problem was caused by a browse class of his own that inherits from the standard TWBrowse class, and then subsequently using both classes in the app.
Using a utility called DBWIN.EXE, he noticed his app was generating a "Class not found" error when the problem occurred. Subsequent research revealed that every Gui control has to registered with Windows by the app that first uses it in your current Windows session. If you do not register your controls, Windows will report a "Class not found" error when it tries to create that control, which will cause the dialog to fail with a "Cannot create dialog" error.
In Fivewin, registration of controls with windows, is controlled via the ::lRegistered class var found in each control class. The first time a control is used in FW, that control is registered with Windows (if not already registered by another app) and ::lRegistered is set to .t. and is ignored for subsequent uses of the control.
Thus, in FW, all Gui Control classes require their own ::lRegistered class var to control the registration of the control with Windows. If you inherit from another control, you MUST add a ::lRegistered class var to your inherited control, else it will share the parents ::lRegistered class var. If you then use both the parent control and the child control in your app, only one will be registered with windows (the first one used), as ::lRegistered is set to .t. once only and then ignored. You will then encounter a "Class not found" error when you try create the control, which will result in a general "Cannot create dialog" error by Fivewin.
His struggle would have been substantially reduced if he had seen the "Class not found" error immediately, instead of Fivewin's general "Cannot create dialog" error which did not give me enough information about why the dialog could not be created.
DBWIN.EXE gave him a much better error message (Class not found), and allowed him to find the real cause of the problem. I suggest ALL fivewin users run this in the background of there apps to check for any errors you may not be aware of / to assist with debugging.
Download DBWin.zip - Download DBWin32.zip (Includes source and help)