Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid to behave like a listbox
Message
De
27/07/2004 17:37:32
 
 
À
27/07/2004 16:27:00
Sammy Derban
Ghana Telecom
Accra, Ghana
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00928464
Message ID:
00928485
Vues:
29
You should make a grid class with row highlighted on (VFP 8), readOnly, and vertical (or none) gridLines. Then set the grid to add custom columns, and the column class should have the following code in the MouseMove() event:
LPARAMETERS nButton, nShift, nXCoord, nYCoord

thisForm.MousePointer = 1
I have tried several other places to put mousePointer code and MouseMove is the best one.

Next step is to change the standard textBox of the columns by a textBox class with the properties:
Style: 0 (NOT 3D)
MousePointer: 1 - Arrow
ReadOnly: .T.

and the following methods:
init()
    *-- Show textbox always as selected
    this.BackColor = this.SelectedBackColor
    this.ForeColor = this.SelectedForeColor
    return doDefault()

gotFocus()
    doDefault()
    set Cursor Off

keyPress()
    LPARAMETERS nKeyCode, nShiftAltCtrl

    *-- Allow only navigation keys.
    *-- The rest is disabled to mimic list control
    *-- 19: ENTER
    *-- 9: TAB
    *--	15: SHIFT-TAB
    *-- 18, 3: RePag, AvPag
    *-- 5, 24: up arrow, down arrow (don't wnat to include left and right arrows)
    *-- 27: ESC
    *--	148: CTRL-TAB (grid key to go next control)
    if inList(nKeycode, 13, 9, 15, 18, 3, 5, 24, 27, 148)

        do case
        *-- On ENTER select this value
        case nKeyCode = 13
            if pemStatus(thisForm, 'aceptar', 5)
                thisForm.aceptar()
            endif

        *-- If TAB is pressed, then go to next control (same as in a listBox)
        case nKeyCode == 9
            keyboard '{CTRL+TAB}'

        *-- If SHIFT-TAB pressed, then go to previous control, same as in a listBox
        case nKeyCode == 15
            keyboard '{SHIFT+CTRL+TAB}'
        endcase

    else
        noDefault
    endif

lostFocus()
    doDefault()
    set Cursor on
Hope that helps,
Javier.

>Hello all,
>i want to let my grid behave like a listbox
>i.e individual fields not accessible with the row highlighted.
>Any Help?
>TIA.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform