Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid formatting
Message
From
20/06/2008 03:31:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/06/2008 18:11:21
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
01325580
Message ID:
01325662
Views:
39
This message has been marked as the solution to the initial question of the thread.
>Hi...
>
>please, is there a way to setup a grid in vfp9 to look like this:
>
>item...........................................value
>my first item.....................123,00
>by john doe
>my seconditem................43,80
>by eleonor two
>my thirdy.............................12,80
>by leena leena
>
>
>TIA
>
>Claudio

IMHO easiest way is to use a container in a column. If itemcount at a time isn't much then alternatively a webbrowser control might be a better option with a much more more rich UI.
Here is a rough sample for container:
oForm = Createobject('MyForm')
oForm.Show()
Read Events

Define Class myform As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 362
  Width = 485
  DoCreate = .T.
  Caption = "Sample"
  Name = "Form1"

  Add Object grid1 As Grid With ;
    ColumnCount = 1, ;
    Height = 310, ;
    Left = 12, ;
    Panel = 1, ;
    RecordSource = "orders", ;
    RowHeight = 96, ;
    ScrollBars = 2, ;
    Top = 12, ;
    Width = 420, ;
    Name = "Grid1"

  Procedure grid1.BeforeRowColChange
    Lparameters nColIndex
    Thisform.LockScreen = .T.
  Endproc

  Procedure grid1.AfterRowColChange
    Lparameters nColIndex
    Thisform.LockScreen = .F.
  Endproc

  Procedure Init
    With This.grid1.Columns(1)
      .AddObject('Container1','myContainer')
      .Container1.Visible = .T.
      .Bound = .F.
      .CurrentControl = "Container1"
      .Width = 380
      .Sparse = .F.
      .Header1.Caption = "Order Info"
    Endwith
  Endproc

  Procedure Load
    Use testdata!orders In 0
    Set Multilocks On
    CursorSetProp("Buffering",5,'orders')
  Endproc

  Procedure QueryUnload
    Clear Events
  Endproc
Enddefine

Define Class myContainer As Container
  Width = 380
  Height = 96
  Name = "Container1"

  Add Object lblorder_id As Label With ;
    BackStyle = 0, ;
    Caption = "Order_id", ;
    Left = 8, ;
    Top = 8, ;
    Width = 48, ;
    Name = "lblOrder_id"

  Add Object txtorder_id As TextBox With ;
    ControlSource = "orders.order_id", ;
    Left = 78, ;
    Top = 8, ;
    Width = 55, ;
    Name = "txtOrder_id"

  Add Object lblcust_id As Label With ;
    BackStyle = 0, ;
    Caption = "Cust_id", ;
    Left = 8, ;
    Top = 36, ;
    Width = 43, ;
    Name = "lblCust_id"

  Add Object txtcust_id As TextBox With ;
    ControlSource = "orders.cust_id", ;
    Left = 78, ;
    Top = 36, ;
    Width = 55, ;
    Name = "txtCust_id"

  Add Object lblorder_date As Label With ;
    BackStyle = 0, ;
    Caption = "Order_date", ;
    Left = 8, ;
    Top = 64, ;
    Width = 62, ;
    Name = "lblOrder_date"

  Add Object txtorder_date As TextBox With ;
    ControlSource = "orders.order_date", ;
    Left = 78, ;
    Top = 64, ;
    Width = 73, ;
    Name = "txtOrder_date"

  Add Object combo1 As ComboBox With ;
    BoundColumn = 3, ;
    BoundTo = .T.,;
    ColumnCount = 3, ;
    ColumnWidths = "60,100,40", ;
    RowSourceType = 3, ;
    RowSource = "select first_name,last_name,emp_id from employee into cursor crsEmployee", ;
    ControlSource = "Orders.Emp_id", ;
    FirstElement = 1, ;
    Height = 24, ;
    Left = 186, ;
    NumberOfElements = 0, ;
    Style = 2, ;
    Top = 8, ;
    Width = 180, ;
    Name = "Combo1"

  Add Object command1 As CommandButton With ;
    Top = 44, ;
    Left = 234, ;
    Width = 84, ;
    Caption = "Show customer", ;
    Name = "Command1"

  Procedure command1.Click
    Select * From testdata!customer Where cust_id = orders.cust_id
  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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform