Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reset Filter Condition to ALL after using cmdFind Button 1

Status
Not open for further replies.

proscoop

Programmer
Feb 6, 2002
16
JM
Very good day to you all,

Further to my post on Feb. 22, 2009 ("How To Display JPEG Images (Photos) on a VFP 9 Form") for which I am truly thankful for all the help and corrective advice, I have run into another problem. I used the Form Wizard to create all the forms that I am using in the Virtual Product Catalogue and Order Entry System for travelling salespersons and included PICTURE BUTTONS (Buttonset that included cmdFind button for searching/filtering). My problem is that I have also included CUSTOM-MADE Command Buttons on these forms as well that would take the user to another Form that does something else. For example, the first form allows the salesperson to select/scroll/search the customer table to find the correct customer. On that form there is a Command Button titled, "Proceed to Virtual Catalogue & Order Entry". Once it goes to that form the catalogue information is displayed for all the products in the inventory table along with a photo. Once the desired item is found, a Command Button on that form says, "Add Item To Order".

Here is the real question: If I use the `Picture Search Button (cmdFind in the Buttonset)' to locate the desired customer or product, but FORGET to click on that button once again and reset the Filter Condition to "All" (removing the filter that is) BEFORE clicking on any of my Command Buttons (custom written to open another form that does something else), when I press on the Close Button or Exit Form Picture Button on that other form and return is passed back to the form in which the Search/Filter was done the filtered condition is still on that form and THERE IS NO WAY of clicking that button once again to clear the filter condition and reset to ALL (the button is visible but clicking on it does nothing). The ONLY button that works is the Close/Exit Form buttons. I believe that I might have to put a few lines of code in the CLICK event of the Command Button that would reset the filter to "ALL" (remove the filtered condition) before proceeding to the other form. I have tried SET FILTER TO in the CLICK event of the Command Button but that alone does NOT solve the problem.

Can anyone advise me what to do??? Your help would be greatly appreciated as I am just trying to learn VFP 9. All my previous experience is in FoxPro 2.6 for DOS.

Thanking you,

Proscoop (Chris)
 
Chris,

I believe you are better off to forget the wizButtons. This is a great and usefull utility but to change behavior can be a p.i.t.a.
Use the wizards as they come out of the box for a 'quick and dirty' to make a simple application and nothing more.
There is a Microsoft site explaining all the logic of the wizard class, just can't find it so quickly, if you are realy interested would advise you to google for Wizard Visual FoxPro e.s.o.
Good luck,
Jockey2
 
Very good advice above!
I used some of those forms but dont usually try to change them.
Take a look at
CASE THIS.VALUE = 2 &&SET FILTER TO all
in the clickevent of the wizstyle.vcx searchform
Find a way to trigger this or something like it when you close your form every time.
Since all of this works from inherited code, i would backup the class before messing with it.

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
Thanks much for the suggested tips Jockey2, White605 and Mike Lewis. I appreciate all your comments. Mike, I do remember your warning against using the Wizard to create forms, reports etc. but as I stressed previously, I am an absolute idiot when it comes to OOP and Visual Language Programming to include VFP 9. I might add as well that I am NOT in anyway a full-time programmer anymore. Switched careers many years ago (back in the days of DOS & FoxPro 2.6 DOS). However, I had written a fairly complex Inventory, Accounting, Point-Of-Sale and Order Entry System in FoxPro 2.6 DOS that is still being widely used but of course the support, patches and upgrades from Microsoft has stopped many years now.

I had/have a very good client who relies heavily on the Order Entry System for the travelling salespersons. Out of the blue he contacted me recently requesting the conversion to VFP 9. Before admitting to him that I have no clue how to make the switch over to VFP, I was trying to do the re-write. I must admit that thanks to Mike Lewis and White605 I have gotten a very far way in recreating the Virtual Product Catalogue & Order Entry System and I feel so proud of myself and happy with the way it is looking.

The ONLY bug I am having right now (maybe more of course will pop-up as I continue on this quest to learn VFP 9) is the behaviour of the Find/Search button created by the Wizard. It would be lovely if I could find a way to CLEAR/RESET the filtered condition and re-enable all the buttons in the buttonset before bringing up the other forms. I might have forgotten to mention that I do NOT RELEASE/CLOSE the forms in which the search was done (thisform.release) before bringing up the other form called. Meaning the calling form (the one with the filtered condition) is still visible in the background. It is when controlled is RETURNED back to this form that the SEARCH FILTER cannot be cleared. The ONLY buttons that seem to do anything is PRINT and EXIT FORM (Add/Save, Edit/Revert, Delete) seem active but the navigation buttons (Top, Next, Prev, Bottom) are grayed out.

I think White605 is pointing me in the direction I need to go, but I have no clue how to view the Click Event of the Search Command in the Wizstyle.VCX (Take a look at CASE THIS.VALUE = 2 &&SET FILTER TO all in the clickevent of the wizstyle.vcx searchform).

Do you think I should be releasing the form in which the Filtered Search was performed before calling the other form?? I will stress again that I am NO expert on programming in VFP. Just trying to learn it now. Thus the reason for me relying on the Wizards and any other automated help that VFP 9 offers.

Thanks Much,

ProScoop (Chris)

p.s. Sorry for the lengthy discourse. Just trying to make the problem as clear as possible and stress my competence (lack of) level.
 
Dear Mr. Mike Yearwood

Thanks for your reply. The first form allows the user to select the Customer/Client for which the Sales Order should be generated. That form contains the Wizard Generated ButtonSet from which the user can filter the find condition (to quickly find the desired customer e.g. by name if known). If I use the `Picture Search Button (cmdFind in the Buttonset)' to locate the desired customer or product, but FORGET to click on that button once again and reset the Filter Condition to "All" (removing the filter that is) BEFORE clicking on any of my Command Buttons (custom written to open another form that does something else), when I press on the Close Button or Exit Form Picture Button on that other form (e.g. the grid that contains all items ordered so far) and return is passed back to the form in which the Search/Filter was done the filtered condition is still on that form and THERE IS NO WAY of clicking that button once again to clear the filter condition and reset to ALL (the button is visible but clicking on it does nothing). The ONLY button that works is the Close/Exit Form buttons and the Print button. I believe that I might have to put a few lines of code in the CLICK event of the Custom-Written Command Button that would reset the filter to "ALL" (remove the filtered condition) before proceeding to the other form (e.g. form containing the grid). I have tried SET FILTER TO in the CLICK event of the Custom Command Button (Add To Order) but that alone does NOT solve the problem. Might I also add that the form (e.g. customer or products) is NOT released prior to calling the other form (e.g. the order grid). The Customer/Product form is still visible in the behind the grid form.

Your advice would be greatly appreciated as I am becomming very frustrated while trying to learn VFP 9 (please keep in mind that I am a novice when it come to OOP and VFP--just trying to learn that development language).

Sincerely,

ProScoop (Chris)
 
Dear Mr. Mike Yearwood,

Thank you very much for resolving my problem. I am calling the other form (e.g. line item sales order grid) from a MODELESS form but I did try your suggestion and it did resolve my problem. Thanks a million. I am feeling a lot more confident now and motivated to continue learning the VFP 9 developmental environment and language. I did a few other coding adjustments to the overall program including writing a custom-made menu and calling it from my MAIN.prg (do mainmenu.mpr followed by READ EVENTS). In that MAIN.prg I SET TALK OFF and SET ECHO OFF but somehow I now end up with an "echo" on one of the forms (the product view and selection form) placing THISFORM.DataEnvironment and above that line, the number 1. By chance, do you know why I am getting this information echoed on the form? It did NOT appear on the form prior to this. I have included FOXUSER.dbf in my project.

Sincerely,

ProScoop (Chris)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top