Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to show value not in rowsource of the combobox
Message
De
22/10/2003 18:00:39
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
22/10/2003 16:28:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00753822
Message ID:
00841340
Vues:
24
Hi, Suzi-

I'll let Marcia field the question of how she handles the situation in KiloFox. Here's my take on the situation. First, the combobox is doing it's job, IMO with this behavior, altho I frequently want to do something similar. There are a couple of choices. You can use a UNION SQL statement that will display all the employees. Something along the lines of:
THIS.ROWSOURCE = ;
  [SELECT NAME, Employees.EmpID, .T. selectable FROM Employees ] + ;
  [WHERE Employees.Location = "B" ] + ;
  [UNION ] + ;
  [SELECT DISTINCT NAME, Policies.EmpID, .F. FROM Policies ] + ;
  [LEFT OUTER JOIN Employees ON Policies.EmpID = Employees.EmpID ] + ;
  [WHERE Policies.EmpID NOT IN (SELECT EmpID FROM Employees WHERE Location = "B") .AND. ] + ;
  [Policies.Location = "B" into cursor lvwEmployees]
The problem with this is that I imagine you don't want to let users select the employees that aren't any longer at the location. In that case, you can use the column I added called Selectable, to validate their selection. Or, instead of binding the combobox to the SQL Statement, use the results of the query to populate the Combobox with the results. As you do so, you can prefix a "\" in front of the name which will disable that particular choice from being selected.

The problem I've found with that is the display is a little goofy looking, IMO, but it works alright.

Another option is include both tables with a relation, show the name in the readonly box, but for editing the employeed, use your straightforward combo box selection. I've sometimes overlaid a textbox on top of a combobox. The textbox shows the data from the table (or the relation). When the user types in the textbox, or clicks on the dropdown arrow, I bring the combo to the front. in the lost Focus, then you can set the textbox to on top. Sorta confusing, and I'm dashing this off probably too quickly.

Any of those options sound like possibilities to you?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform