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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button in Grid

Status
Not open for further replies.

VFP602

Programmer
Jan 23, 2002
41
0
0
MP
Hi guys! I'm just new to VFP and very new to OOP. I'm currently doing a form that contains a grid with 4 cols. On column2, I put a button that when clicked will run a modal form with listbox that contains Supplier No. and name and when a row in this listbox is double clicked it will return to the grid and return the supplier no. on column2 and supplier name on column3. Of course, when I saved the record to the table, I only picked up the values on all other columns except column3. My problem is that the button disappears if I scroll to the last column and when I add a new row the button does not appear on the new row of column2. It only stays to the first row where I pasted it. Another thing I want to know is, which one is better to use when adding new row to the grid, Insert or Append Blank.

Your immediate help is very much appreciated.

 
In the column the button is in make sure the sparse property is set to false.

If you are adding a blank row, append blank is fine, if you are adding a row with data, I would use insert.
 
I tried your advice fluteplr but still the command button just stays on the first row. Any other suggestions?
 
Column2.Sparse=.F. if you want it to be displayed in all rows. Also, button should be Visible = .T., Enabled = .T. and Column2.CurrentContrl = "{ButtonName}"

Buttons were not developed for grids. You can also try a checkbox in the graphical mode - it looks like a button in such case.

About showing button when scrolled horizontally - just lock the grid's columnso it is displayed always as a first column in the grid. Youc an find a lot of samples at the site, in particular, there is a FAQ article.

There is a bug in VFP related to the INSERT command with the table used by grid. So it is better to add records by Append Blank. The bug is described at the MS site (Q260227):
Hope this helps.
Vlad Grynchyshyn, MVP
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top