Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

Classes and Objects

A Changeable columns width listbox by viettla
Posted: 19 Oct 02

A Changeable columns width listbox
my original class is built on class desinger. For convenience,
I generated to PRG file by Class Brower. Pls rebuild on class designer
ColumnCount > 1 (require)
ColumnWidth (optional)
MinimumWidth (optional)

*-- Class:        changeablecolwidthlst
*-- ParentClass:  listbox
*-- BaseClass:    listbox
*-- Time Stamp:   10/19/02 09:33:08 AM
DEFINE CLASS changeablecolwidthlst AS listbox

    ColumnCount = 2
    nmargin = ( (SYSMETRIC(3)))
    minimumwidth = 30
    ilmousestart = 0
    dragcol = 0
    Name = "changeablecolwidthlst"
    DIMENSION acolumnswidth[2]

    HIDDEN PROCEDURE stringtoarray
        LOCAL cString,cDelimited
        If Empty (cString)

        If Right(cString,1) <> cDelimited

        nRow= Occur(cDelimited,cString)

        For nRun=1 To nRow
            If nEndPos >0

        LPARAMETERS nButton, nShift, nXCoord, nYCoord

    PROCEDURE MouseDown
        Lparameters nButton, nShift, nXCoord, nYCoord
        Local nColwidth,nXobj
        For i= 1 To This.ColumnCount-1
            nColwidth=nColwidth+ This.acolumnswidth(i)+2
            nXobj=nXCoord-This.Left - This.nMargin
            IF   Between(nXobj,nColwidth  - This.nMargin,nColwidth  + This.nMargin )

        IF this.ColumnCount =1
        DIMENSION this.acolumnswidth(this.ColumnCount)
        FOR i=1 TO this.ColumnCount
        IF this.aColumnsWidth(i)=0
        DO WHILE  this.aColumnsWidth(i) <= this.nMargin*2
        THIS.ColumnWidths=THIS.ColumnWidths+IIF(i=1,"",",")+ allt(STR(this.aColumnsWidth(i)))

    PROCEDURE MouseMove
        Lparameters nButton, nShift, nXCoord, nYCoord
        LOCAL nColwidth,cColumnwidths,nXobj
        This.MousePointer = 0

        For i= 1 To This.ColumnCount-1
            nColwidth=nColwidth+ This.acolumnswidth(i)+2
            nXobj=nXCoord-This.Left - This.nMargin

            IF  Between(nXobj,nColwidth  - This.nMargin,nColwidth  + This.nMargin )
                This.MousePointer = 9

            IF  i=this.DragCol
                    This.acolumnswidth(i)=This.acolumnswidth(i)+ (nXobj-nColwidth)
                    IF This.acolumnswidth(i) < This.minimumwidth
            IF  this.DragCol <> 0
                cColumnwidths=cColumnwidths+Iif(i > 1,",","") + Alltrim(Str(This.acolumnswidth(i)))

        IF  this.DragCol <> 0

*-- EndDefine: changeablecolwidthlst

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close