PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


    **************************************************
*-- Form:         form1 (\imaginecorp\form1.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   02/01/07 09:50:14 PM
*
DEFINE CLASS form1 AS form


    Top = 3
    Left = 48
    DoCreate = .T.
    Caption = "Show Item Tips..."
    Name = "Form1"


    ADD OBJECT list1 AS listbox WITH ;
        ColumnCount = 2, ;
        ColumnWidths = "140,70", ;
        Height = 179, ;
        Left = 45, ;
        Top = 27, ;
        Width = 236, ;
        ItemTips = .T., ;
        Name = "List1"


    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 218, ;
        Left = 281, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Close", ;
        Name = "Command1"


    ADD OBJECT label1 AS label WITH ;
        AutoSize = .T., ;
        Caption = "Company", ;
        Height = 17, ;
        Left = 51, ;
        Top = 10, ;
        Width = 55, ;
        Name = "Label1"


    ADD OBJECT label2 AS label WITH ;
        Caption = "ID", ;
        Height = 17, ;
        Left = 196, ;
        Top = 10, ;
        Width = 40, ;
        Name = "Label2"


    PROCEDURE Load
        If Used("customer")
            Use In customer
        Endif
        Select 0
        Use Home()+"samples\data\customer.dbf"
    ENDPROC


    PROCEDURE list1.Init
        Local nFontSize,nFieldWidth,nFirstColumn

        Select customer

        nFontSize = Fontmetric(6,Thisform.list1.FontName,Thisform.list1.FontSize)
        nFieldWidth = Thisform.list1.Width-(Fsize("company","customer")* nFontSize)
        nFirstColumn = Val(Strextract(Thisform.list1.ColumnWidths,"",",",1))

        Select ICASE((Len(Alltrim(customer.company))* nFontSize) >= (nFirstColumn-20),;
            Padr(customer.company,(nFieldWidth+15),".") ,customer.company) as company ,;
            customer.cust_id ;
            FROM customer ;
            INTO Cursor custcursor
        With This
            .ItemTips = .T.
            .RowSource = "custcursor.company,cust_id"
            .rowsourcetype = 6
            .Value = .TopIndex
        Endwith
    ENDPROC


    PROCEDURE command1.Click
        USE IN customer
        thisform.release
    ENDPROC


ENDDEFINE
