I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id
The Spaces listbox lost focus event calls the requiry event of the Units listbox to update the choices that appear in the Units list box
Each time the SQL executes the results show up in a query window on the screen.
How do I suppress the unwanted display? Should I use another technique?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Joe,
It's been a while for me, but I seem to recall having to use "into cursor xxx" to prevent the results from appearing.
Fletcher
------ Original Message ------
From "Joe Yoder" joe@wheypower.com
To profoxtech@leafe.com Date 4/23/2024 1:21:48 PM Subject List box issues
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id
The Spaces listbox lost focus event calls the requiry event of the Units listbox to update the choices that appear in the Units list box
Each time the SQL executes the results show up in a query window on the screen.
How do I suppress the unwanted display? Should I use another technique?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box to update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Should the code in the Lost Focus event actually be in the Interactive Change event?
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Tuesday, April 23, 2024 9:53 PM To: profoxtech@leafe.com Subject: Fwd: List box issues
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box to update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
Thanks Tracy - Interactive change works!
Is it by design that the refresh is only executed immediately from the Interactive vChange?
Thanks,
Joe
On Wed, Apr 24, 2024 at 10:00 AM Tracy Pearson tracy@powerchurch.com wrote:
Should the code in the Lost Focus event actually be in the Interactive Change event?
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Tuesday, April 23, 2024 9:53 PM To: profoxtech@leafe.com Subject: Fwd: List box issues
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box to update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
The Interactive Change event happens when the user makes a selection change via arrow keys or mouse click. The Lost Focus event happens when the user moves to another control.
Using the Interactive Change event to update other controls is better user experience.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, April 24, 2024 11:34 AM To: profoxtech@leafe.com Subject: Re: List box issues
Thanks Tracy - Interactive change works!
Is it by design that the refresh is only executed immediately from the Interactive vChange?
Thanks,
Joe
On Wed, Apr 24, 2024 at 10:00 AM Tracy Pearson tracy@powerchurch.com wrote:
Should the code in the Lost Focus event actually be in the Interactive Change event?
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Tuesday, April 23, 2024 9:53 PM To: profoxtech@leafe.com Subject: Fwd: List box issues
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box to update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
So can we conclude that immediate refresh of another control is probably not supported in any other event because Interactive Change is a better design choice?
On Wed, Apr 24, 2024 at 11:52 AM Tracy Pearson tracy@powerchurch.com wrote:
The Interactive Change event happens when the user makes a selection change via arrow keys or mouse click. The Lost Focus event happens when the user moves to another control.
Using the Interactive Change event to update other controls is better user experience.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, April 24, 2024 11:34 AM To: profoxtech@leafe.com Subject: Re: List box issues
Thanks Tracy - Interactive change works!
Is it by design that the refresh is only executed immediately from the Interactive vChange?
Thanks,
Joe
On Wed, Apr 24, 2024 at 10:00 AM Tracy Pearson tracy@powerchurch.com wrote:
Should the code in the Lost Focus event actually be in the Interactive Change event?
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Tuesday, April 23, 2024 9:53 PM To: profoxtech@leafe.com Subject: Fwd: List box issues
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box
to
update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Yes.
There are a couple of points to add to that. - The Event should call a method. My experience has shown switching forms that are configured as private data sessions may not be in the right memory space in some event code. However, that problem appears to go away when the event calls a method. An explanation of not being in the right memory space is the event code references a table in the forms data session or object on the form, VFP throws an error that it wasn't found. When the event calls a method on the control or the form it is contained in, that has not happened that I have seen. Though, I won't guarantee it will not happen. When the event tries to call a method on a hierarchy like `This.Parent.AnotherObject`, I have seen it error. - How you want the user to experience the system may change which event you want to use. The Got Focus and Lost Focus events are a good place for code that changes the background of the current item to help the user know what control has focus. The Valid event can be used to validate the data in the control and returning .F. from the event prevents the control from losing focus. (textbox validations) - There a many events, most of them I don't use.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, April 24, 2024 12:19 PM To: profoxtech@leafe.com Subject: Re: List box issues
So can we conclude that immediate refresh of another control is probably not supported in any other event because Interactive Change is a better design choice?
On Wed, Apr 24, 2024 at 11:52 AM Tracy Pearson tracy@powerchurch.com wrote:
The Interactive Change event happens when the user makes a selection change via arrow keys or mouse click. The Lost Focus event happens when the user moves to another control.
Using the Interactive Change event to update other controls is better user experience.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, April 24, 2024 11:34 AM To: profoxtech@leafe.com Subject: Re: List box issues
Thanks Tracy - Interactive change works!
Is it by design that the refresh is only executed immediately from the Interactive vChange?
Thanks,
Joe
On Wed, Apr 24, 2024 at 10:00 AM Tracy Pearson tracy@powerchurch.com wrote:
Should the code in the Lost Focus event actually be in the Interactive Change event?
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Tuesday, April 23, 2024 9:53 PM To: profoxtech@leafe.com Subject: Fwd: List box issues
Thanks to Fletcher for the cursor clue I am closer to what I want.
I have 2 files: Spaces with fields space_id and descript Units with fields : unit_id, space_id, and descript
I have a form with a list box for each the Spaces list box has the row source set to 6 (Fields) of Spaces the Units list box has the Row Source type set to 3 (SQL Statement) and the Row Source to: select Spaces.Descript from Spaces where Units.space_id = Spaces.space_id int cursor xxx
The Spaces listbox lost focus event has the following code: thisform.list2.requery this form.list2.refresh
For some reason the Units list box does not display updated data before I click on another box. Actually clicking any other buttom causes the box
to
update.
What am I missing now?
Thanks in advance.
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
On Tue, Apr 23, 2024 at 4:22 PM Joe Yoder joe@wheypower.com wrote:
The Spaces listbox lost focus event calls the requiry event of the Units listbox to update the choices that appear in the Units list box
At the event LostFocus(), the Spaces listbox hasn't finished its series of actions. Specifically, I think it is not until the Valid() event is completed that the listbox considers the data change valid, and updates the .Value of the control. You might want to try updating the Valid event with something like:
DODEFAULT && to let the Control get its new .Value, then ThisForm.lboUnits.Requery()
or similar.
(confirm this, as I haven't used Fox in a decade or so)
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---