Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control bound to foreign key
Message
De
15/06/2006 11:45:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
15/06/2006 10:37:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01129284
Message ID:
01129317
Vues:
11
Indeed, a ComboBox is only appropriate to select at most a few dozen items.

This is actually a fairly common requirement.

In Visual Extend, they created a special PickField class. It is based on a container; on the left, a field to show and type the code, in the middle a selector (button with caption "..."), on the right, a TextBox to show a descriptions.

The class is actually quite complicated, having about a dozen properties that must be set in each individual instance, e.g.:
  • From which table is data to be selected.
  • Which fields to show in a list (a form with a list pops up if the user clicks on "pick"), and
  • The corresponding captions.
  • Which field is to be modified (the "ControlSource" equivalent).
  • Indexes involved.

    Since this is from a third-party tool, I can't give you the source code, but perhaps you can create something similar.

    >Hi all,
    >
    >I am working on a new project that I was able to start from a somewhat clean slate, so the tables are better normalized. I have a small interface problem to solve because of it. I need a control to show the lookup information from a related table, but upon modification, performs a lookup and actually changes the underlying foreign key. A combo box or list box is inappropriate.
    >
    >Example :
    >
    >Our company pays property taxes for trust clients, and this is a simplified model. I'm only going to talk about 2 tables.
    >
    >
    >Property - parent table in the example. Contains relevant information for one property, street address etc.
    >
    >Manager - contains property manager contact info. Property record contains the foreign key for the property manager.
    >
    >The tables are opened in the load method and the relation set. So on my form, I can put textboxes showing the property manager's code and name for the current property.
    >
    >If I edit the manager code and save, I would be changing the code for that guy in the manager table, which is not what I want. I want to be able to capture that edit and change the underlying foreign key in the property record.
    >
    >I have my own set of subclasses text boxes, etc. I thought I might be able to create one for this purpose. Add a property such as 'underlying_fk' and do some type of value_assign method sophistry to accomplish the task.
    >
    >It seems this has got to be something commonly done. What are some accepted ways to do this?
    >
    >Thanks,
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform