I have a form that displays records from a table in a listbox. A "New" button adds a record to the table and calls a detail form that allows entering data to the blank record. When the detail form closes I want the listbox on the original form to display the new record.
Its not working.automatically. A mouse click anywhere on the list box causes it to resize and display the new record. I looked for a way to programatically simulate the physical mouse click but so far haven't found one. Here is the code in the button click event: GOTO bottom APPEND blank thisform.list1.refresh DO FORM PMdetail thisform.list1.refresh thisform.UpdateTot && Update the total and refresh the form thisform.list1.click
I know there are better approaches but it seems this should work. Any ideas?
TIA - Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
If it's bound directly to the table a simple Refresh() should do it. However when you show the form I think it will just show it and then the next lines in your button click will run, i.e. it won't wait for your PMDetail form to close.
Is the PMDetail form modal?
Laurie
On 23 August 2016 at 15:11, Alan Bourke alanpbourke@fastmail.fm wrote:
If it's bound directly to the table a simple Refresh() should do it. However when you show the form I think it will just show it and then the next lines in your button click will run, i.e. it won't wait for your PMDetail form to close.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
Yes Laurie - both forms are modal.
Alan - your suggestion that there may be a timing issue has prompted my addition of another test button on the form with the listbox. The button code consists of: thisform.list1.click thisform.list1.Refresh thisform.refresh
When I add a record it does not show on the screen. I can drag the scroll bar up and down - still no record. I can click the test button - no effect. I can click the up arrow on the scroll bar - no effect. When I click the down arrow on the scroll bar or any data area in the listbox the record shows up.
On Tue, Aug 23, 2016 at 10:22 AM, Laurie Alvey trukker41@gmail.com wrote:
Is the PMDetail form modal?
Laurie
On 23 August 2016 at 15:11, Alan Bourke alanpbourke@fastmail.fm wrote:
If it's bound directly to the table a simple Refresh() should do it. However when you show the form I think it will just show it and then the next lines in your button click will run, i.e. it won't wait for your PMDetail form to close.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
Joe:
Listbox and Combobox controls have a Requery() method to refresh the data in the control from the underlying source.
On Tue, Aug 23, 2016 at 11:02 AM, Joe Yoder joe@wheypower.com wrote:
Yes Laurie - both forms are modal.
Alan - your suggestion that there may be a timing issue has prompted my addition of another test button on the form with the listbox. The button code consists of: thisform.list1.click thisform.list1.Refresh thisform.refresh
When I add a record it does not show on the screen. I can drag the scroll bar up and down - still no record. I can click the test button - no effect. I can click the up arrow on the scroll bar - no effect. When I click the down arrow on the scroll bar or any data area in the listbox the record shows up.
On Tue, Aug 23, 2016 at 10:22 AM, Laurie Alvey trukker41@gmail.com wrote:
Is the PMDetail form modal?
Laurie
On 23 August 2016 at 15:11, Alan Bourke alanpbourke@fastmail.fm wrote:
If it's bound directly to the table a simple Refresh() should do it. However when you show the form I think it will just show it and then the next lines in your button click will run, i.e. it won't wait for your PMDetail form to close.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
Have you tried opening the second form by passing a reference object to it which points to the calling form.
i.e from Form1 issue the following "do Form2 with Thisform"
In the Init of the second form do this:
* Procedure init() Parameters toCalling_Form
Thisform.AddProperty("oCalling_Form", null)
Thisform.oCalling_Form = toCalling_Form ....
You can now use the Thisform.oCalling_Form object to call any events/procedures on the first form from the second.
Once you have added all the records you require in the second form you and issue an Thisform.oCallingform.<<Listbox>>.Requery immediately before the Thisform.Release which should display the added records on the first form.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Joe Yoder Sent: 23 August 2016 15:06 To: profoxtech@leafe.com Subject: Updating a listbox
I have a form that displays records from a table in a listbox. A "New" button adds a record to the table and calls a detail form that allows entering data to the blank record. When the detail form closes I want the listbox on the original form to display the new record.
Its not working.automatically. A mouse click anywhere on the list box causes it to resize and display the new record. I looked for a way to programatically simulate the physical mouse click but so far haven't found one. Here is the code in the button click event: GOTO bottom APPEND blank thisform.list1.refresh DO FORM PMdetail thisform.list1.refresh thisform.UpdateTot && Update the total and refresh the form thisform.list1.click
I know there are better approaches but it seems this should work. Any ideas?
TIA - Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
[excessive quoting removed by server]
I was sure the Requery would do it but I could tell no difference. I finally tried GotFocus and that seems to take care of it! When I have more time I will do some more experimenting to see if I can figure out why it works this way.
Thanks everyone for all the input!
Joe
On Tue, Aug 23, 2016 at 11:14 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Have you tried opening the second form by passing a reference object to it which points to the calling form.
i.e from Form1 issue the following "do Form2 with Thisform"
In the Init of the second form do this:
- Procedure init()
Parameters toCalling_Form
Thisform.AddProperty("oCalling_Form", null)
Thisform.oCalling_Form = toCalling_Form ....
You can now use the Thisform.oCalling_Form object to call any events/procedures on the first form from the second.
Once you have added all the records you require in the second form you and issue an Thisform.oCallingform.<<Listbox>>.Requery immediately before the Thisform.Release which should display the added records on the first form.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Joe Yoder Sent: 23 August 2016 15:06 To: profoxtech@leafe.com Subject: Updating a listbox
I have a form that displays records from a table in a listbox. A "New" button adds a record to the table and calls a detail form that allows entering data to the blank record. When the detail form closes I want the listbox on the original form to display the new record.
Its not working.automatically. A mouse click anywhere on the list box causes it to resize and display the new record. I looked for a way to programatically simulate the physical mouse click but so far haven't found one. Here is the code in the button click event: GOTO bottom APPEND blank thisform.list1.refresh DO FORM PMdetail thisform.list1.refresh thisform.UpdateTot && Update the total and refresh the form thisform.list1.click
I know there are better approaches but it seems this should work. Any ideas?
TIA - Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]