Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Click Method in a Grid
Message
From
06/08/2001 18:44:15
 
 
To
06/08/2001 18:26:06
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00540439
Message ID:
00540444
Views:
20
This message has been marked as the solution to the initial question of the thread.
Answer at bottom:

>Hi all:
>
>Here is a brief description of what I am trying to achieve:
>
>User input is accepted in a textbox. The Find button has code to select records that match the user's input in the textbox. If anything is found, they are displayed in a grid. (I am using SQL Select statements and put the results into a cursor - which then populates the grid).
>
>I also have three textboxes which display the contents of each of the three fields displayed in the grid in each of the three columns. This code is in the click event of the text field of each of the three columns in the grid. Tis code is shown below.
>
>
meditprime = eval(thisform._grid2.column1.text1.controlsource)
>meditsecond = eval(thisform._grid2.column2.text1.controlsource)
>meditlocid =eval(thisform._grid2.column3.text1.controlsource)
>
>thisform._textbox4.refresh()
>thisform._textbox5.refresh()
>thisform._textbox6.refresh()
>
>If the user clicks the Delete button, I have an SQL statement to delete that specific record. As soon as the delete is executed, I once again execute a Select statement to find all the records that the user had requested back on for display in the grid, i.e., the grid is now repopulated. This code is as follows:
>
>
SET DELETE ON
>
>delete from rev_locations;
>   where rev_locations.primaryloc = meditprime .and.;
>	rev_locations.secondloc = meditsecond .and.;
>	rev_locations.locationid = meditlocid
>		
>thisform._textbox4.value = ""
>thisform._textbox5.value = ""
>thisform._textbox6.value = ""
>
>select * from rev_locations into cursor foundlocation;
>		where alltrim(rev_locations.primaryloc) = mfindloc .or.;
>			alltrim(rev_locations.secondloc) = mfindloc;
>			order by rev_locations.primaryloc
>	go top
>			
>*!*	Check to see if a match has been found
>	count to bbbb
>	if bbbb > 0
>		thisform._grid2.visible = .T.
>		thisform._grid2.recordsource = "foundlocation"
>		thisform._grid2.column1.header1.caption = "Primary Location"
>		thisform._grid2.column2.header1.caption = "Secondary Location"
>		thisform._grid2.column3.header1.caption = "Location ID"
>		thisform._grid2.column1.width = 161
>		thisform._grid2.column2.width = 198
>		thisform._grid2.column3.width = 250
>		go top
>		thisform._label3.visible = .F.
>		thisform._label5.visible = .T.
>		thisform._commandbutton3.caption = "Find"
>		thisform._commandbutton6.enabled = .F.
>		thisform.refresh()
>	else
>		thisform._grid2.visible = .F. &&Or put a form to tell the user
>	endif
>thisform.refresh()
>
>
>It is at this point that I noticed that the Click Method for each of the text fields in each of the three columns are not being fired. Result is that the three textboxes with control sources meditprime, meditsecond and meditlocid are blank.
>
>What should I consider to ensure that the click method of the text fields in each of the three columns are valid an are fired each time and user clicks a field in the grid?


It looks to me like you are losing your recordSource when you redo the SELECT. I'm guessing that's why you do the header and width bits. If your grid really the same then if you
.recordsource = ""
*!* Redo your select
*!* You can use _TALLY to see if the select returned records
.recordsource = "foundlocation"
And you won't have to rebuild your grid. Sorry if I've misunderstood your problem.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform