Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a Smart Grid with look up drop boxes
Message
From
18/05/2009 16:06:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/05/2009 14:41:40
John King
Integrated Technologies Group
Florida, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01400456
Message ID:
01400494
Views:
93
>Hello All,
>
>I am new to the UT and a intermediate (at best) VFP9 programmer so bare with me. I am trying to create a "Smart Grid" where the end users can enter data directly into the grid with intellegent look up drop down boxes in the grid. Any examples or suggestions out there? Thanks in advance to your help.
>
>Sincerely,
>
>John

Hi John,
If you meant combobox here is a sample:
** Author:Cetin Basoz
** Combo in grid column sample

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
An autocomplete textbox or something similar (like Quikfill) might be preferred. IMHO there is no other control in VFP as rich as grid but OTOH it is harder to harness it.
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
Previous
Reply
Map
View

Click here to load this message in the networking platform