Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic tooltips text in a Grid
Message
De
24/02/2009 10:10:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/02/2009 16:31:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01383601
Message ID:
01383745
Vues:
197
This message has been marked as the solution to the initial question of the thread.
>is there a way to show dynamic tooltips in a grid (column) like we can in DaynamicBackColor etc...
>
>I am changing the color for a column in a grid based on a number but because of section 508 they need to show a tooltips
>that describe the color meaning.
>I tried many places which gives the right result of the selected row.
>
>Thanks
Public oForm
oForm  = Createobject('myForm')
oForm.Show

Define Class myForm As Form
  DataSession = 2
  ShowTips = .T.
  Procedure Load
    Use employee
  Endproc
  Add Object myGrd As myGrid With RecordSource = 'Employee'
Enddefine

Define Class myGrid As Grid
  DeleteMark = .F.
  ReadOnly = .T.
  RecordMark = .F.
  ScrollBars = 3
  SplitBar = .F.
  Highlight = .F.
  HighlightRow = .F.
  Name = "grdMyGrid"

  Procedure AddColumn
    Lparameters nIndex, cAlias, cField
    Nodefault
    This.AddObject("clm"+cField,"myColumn", cAlias+"."+cField,nIndex)
  Endproc

  Procedure Init
    Lparameters tcRecordsource
    tcRecordSource = Iif(Empty(m.tcRecordSource),This.RecordSource,m.tcRecordSource)
    With This
      .ColumnCount = -1
      .RecordSource = tcRecordsource
      nOldColCount = .ColumnCount
      For ix = 1 To Fcount(tcRecordsource)
        .AddColumn(ix, tcRecordsource,Field(ix,tcRecordsource))
      Endfor
      .ColumnCount = nOldColCount
      .SetAll('Visible',.T.)
    Endwith
  Endproc

  Procedure When
    Set Cursor Off
  Endproc

  Procedure Valid
    Set Cursor On
  Endproc
Enddefine

Define Class myColumn As Column
  Resizable = .F.
  Movable = .F.
  Procedure Init
    Lparameters cControlSource, nIndex
    With This
      .ControlSource = cControlSource
      .ColumnOrder = nIndex
      .RemoveObject('Header1')
      .AddObject('myHeader','myHeader')
      .AddObject("myText","myGridTxtBox")
      .CurrentControl = "myText"
      .Sparse = .F.
    Endwith
  Endproc
  Procedure MouseMove
    Lparameters nButton, nShift, nXCoord, nYCoord
    With This.Parent
      lnActiveRow = Ceiling( ;
        ( nYCoord - (.Top + .HeaderHeight) ) / .RowHeight )
      lnActivecol = This.ColumnOrder - This.Parent.LeftColumn + 1
      .ActivateCell(lnActiveRow,lnActiveCol)
    Endwith
    This.myText.ToolTipText = ;
      iif(Type(This.ControlSource)='C',  Eval(This.ControlSource),;
      iif(Type(This.ControlSource)='M',  Mline(Eval(This.ControlSource),1),''))
  Endproc
Enddefine


Define Class myGridTxtBox As TextBox
  Procedure Init
    This.BorderStyle = 0
  Endproc
  Procedure Click
    This.SetFocus()
  Endproc
Enddefine

Define Class myHeader As Header
  Procedure Init
    This.Caption = Proper(Justext(This.Parent.ControlSource))
  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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform