Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 + MouseEnter, MouseLeave
Message
De
28/12/2004 07:01:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/12/2004 06:17:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00972508
Message ID:
00972519
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Public oForm
oForm  = Createobject('myForm')
oForm.Show

Define Class myForm As Form
  Height = 400
  Width = 300
  DataSession=2

  Add Object myGrid As myGrid

  Procedure Init
    With This.myGrid
      .ColumnCount = -1
      .AddColumn(1, 'clmFName', 'employee.First_Name', 'First Name')
      .AddColumn(2, 'clmLName', 'employee.Last_Name', 'Last Name')
      .AddColumn(3, 'clmTitle', 'employee.Title', 'Title')
      .Width  = This.Width
      .Height = This.Height
    Endwith
    lnLeft = 0
    For ix=1 To 3
      lnLeft = m.lnLeft +  This.myGrid.Columns(m.ix).Width + 1
      Thisform.AddObject('myLine'+Ltrim(Str(m.ix)),'myLine',m.lnLeft,This.myGrid.Top,This.myGrid.Height)
    Endfor
    This.SetAll('Visible',.T.)
  Endproc

  Procedure Load
    Use employee In 0
  Endproc
Enddefine

Define Class myGrid As Grid
  DeleteMark = .F.
  RecordMark = .F.
  GridLines=0
  Procedure AddColumn
    Lparameters nIndex, cName, cControlSource, cCaption
    Nodefault
    This.AddObject(cName,'myColumn',nIndex, cControlSource, cCaption)
    With Evaluate( 'this.'+cName )
      .Visible = .T.
    Endwith
  Endproc
Enddefine

Define Class myColumn As Column
  Procedure Init
    Lparameters nIndex,cControlSource, cCaption
    With This
      .ControlSource = cControlSource
      .ColumnOrder = nIndex
      .Header1.Caption = cCaption
    Endwith
  Endproc

  Procedure MouseMove
    Lparameters nButton, nShift, nXCoord, nYCoord
    *Find nearest line at right if any
    Thisform.SetAll('BorderColor',0,'myLine')
    Local oLine
    For ix=1 To 3
      oLine = Evaluate("thisform.myLine"+Ltrim(Str(m.ix)))
      If Objtoclient(oLine,2) > m.nXCoord
        oLine.BorderColor = Rgb(255,0,0)
        Exit
      Endif
    Endfor
  Endproc
Enddefine

Define Class myLine As Line
  Width=0
  Procedure Init
    Lparameters tnLeft,tnTop,tnHeight
    With This
      .Left = m.tnLeft
      .Top = m.tnTop
      .Height = m.tnHeight
    Endwith
  Endproc
Enddefine
Cetin


>Hi Cetin!
>
>Thanks for advice - but how can I set the color back when using MouseMove?
>
>What I want:
>MouseEnter -> Color = red
>MouseLeave -> Color = black
>
>Thanks!
>
>>>Hi all!
>>>
>>>In our hotel-software we have a graphical roomplan which displays the rooms (y-axis), days (x-axis) and the reservations; lines make up gridlines (own class; baseclass = line) in the background - used for orientation.
>>>
>>>If you want to know on which day a reservation ends you need to follow the according gridline to the top where the days are displayed.
>>>It would be nice if the gridlines could change the forecolor from black to eg red when the mouse "enters" the line and set the color back to black if the mouse "leaves" the line.
>>>
>>>How could I do this in VFP6?
>>>
>>>Thanks for help!
>>
>>Robert,
>>Gridlines do not have color property for a particular one. They change grid wise. However you might change the header color (column.mousemove) or display a line object at top pointing to endline.
>>I noticed after writing this you say own class-line. Then you can change the color of line in column.mousemove.
>>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