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

Using Combo in Grid - freezes my VFP

Status
Not open for further replies.

kazl

Programmer
Dec 9, 2002
68
GB
Hi
I am trying to use a Combobox for one field in my grid. This is a (supposedly) simple item which lets you select from a list "A,B,C".

I use the following:
Code:
With ThisForm.Grid1.Columns(n)
  .Text1.Visible = .F.
  .ADDOBJECT('Combo1', 'ComboBox')
  .Combo1.BorderStyle = 0
  .Combo1.Style = 0
  .Combo1.Visible = .T.
  .CURRENTCONTROL = 'Combo1'
  .REMOVEOBJECT('Text1')
  .Combo1.RowSource = "A,B,C"	
  .ControlSource = "ABCfield"
  .Sparse=.T.
ENDWITH

You can skip thru past these fields with mouse, keys or tab from one to another. If you select an item from the dropdown list this is then displayed in the field as it should be. BUT then the combo display seems to return to a text field (as its lost focus) and the whole of VFP6 stops responding.

There is no code for GotFocus, LostFocus or Valid.

I have read thru all related threads and FAQs first and tried various ways to change what happens but none have worked. Does anyone have any suggestions? Thanks. Kaz.
 
kazl

Since you are making the column sparse (meaning it will only show the combobox if the cell has focus), why would want to remove the text1 control, since when the is no combobox showing it need another control to show the value, in this cas it would be a textbox. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike

With sparse the rest of the column in the grid shows the controlsource value and only the selected item has the combobox.

If I set sparse to false then every row shows the dropdown arrow. So I thought that using Sparese=.T. was the right way to do it.

Whichever way the program still hangs up after selecting an item from the combo. Perhaps I am missing something or expecting it to be too simple. After making a combo work from an mvar list I will probably need to make others work from SQL.

There are examples of spinners in grids in Solution.App but not combos. Do you think that this is something too cumbersome to try or is it just that I need to go back to square one?

Kaz
 
KAZL

Perhaps I am missing something or expecting it to be too simple.

I was not refering specifically to the column setting of sparse, but more refering to the fact that by removing the textbox you leave no control to show the contents of the field. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
It's funny though because the display works OK.
There's a bit of info in 1001 Things... I'm going to read through that and try again. Thanks anyway.

Kaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top