ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Flexgrid, un Activex peu utilisé et mal connu.   



L'auteur

Mike Gagnon
Canada Canada
Membre Simple
# 0000000025
enregistré le 14/10/2004

Gagnon Mike
Pointe Cla H9R 3K8
de la société Carver Technologies Inc.
Fiche personnelle


Note des membres
pas de note

Contributions > 08 - ActiveX - (OLE)

Flexgrid, un Activex peu utilisé et mal connu.
# 0000000230
ajouté le 16/08/2005 18:24:54 et modifié le 02/01/2010
consulté 13817 fois
Niveau initié

Version(s) Foxpro :
VFP 9.0
VFP 8.0
VFP 7.0
VFP 6.0
VFP 5.0

Description

Voici quelque utilité de l'activex Flexgrid. Mal connu, peu utilisé, mais tres flexible.

Code source :
&& Comment rendre le Flexgrid éditable. (La deuxième colonne est éditable)

PUBLIC oform1

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


DEFINE CLASS form1 AS form


  Top = 157
  Left = 252
  Height = 370
  Width = 527
  DoCreate = .T.
  Caption = "Form1"
  Name = "Form1"


  ADD OBJECT olecontrol1 AS olecontrol WITH ;
    Top = 24, ;
    Left = 48, ;
    Height = 300, ;
    Width = 400, ;
    Name = "Olecontrol1", ;
    OleClass ="MSFlexGridLib.MSFlexGrid.1"


    PROCEDURE olecontrol1.KeyPress
    *** ActiveX Control Event ***
    Lparameters keyascii
    With This
       if .colSel = 0
          return
       endif
      Do Case
      Case keyascii=8 &&IF KEY IS BACKSPACE THEN
        If .Text <> ""
           .Text =  Left(.Text, (Len(.Text) - 1))
        Endif
      Otherwise
        .Text = alltrim(.Text) + Chr(keyascii)
      Endcase
    Endwith
  ENDPROC


  PROCEDURE olecontrol1.Init
    USE HOME(2)+"\Tastrade\Data\customer.dbf" AGAIN IN 0 SHARED
    Local lngWidth, i, x
    lngWidth  = 2200 && Twips
    Select customer
    Count To x
    With This
          .Cols = 2
          .Rows = 0
          .AddItem("Name"+Chr(9)+"Number")
          .Rows = x
          .FixedRows = 1
          .WordWrap = .T.
          .RowHeight(0) = .RowHeight(0) * 2
          .ColWidth(0) = lngWidth
          .ColWidth(1) = lngWidth*1.5
          For intLoopCount = 1 To (.Rows-1)
                .TextMatrix(intLoopCount, 0) = "Item #" +Transform(intLoopCount)
          Next intLoopCount
          Select customer
          i = 1
          scan
                .TextMatrix(i, 0) = customer.company_name
                i = i + 1
                If i = x
                      Exit
                Endif
          Endscan
    Endwith

  ENDPROC


ENDDEFINE

Fichier MHT :
Mettre en plein écran


Commentaires
le 16/08/2005, Christophe Chenavier a écrit :
Merci Mike d'avoir pris le temps de rédiger cet article.
En complément, je précise que l'aide en Français sur ce composant existe et se trouve dans la distribution Visual Studio 6, Microsoft Visual Studio\MSDN98\98VSa\1036\Mshflx98.chm

le 16/08/2005, Mike Gagnon a écrit :
Bienvenu

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3