Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with the valid of a checkbox in a grid
Message
From
17/04/2008 00:16:03
Chris Sund
Silhouette Solutions
Utah, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Help with the valid of a checkbox in a grid
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Miscellaneous
Thread ID:
01311365
Message ID:
01311365
Views:
65
This is a really strange thing. I'm sure I've done something like this in the past, but for some reason I can't get it to work now. Here's what I have...

I have 1 Form with a pageframe. On the second tab of the pageframe I have two grids. The first grid lists a series of states (Washington, Montana , etc), the second grid lists their counties.

If I uncheck one of the states in the first grid, I want the 2nd grid to filter out those county's. To do this I created a method in my form called "xfilter_counties",and I call this method from the "valid" of the checkbox in my first grid. Here's the code in my method...
SELECT * FROM rstates WHERE lchoice=.t. INTO CURSOR tchosen

IF _tally<>0

SCAN
SCATTER NAME ofilter

SELECT rcounties
SET FILTER TO ALLTRIM(rcounties.cstate)=ALLTRIM(ofilter.cstate_pk) additive

ENDSCAN

ELSE

SELECT rcounties

SET FILTER TO rcounties.cstate='XX'

ENDIF
That's the latest code I have tried. I tried to avoid the filtering and just simply set the counties to .f., but I get the same basic problem.

HERE'S MY PROBLEM (Finally)

When I click the checkbox in my "state grid" the first time everything works just fine. The second grid gets filtered and it looks great. If I re-check the box without moving from the checkbox control, the second grid doesn't re-populate with the information I need. It does re-populate however if I click outside the checkbox control in the first grid, and then click back in the checkbox control. Now, I'm sure you are probably thinking it has to do with my filter, and the fact I'm not taking the filter back off before I try again. I've tried that, and like I said I've also tried just simply setting my county checkbox to .f. rather than filtering at all. Either way I do it, I get the same results. It seems the valid for the checkbox is not firing entirely after the first time unless I click outside the control, and then back in. I say "entirely" because I also placed a wait window within the valid of my checkbox, and I do see that everytime I click the checkbox, but the second grid still doesn't show the info I need. One last thing. I placed the same code I listed above in a commandbutton. If I use the command button evertime I changed the value of the checkbox in my "state grid", my "county grid" updates just fine.

I really want my county grid to update programmatically.

Any help is appreciated. I hope I provided enough info.

Chris
Next
Reply
Map
View

Click here to load this message in the networking platform