Discussion:
Form prompt to save data when activated
(too old to reply)
Hii Sing Chung
2008-10-31 09:31:00 UTC
Permalink
Hi,

When I compiled an W32 .exe file for the little program I used a form,
whenever I run this program (when the form execute), it asked "data has been
changed. would you like to save changes?". It has got Yes, No and Cancel
buttons. If I click on Yes or No, it will just exist. If I click on Cancel,
it will prompt the dialog again 3 more times, then only the form started to
run. After that, if I maximize or restore the form, it prompt the same thing
again, and if I click the runnning the first time, it also will prompt the
same thing (2 times). Anyone can figure out where this behaviour is being
controlled? Also, if I exit the program (the form), it also will ask the
same thing.

Help required.
Stefan Wuebbe
2008-10-31 20:31:07 UTC
Permalink
Hi,
When I compiled an W32 .exe file for the little program I used a form, whenever I run
this program (when the form execute), it asked "data has been changed. would you like to
save changes?". It has got Yes, No and Cancel buttons. If I click on Yes or No, it will
just exist. If I click on Cancel, it will prompt the dialog again 3 more times, then
only the form started to run. After that, if I maximize or restore the form, it prompt
the same thing again, and if I click the runnning the first time, it also will prompt
the same thing (2 times). Anyone can figure out where this behaviour is being
controlled? Also, if I exit the program (the form), it also will ask the same thing.
Help required.
That sounds as if you are using Wizard forms - that is, there are some
parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might cause
the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch in
the debugger.


hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Hii Sing Chung
2008-11-01 05:06:07 UTC
Permalink
Stefan,

The 'View Parent Code' is greyed-out for the form. In the Activate event of
the form, I have these codes:

IF EMPTY(thisform.txtpinvoice_n.value)
thisform.cmdadditem.Enabled=.f.
thisform.cmdedititem.Enabled=.f.
thisform.cmdremoveItem.Enabled=.f.
ELSE
thisform.cmdadditem.enabled=.t.
thisform.cmdedititem.enabled=.t.
thisform.cmdremoveItem.Enabled=.t.
ENDIF

Do they cause the unexpected behaviour?
Post by Stefan Wuebbe
Post by Hii Sing Chung
Hi,
When I compiled an W32 .exe file for the little program I used a form,
whenever I run this program (when the form execute), it asked "data has
been changed. would you like to save changes?". It has got Yes, No and
Cancel buttons. If I click on Yes or No, it will just exist. If I click
on Cancel, it will prompt the dialog again 3 more times, then only the
form started to run. After that, if I maximize or restore the form, it
prompt the same thing again, and if I click the runnning the first time,
it also will prompt the same thing (2 times). Anyone can figure out where
this behaviour is being controlled? Also, if I exit the program (the
form), it also will ask the same thing.
Help required.
That sounds as if you are using Wizard forms - that is, there are some
parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might cause
the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch in
the debugger.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2008-11-01 21:40:02 UTC
Permalink
Fred's answer to your next question about the missing Read Events
might also solve the issue youz described in this thread - because now,
when the form runs and gets closed immediately because you have no
Read Events yet, its QueryUnload() would run (as expected).

On the other hand, that messagebox should occur only when there are
uncommitted "dirty" data - do you unintentionally Replace any field
content during form.Init() or so?


hth
-Stefan
Post by Hii Sing Chung
Stefan,
The 'View Parent Code' is greyed-out for the form. In the Activate event of the form, I
IF EMPTY(thisform.txtpinvoice_n.value)
thisform.cmdadditem.Enabled=.f.
thisform.cmdedititem.Enabled=.f.
thisform.cmdremoveItem.Enabled=.f.
ELSE
thisform.cmdadditem.enabled=.t.
thisform.cmdedititem.enabled=.t.
thisform.cmdremoveItem.Enabled=.t.
ENDIF
Do they cause the unexpected behaviour?
Post by Stefan Wuebbe
Hi,
When I compiled an W32 .exe file for the little program I used a form, whenever I run
this program (when the form execute), it asked "data has been changed. would you like
to save changes?". It has got Yes, No and Cancel buttons. If I click on Yes or No, it
will just exist. If I click on Cancel, it will prompt the dialog again 3 more times,
then only the form started to run. After that, if I maximize or restore the form, it
prompt the same thing again, and if I click the runnning the first time, it also will
prompt the same thing (2 times). Anyone can figure out where this behaviour is being
controlled? Also, if I exit the program (the form), it also will ask the same thing.
Help required.
That sounds as if you are using Wizard forms - that is, there are some
parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might cause
the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch in
the debugger.
hth
-Stefan
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Dan Freeman
2008-11-02 01:18:07 UTC
Permalink
Doesn't one configuration of the Wizforms APPEND BLANK if the table is empty
on startup? (Honestly, I haven't looked since the early 90's!)

That would explain the startup/shutdown messagebox().

Dan
Post by Stefan Wuebbe
Fred's answer to your next question about the missing Read Events
might also solve the issue youz described in this thread - because
now, when the form runs and gets closed immediately because you have
no Read Events yet, its QueryUnload() would run (as expected).
On the other hand, that messagebox should occur only when there are
uncommitted "dirty" data - do you unintentionally Replace any field
content during form.Init() or so?
hth
-Stefan
Post by Hii Sing Chung
Stefan,
The 'View Parent Code' is greyed-out for the form. In the Activate
IF EMPTY(thisform.txtpinvoice_n.value)
thisform.cmdadditem.Enabled=.f.
thisform.cmdedititem.Enabled=.f.
thisform.cmdremoveItem.Enabled=.f.
ELSE
thisform.cmdadditem.enabled=.t.
thisform.cmdedititem.enabled=.t.
thisform.cmdremoveItem.Enabled=.t.
ENDIF
Do they cause the unexpected behaviour?
Post by Stefan Wuebbe
Post by Hii Sing Chung
Hi,
When I compiled an W32 .exe file for the little program I used a
form, whenever I run this program (when the form execute), it
asked "data has been changed. would you like to save changes?". It
has got Yes, No and Cancel buttons. If I click on Yes or No, it
will just exist. If I click on Cancel, it will prompt the dialog
again 3 more times, then only the form started to run. After that,
if I maximize or restore the form, it prompt the same thing again,
and if I click the runnning the first time, it also will prompt
the same thing (2 times). Anyone can figure out where this
behaviour is being controlled? Also, if I exit the program (the
form), it also will ask the same thing. Help required.
That sounds as if you are using Wizard forms - that is, there are
some parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might
cause the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch
in the debugger.
hth
-Stefan
--
Post by Hii Sing Chung
\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Hii Sing Chung
2008-11-02 02:21:25 UTC
Permalink
Dan, Stefan,

Thanks for pointing out all the possibilities. Well, I am not so expert as
to code in those Events yet, not so complicated, it is a simple project. I
tested doing manually compilation to exe file, the prompt to save no longer
appear, in fact, the program just close as soon as it is opened (maybe
haven't even opened yet). So, to be able to come out with a running
application, I used the wizard to create a project, just put in this simple
form, and yes, after compiled, it can run (no the prompt to save either).
However, I found that the wizard created path specific dbf file (should be
one that is required to load the program). So this means the compile program
cannot be run on another computer (because the dbf files, e.g.,
performainvoice_app.dbf is resizing on the local computer where it was
compiled). I did a copy of the performa_app.dbf to a DFS-R path on the
server and inside the project manager, i added this dbf free tables. After
that the performainvoice_app deleted by itself, then I could no longer
compile the program. So, it seems to me if you use the wizard to create
project and compile it as it, it cannot be run on another computer. When I
opened up the performainvoice_app program from the project mananger, I
looked through the codes, there isn't any reference for the
performainvoice_app.dbf file. What is the best way to go about doing it?
Post by Dan Freeman
Doesn't one configuration of the Wizforms APPEND BLANK if the table is
empty on startup? (Honestly, I haven't looked since the early 90's!)
That would explain the startup/shutdown messagebox().
Dan
Post by Stefan Wuebbe
Fred's answer to your next question about the missing Read Events
might also solve the issue youz described in this thread - because
now, when the form runs and gets closed immediately because you have
no Read Events yet, its QueryUnload() would run (as expected).
On the other hand, that messagebox should occur only when there are
uncommitted "dirty" data - do you unintentionally Replace any field
content during form.Init() or so?
hth
-Stefan
Post by Hii Sing Chung
Stefan,
The 'View Parent Code' is greyed-out for the form. In the Activate
IF EMPTY(thisform.txtpinvoice_n.value)
thisform.cmdadditem.Enabled=.f.
thisform.cmdedititem.Enabled=.f.
thisform.cmdremoveItem.Enabled=.f.
ELSE
thisform.cmdadditem.enabled=.t.
thisform.cmdedititem.enabled=.t.
thisform.cmdremoveItem.Enabled=.t.
ENDIF
Do they cause the unexpected behaviour?
Post by Stefan Wuebbe
Post by Hii Sing Chung
Hi,
When I compiled an W32 .exe file for the little program I used a
form, whenever I run this program (when the form execute), it
asked "data has been changed. would you like to save changes?". It
has got Yes, No and Cancel buttons. If I click on Yes or No, it
will just exist. If I click on Cancel, it will prompt the dialog
again 3 more times, then only the form started to run. After that,
if I maximize or restore the form, it prompt the same thing again,
and if I click the runnning the first time, it also will prompt
the same thing (2 times). Anyone can figure out where this
behaviour is being controlled? Also, if I exit the program (the
form), it also will ask the same thing. Help required.
That sounds as if you are using Wizard forms - that is, there are
some parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might
cause the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch
in the debugger.
hth
-Stefan
--
Post by Hii Sing Chung
\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2008-11-02 09:47:32 UTC
Permalink
That sounds like a Path issue. In a short test, the "Application Wizard"
created a "config.fpw" file. That's good: you can edit it and add a
new line:
Path = x:\somepath\yourdatafolder

That config.fpw file is by default marked as "excluded" in the Project
Manager. That's good, too: you can "ship" it separately and edit it
locally to modify the path from the client PC's point of view, if
necessary. (UNC notation for network shares works better than
mapped drives).

However, the traditional standard recommendation for that
"application wizard" is: Better do not use it for real projects.


hth
-Stefan
Post by Hii Sing Chung
Dan, Stefan,
Thanks for pointing out all the possibilities. Well, I am not so expert as to code in
those Events yet, not so complicated, it is a simple project. I tested doing manually
compilation to exe file, the prompt to save no longer appear, in fact, the program just
close as soon as it is opened (maybe haven't even opened yet). So, to be able to come
out with a running application, I used the wizard to create a project, just put in this
simple form, and yes, after compiled, it can run (no the prompt to save either).
However, I found that the wizard created path specific dbf file (should be one that is
required to load the program). So this means the compile program cannot be run on
another computer (because the dbf files, e.g., performainvoice_app.dbf is resizing on
the local computer where it was compiled). I did a copy of the performa_app.dbf to a
DFS-R path on the server and inside the project manager, i added this dbf free tables.
After that the performainvoice_app deleted by itself, then I could no longer compile the
program. So, it seems to me if you use the wizard to create project and compile it as
it, it cannot be run on another computer. When I opened up the performainvoice_app
program from the project mananger, I looked through the codes, there isn't any reference
for the performainvoice_app.dbf file. What is the best way to go about doing it?
Doesn't one configuration of the Wizforms APPEND BLANK if the table is empty on
startup? (Honestly, I haven't looked since the early 90's!)
That would explain the startup/shutdown messagebox().
Dan
Post by Stefan Wuebbe
Fred's answer to your next question about the missing Read Events
might also solve the issue youz described in this thread - because
now, when the form runs and gets closed immediately because you have
no Read Events yet, its QueryUnload() would run (as expected).
On the other hand, that messagebox should occur only when there are
uncommitted "dirty" data - do you unintentionally Replace any field
content during form.Init() or so?
hth
-Stefan
Post by Hii Sing Chung
Stefan,
The 'View Parent Code' is greyed-out for the form. In the Activate
IF EMPTY(thisform.txtpinvoice_n.value)
thisform.cmdadditem.Enabled=.f.
thisform.cmdedititem.Enabled=.f.
thisform.cmdremoveItem.Enabled=.f.
ELSE
thisform.cmdadditem.enabled=.t.
thisform.cmdedititem.enabled=.t.
thisform.cmdremoveItem.Enabled=.t.
ENDIF
Do they cause the unexpected behaviour?
Post by Stefan Wuebbe
Post by Hii Sing Chung
Hi,
When I compiled an W32 .exe file for the little program I used a
form, whenever I run this program (when the form execute), it
asked "data has been changed. would you like to save changes?". It
has got Yes, No and Cancel buttons. If I click on Yes or No, it
will just exist. If I click on Cancel, it will prompt the dialog
again 3 more times, then only the form started to run. After that,
if I maximize or restore the form, it prompt the same thing again,
and if I click the runnning the first time, it also will prompt
the same thing (2 times). Anyone can figure out where this
behaviour is being controlled? Also, if I exit the program (the
form), it also will ask the same thing. Help required.
That sounds as if you are using Wizard forms - that is, there are
some parent class methods involved in wizardForm.QueryUnload() - but
those did not use to run when the form starts when I looked at them
last time, so your description sounds as if your own code might
cause the behavior you described.
You can however inspect the parent class code via "View Parent Code"
button in the Form Designer's code editor window, or open the parent
classes directly, or Set Step On in those methods you want to watch
in the debugger.
hth
-Stefan
--
Post by Hii Sing Chung
\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
Stefan Wuebbe
2008-11-02 09:53:38 UTC
Permalink
Doesn't one configuration of the Wizforms APPEND BLANK if the table is empty on startup?
(Honestly, I haven't looked since the early 90's!)
Same here <s>
That would explain the startup/shutdown messagebox().
Good idea!, "Code References" finds an "Append Blank" in a method
"_application.SeekDefaultUser()" in _framework.vcx in an application
wizard test.PJX.


-Stefan

Continue reading on narkive:
Loading...