Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combobox from an array in a grid
Message
De
17/09/2009 17:26:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
17/09/2009 10:30:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01424903
Message ID:
01425007
Vues:
143
>Hi, someone know how i can do this?

It is simple. Here is a sample (you could use an array I prefer SQL as rowsource):
Public oForm
oForm = Createobject('comboingrid')
oForm.Show

Define Class comboingrid As Form
  Top = 0
  Left = 0
  Height = 350
  Width = 620
  DataSession=2

  Add Object grdorditems As Grid With ;
    Height = 300, ;
    Left = 10, ;
    Top = 10, ;
    Width = 600, ;
    Rowheight = 19,;
    RecordSource = "orditems"

  Procedure Load
    Use _samples+'Data\products' In 0
    Use _samples+'Data\orditems' In 0 Order Tag order_id
    Set Multilocks On
    CursorSetProp("Buffering",5,'orditems')
  Endproc

  Procedure grdorditems.Init
    Local ix
    With This
      For ix = 1 To .ColumnCount
        If Upper(Justext(.Columns(m.ix).ControlSource)) == 'PRODUCT_ID'
          With .Columns(m.ix)
            .Bound = .F.
            .ControlSource = "(Iif(Seek(orditems.product_id,"+;
              "'products','product_id'),Products.prod_name,''))"
            .Width = 170
            .AddObject('comboincol','combobox')
            With .ComboIncol
              .BoundColumn = 2
              .BoundTo = .T.
              .ColumnCount = 2
              .ColumnWidths = "180,0"
              .RowSourceType = 3
              .RowSource = "select products.prod_name,product_id"+;
                " from products into cursor crsProducts order by 1"
              .SpecialEffect = 1
              .Style = 2
              .ControlSource = "orditems.product_id"
              .Visible = .T.
            Endwith
            .CurrentControl = 'comboincol'
          Endwith
          Exit
        Endif
      Endfor
    Endwith
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform