Page 1 of 1

Cannot create dialog box

PostPosted: Mon Sep 25, 2006 1:03 pm
by Maurilio Viana
Hi!

I have a lot of pain of "fivewin/3 error" and I stay without it since I used Borland resources in FW/Clipper. But this time I couldn't run :) as follow:

I have a strange problem with a modal dialog using TxBrowse control.
I included a new dialog in my RC file and a dialog stop to open. The resource dialog name is "SELECIONA" and have a combobox, a get, a TxBrowse, OK and Cancel buttons.

I duplicate "SELECIONA" to "SELEC_PRINC" dialog (in same RC file), changed into my PRG and recompiled. I didn't changes into dialog, I only duplicated. It worked fine. Then I deleted SELECIONA (because SELEC_PRINC worked) and SELEC_PRINC stop to work!!!

I use FWH 2.7 March with xHB Builder March and I don't use any Borland style resource.

Any idea to solve or debug were is the problem?

Thanks a lot!
Maurilio

PostPosted: Mon Sep 25, 2006 3:54 pm
by Antonio Linares
Maurilio,

Please open the EXE with the resources workshop and check that the resources are properly placed inside.

PostPosted: Tue Sep 26, 2006 11:13 am
by Maurilio Viana
Antonio,

Yes, the resource is inside exe correctly.
When I add a dialog to resources it fail, if I add a blank dialog named SEL* (SEL_TEMP, SEL_XXX, etc) it work.

In all times when the dialog open OK and when occur Fivewin/3 error I checked and the dialog is inside exe. And I change nothing in code or dialog, only add or delete an empty dialog as I said...

I couldn't isolate the problem into a self contained prg :(

Best regards,
Maurilio

PostPosted: Tue Sep 26, 2006 11:25 am
by Antonio Linares
Maurilio,

We have found on some ocasions that the dialog name is not fine for Windows. Try to change it to a different name.

PostPosted: Tue Sep 26, 2006 11:32 am
by Maurilio Viana
Antonio,
I'll change the name and do any tests.
Any news I post here.

Thanks!

Maurilio

PostPosted: Wed Sep 27, 2006 4:34 pm
by Maurilio Viana
Antonio,

I renamed the resource and don't worked :(
If I add or delete a resource into rc file it work fine.
To avoid app exiting I place 'activate dialog' inside a try/end...

Do you have any naming rule that I can follow to avoid this type of error?

Regards,
Maurilio

PostPosted: Wed Sep 27, 2006 7:02 pm
by E. Bartzokas
Maurilio Viana wrote:Antonio,

I renamed the resource and don't worked :(
If I add or delete a resource into rc file it work fine.
To avoid app exiting I place 'activate dialog' inside a try/end...

Do you have any naming rule that I can follow to avoid this type of error?

Regards,
Maurilio


Hi Maurilio,
The subject issue is a pain in the butt indeed.
I have come into a serious straggling with FWH, dealing with the Error 3, cannot create dialog box, and here is how I finally managed to get it going...
1. The name of the resource, even if correct, does not always work,
although with Workshop there is no error.
2. The more important thing is to define these in the beginning of your MAIN prg file, because most of the time, dialogs cannot be created because their respective controls have not been registered. For example, if you use a TWBROWSE control in a dialog, it is almost sure that it will not work, unless you define each control:
Here's a copy of what I register in my main prg. Just below the local, private functions:
TWindow():Register()
TWBrowse():Register()
TBitmap():Register()
TFolder():Register()
TTabs():Register()
TDialog():Register()
TMeter():Register()
TMetafile():Register()
TComboBox():Register()

More about the resource name...
Unfortunatelly, there is no rule that I have come up with...
It seems that Windows does not "like" some names, although there is nothing wrong with the names, and most important, they worked fine in the 16-bit environment....
So, if a dialog I use (from resource, in the stand-alone exe file), does not work, the next thing I do is to add the letter "Z", or "Q" or something like that infront of the resource's name, and retry running the program.

Important: The same thing (with names) happens with other kinds of resource, especially with the bitmaps... Another pain in the butt...
You can try the same approach described above (add an extra character infront of the resource's name.

I hope that this helped you...
Kind regards
Evans

PostPosted: Wed Sep 27, 2006 7:35 pm
by Maurilio Viana
Evans,

Thanks for your words.
The only different thing into these my "deffective resource" is a txbrowse control.
Based on what you said I must do in my main program:

TxBrowse():Register()

Is this right?

Regards
Maurilio

PostPosted: Wed Sep 27, 2006 8:03 pm
by E. Bartzokas
Maurilio Viana wrote:Evans,

Thanks for your words.
The only different thing into these my "deffective resource" is a txbrowse control.
Based on what you said I must do in my main program:

TxBrowse():Register()

Is this right?

Regards
Maurilio


More or less YES.
I don't use TXBROWSE, however, you can try it, and in most cases you will have no problems with your dialogs using this control.

Kind regards
Evans