Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BoundTo and combobox
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00655799
Message ID:
00656008
Vues:
10
James,

>I have a combobox that has two columns--cName and iID. Iid is the bound column (2nd column). This is based on a fields list from a view. The controlsource is being saved properly, but it is not displaying the first column until the user sets the focus to the control. The boundTo property is set to .T.

Did You try:

- Setting ListIndex to 1
- Refresh after things are set
- Setting the Value to a vartype that later will meet vartype

I normally work with Arrays instead of fields. This gives me the
chance to add additional options like [No selection] etc.
See if this works better for You
PROCEDURE INIT

This.AddProperty("a_Data[1,2]", "")
This.Requery

ENDPROC

PROCEDURE REQUERY
LOCAL lc_WasControlSource, ln_Select
With This

    *-- Important! remove the Controlsource
    *-- while doing this

    lc_WasControlSource = .ControlSource
    .ControlSource      = ""

    select *  ;
      from <Alias> ;
        into array .a_Data


    *-- Optional some stuff like this
    *-- You will off course need the
    *-- Properties for that if You want 
    *-- to use it
    if .l_KeineAuswahl
        *// Gibt es auch die Option "Keine Auswahl", dann
        *// zusätzlichen Satz hinzufügen
        dimension .a_Data[alen(.a_Data, 1)+1, 2]
        .a_Data[alen(.a_Data, 1), 1] =    .c_KeineAuswahl
        .a_Data[alen(.a_Data, 1), 2] =    .c_ValueKeineAuswahl
        
        ln_Select      = .ListCount
    else
        ln_Select     = iif(.ListCount > 0, 1, .ListCount)

    endif
    *-- eof optional    

    .RowSourceType   = 5 && Array
    .RowSource       = "This.a_Data"
    .BoundColumn     = 2
    .BoundTo         = .T.
    .ListIndex       = ln_Select

    .ControlSource   = lc_WasControlSource
           
endwith    

ENDPROC
HTH
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform