Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids 101 - why am I so lost ?
Message
From
14/12/2006 22:35:05
 
 
To
14/12/2006 22:24:07
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01177450
Message ID:
01177869
Views:
31
My grid has the following columns:
Item, Qty, Desc, Units, Price & Extended Amt

Item is the combo dropdown that has its ControlSource=InvDetail.ItemCode. Its RecordSource=Products.ItemCode

Qty's ControlSource=InvDetail.Quantity

Desc's ControlSource=m.CurrentItemDesc

Unit's ControlSource=m.CurrentItemUnit (Units are lbs, feet etc.)

Price's ControlSource=InvDetail.Price

Extended's ControlSource=InvDetail.Price * InvDetail.Quantity


The big change was with Desc and Units: previously their ControlSources were Products.ItemDesc and Products.Units. Now they are memvars...

To summarize the problem:
=========================
If a column's combo box (Drop-down style) has its RecordSource set to a child table, say PRODUCTS, do NOT set any other columns to have their ControlSource set to this same table (PRODUCTS). If you do, the combo's drop down list will lose focus for a brief instant as VFP tries to update these other column(s) that are bound to PRODUCTS. That means incremental searches in the combo's drop down list will not work, as the keystrokes are lost every time the combo loses focus...

The solution: if you need to have other column(s) that display values (field or calculated) from the same child table as the combo's RecordSource, set these other column's ControlSource to a memvar. Then in the combo's Valid method, update the memvar(s) with the values from the child table (and do a refresh of the column).


>>It works just fine with multiple records. The memvar is updated by the combo's valid()...
>
>I must be missing something. :)
>
>Are you talking about setting the line items grid's column control sources to variables?
>
>If so, then multiple records in the line items table seems like it will be trouble.
>
>>
>>>>The solution: I changed the ControlSource for the several PRODUCTS columns to memory variables. I update these mem vars in the combo control's Valid() and do a refresh of those columns. Works like a champ, incremental works as expected etc.
>>>
>>>Ummm. I think you need to try that solution with multiple records. If you make the column control source a variable, the entire column (all rows that is) should show that value.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform