Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Related combo boxes in VFP form
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00161132
Message ID:
00161135
Views:
42
>Please bear with me. I'm giving a long background explanation building up to my problem.
>
>I have three code-lookup fields in the main table of the project I'm working on. In the data-entry form for the main table, I'm using Combo-Boxes (set to Style: Drop-Down List) to let the user enter them. The drop-down lists are Row Source Type: Fields. The Row Source is . + " " + . from the appropriate lookup table. When the list isn't dropped down, all that shows (due to width of the combo-box) is the code. To the right of each combo box is a text-box showing the description of the selected code (bound to the description field in the lookup table).
>
>The drop-down lists are bound to memvars which will contain the looked-up code, to be stored in the record when saved. (I'm using 2.6-ish scatter-edit-gather on this quick project, rather than take time to learn VFP's SQL View and/or Row/Table-Buffering concepts. I'll get there later. I don't think that's related to my issue.)
>
>Things work great if the user normally selects things from the combo boxes. The memvar gets the code value, the pointer moves in the code lookup table so that the text-box (refreshed by the combo-box's Valid event) shows the correct description.
>
>But the second lookup-code may depend on the first one, as follows: if the user chooses certain values from the first drop-down list, the second one should be set to a default value and disabled. To accomplish this, there's a field in the first code-lookup table which MAY contain a foreign key into the second code-lookup table.
>
>I put code in the first combo's Valid event which, if there's a foreign key: a) sets the memvar the second combo is bound to, b) refreshes the second combo, c) disables the second combo, d) refreshes the descriptive text box to the right of the second combo.
>
>When this code fires: the second combo apparently gets its memvar updated, because its record pointer moves, because the text-box to its right is properly refreshed. However, when the combo gets disabled, it shows blank, rather than showing the code. I can't figure out how to get it to show the code. Is a disabled combo-box always blank? (I set the disabled colors to black on light gray, so that's not why I'm not seeing a value.)
>
>Help? Can I show the second combo's code when it's disabled?
>
>Rich Addison
>ERW, Inc., Southfield, MI
>(Currently working for a client in Troy, MI)

The point is following: if you bind combo (style=2) to something (memvar, field, whatever) and combo.rowsource does not contain the value of its controlsource then it really shows empty text portion. The solution is to unbind combo. Just think, what the idea of having extra memory variable, if you already have Combo.Value property which will hold whatever you see/select in text portion of the combo. When it will come to save a record you may move this Combo.Value directly to appropriate field.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform