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!

Multiple Combobox's selected

Status
Not open for further replies.

skorda

Programmer
Mar 3, 2004
13
US
I have to comboboxes that are on a toolbar and are related. One shows the company id number and the other shows the company name. This allows the user to select a company using either method. The problem is, once you have selected a company using both combo boxes, they both remain selected (their display value is highlighted), then the incremental search ability only works by name, not be number, no matter which box you are in. All fields are character. Here are my properties for the company # combobox:

BoundColumn = 1
ColumnCount = 2
ControlSource = goPub.cCompany (public property - company #)
Rowsource = SELECT company, ' - ' + name from company INTO CURSOR csrtbCo ORDER BY company
RowSourceType = 3

And for the Name combobox:

BoundColumn = 3
ColumnCount = 3
ControlSource = goPub.cCompany (public property - company #)
Rowsource = SELECT name, ' - ' , company from company INTO CURSOR csrtbCoName ORDER BY Name
RowSourceType = 3

In the InteractiveChange event I have the following code for the Company # combo:

IF this.Value != company.company
goPub.cCompany = this.Value
SELECT company
LOCATE FOR company = goPub.cCompany
ENDIF

And this code for the Company Name combo:

IF csrtbCoName.Company != Company.Company
SELECT company
LOCATE FOR Company = csrtbCoName.Company
goPub.cCompany = Company
ENDIF

I am using VFP 8, by the way. Any ideas??

Sebastian
 
Ok, has nobody ever had this problem? Am I not providing enough information? Please, anyone let me know if they can reproduce this...I may report this to MS as a bug? Thanks in advance.

Sebastian
 

I don't think its a bug, most likely a improper setting somewhere. Normally a combobox's incremental search will act on the first column only.

These articles might guide your to resolve your problem.

How to Use IncrementalSearch Property of List and Combo Boxes

PRB: Incremental Search Always on 1st Col of Multi-Column List


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
The incremental search does work on the first column. But in this case, as I said above, the incremental search only works on the first column of the second combobox once you have entered both comboboxes. No matter which combobox you are in, it will only search on the values of the second combobox. It appears they are both selected (the display value is highlighted in both), which leads me to believe it might be a bug. Unless there is some way to intentionally select two comboboxes at once (why?). Can someone please confirm that this happening to them as well? Perhaps it only happens in VFP 8? Thank you.
 
which leads me to believe it might be a bug

This would have been reported long ago. I have used many combos over the years and I have never seen this behavior (Even in 8 or beta 9). Is the increment search setting still .T. on the first combo when it stops working.

But in this case, as I said above, the incremental search only works on the first column of the second combobox once you have entered both comboboxes. No matter which combobox you are in, it will only search on the values of the second combobox

This would indicate a "link" between the two. As a test try picking the data from another table, rather that the same table. If the situation corrects itself, I would suggest you load the table twice (common pratice I use) in the Dataenviroment of the form (the second one will have a "1" at the end )and generate your cursors from the different "versions" of the table and see if that corrects the situations.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
This would indicate a "link" between the two. As a test try picking the data from another table, rather that the same table. If the situation corrects itself, I would suggest you load the table twice (common pratice I use) in the Dataenviroment of the form (the second one will have a "1" at the end )and generate your cursors from the different "versions" of the table and see if that corrects the situations.

This seems to be the case. Although I am not sure what you mean by a 'link'. If you mean a relation, than I would say this is a problem, because I did not relate these cursors in any way. Why would VFP create a link between my two cursors when I did not set any relationship between them? Also, even though they are linked, the incremental searching should still work both ways, because both cursors always point to the same record. It seems to me this should work without having to use the table again. If you can provide any clarification, I would sure appreciate it. Thanks!

Sebastian
 
Although I am not sure what you mean by a 'link'.

By linked I mean, it seems under your circumstances, the actions of one combo seem to affect the second combo.
I cannot seem to be able to reprocude your problem. Here are the steps I took.
[ol][li]Create a blenk form[/li]
[li]In the dataenvironment of the form, I load the customer table from TasTrade twice (as I suggested above).[/li]
[li]I put two comboboxes on the form[/li]
[li]In the first one I use
Code:
SELECT alltrim(company_name), "-"+contact_name FROM customer INTO CURSOR csrtbCo  ORDER BY company_name
Set the columncount to 2, Incrementalsearch to .t..[/li]
[li]The second combo I used
Code:
SELECT contact_name, "-",company_name FROM customer1 INTO CURSOR csrtbCoName  ORDER BY contact_name
Columncount to 3, boundcolumn 3, Incrementalsearch to .t.[/li][/ol]

The above example works whether I'm in combo 1 or 2.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Your two locates are the same in both combo boxes??

Surely the second should be locate for name= csrtbCoName.name

Just a thought!!

Actually not, you'll note that even for the company name, the combobox is bound to the 3rd field which is the company code. I prefer to always seek by an id, rather than a description.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top