Hi everyone, im doing a little project, i designed a form using form designer.. is it possible to create an exe file out of it? If so, please teach me how… thanks in advance…
As Chris says, you need to add the form to a project.
The usual approach would be for the project to also contain a program (a PRG file), and for that program to launch the form. However, it is also possible for the project to contain the form and nothing else. In that case, set the form to "Main" (right-click on it within the project, and tick "Set Main"; the name of the form will turn bold). You can then buidl the project to create an EXE.
If you do that, be sure to make the form modal (set its WindowType to 1). Otherwise, the form will simply flash on the screen and then immediately disappear and terminate the program.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Edited:
I see only an unfortunate way how that works, Mike. With the _SCREEN visible.
Because the form has to be modal as you don't want a PRG that could have a READ EVENTS. The form can't be top level, or setting it modal does not work.
So you need to set the form to be in screen or in top level form and when you add a config with SCREEN=OFF or set _SCREEN.visible=.f. in your form code (load or init), then the form disappears.
I only see this working with another top level form or screen and since that's surely not what you want, you better have a main.prg as usual.
Okay, I figured out a way, but this is not what I'd ever recommend to do:
Form init:
Code:
_screen.visible=.f.
This.Show()
Read Events
Form queryunload:
Code:
Clear Events
And ShowWindow set to 2, which means as top level form.
Then this works without a PRG, but you never return from init, the whole time the form runs, an event hasn't finished. READ EVENTS allows any further events to happen, but it's not natural to do this. It doesn't feel good, as you have to actually call the Show() method, which is happening after init, usually, but not in a case you stop init from exiting by READ EVENTS.
As you have to use a top level form anyway, and that's never modal, I'd also just have a PRG that can initialize several things and then READ EVENTS. It's also much easier to extend.
Chris, you've made some good points, and I don't disagree with any of them. But I wouldn't want Mandy to be over-worried about top-level forms. If she just has a modal form in the project, and nothing else, then it should work fine. It's true that the outer VFP window will also be visible, but she hasn't said that she has a problem with that.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.