Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Joseph Agarpao
  Where is Joseph Agarpao?
 Manila
 Philippines
 Joseph Agarpao
 To: Karl Hofer
  Where is Karl Hofer?
 Klagenfurt
 Austria
 Karl Hofer
 Tags
Subject: RE: RelativeRow - Is there an AbsoluteRow?
Thread ID: 228362 Message ID: 228484 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Tuesday, May 19, 2009 10:18:47 AM         
   


> Thanks, tried your code.
> This works, but the current recno() gets changed. It's like clicking on a row.
> I can't have this in my application.
> Maybe really there is no solution to this problem, as you suggested?
>
> >
> > AFAIK, if you don't already know the visible rows in a grid, the only way to get the actual row is by activating a cell from that row. ie:
> >
> >
this.ActivateCell( m.lnRelRow, m.lnRelCol )
> > * now you can check recno()

> >
> > Here is a sample:
> >
> >
Public oForm
> > oForm  = Createobject('myForm')
> > oForm.Show
> > 
> > Define Class myForm As Form
> >   DataSession = 2
> >   Height = 400
> >   Width=600
> >   ShowTips = .T.
> >   Procedure Load
> >     Use employee
> >   Endproc
> >   Add Object myGrd As Grid With RecordSource = 'Employee',;
> >     left = 10,Top=10,Height=380,Width=580,;
> >     Highlight=.F.,HighlightRow=.F.
> >   Add Object myContainer As Container With ;
> >     left = 10,Top=10,Height=360,Width=580, BorderWidth=0,BackStyle=0
> >   Add Object myLbl As Label With ;
> >     backcolor=Rgb(255,255,225),Visible=.F.,AutoSize = .T.
> > 
> >   Procedure myGrd.Init
> >     This.SetAll('enabled',.F.)
> >     This.SetAll('disabledforecolor',0)
> >   Endproc
> > 
> >   Procedure myContainer.MouseMove
> >     Lparameters nButton, nShift, nXCoord, nYCoord
> >     Local lcTip
> >     With Thisform.myGrd
> >       Store 0 To nWhere_Out , nRelRow_Out , nRelCol_Out , nView_Out
> >       If .GridHitTest(nXCoord, nYCoord, ;
> >           @nWhere_Out, @nRelRow_Out, @nRelCol_Out) And nWhere_Out = 3
> >         .ActivateCell(m.nRelRow_Out, m.nRelCol_Out)
> >         With .Columns(.ActiveColumn)
> >           lcTip = ;
> >             iif(Type(.ControlSource)='C',  Eval(.ControlSource),;
> >             iif(Type(.ControlSource)='M',  Mline(Eval(.ControlSource),1)+'...',''))
> >         Endwith
> >       Endif
> >     Endwith
> >     With This.Parent.myLbl
> >       .Move(m.nXCoord+16,m.nYCoord+16)
> >       If !Empty(m.lcTip)
> >         .Caption = Trim(m.lcTip)
> >         .Visible = .T.
> >         If .Left + .Width > Thisform.Width
> >           .Move(Thisform.Width - .Width - 10,.Top)
> >         Endif
> >       Else
> >         .Visible = .F.
> >       Endif
> >     Endwith
> >   Endproc
> > Enddefine

> >
> > Cetin Basoz
> >
> > .Net has got better.Think about moving - check my blog:
> > Blog (main)
> > Blog (mirror)


hi Karl!

this is just an idea.

how about creating a cursor with the information you need to display including a field lineno that represent the relative rows.

then in the event AfterRowColChange of the grid, make a small procedure to save the records that are currently displayed in the grid into the cursor.

in the MouseMove event of the grid you use the relative row value as reference to the record you want to display which the cursor has it. The cursor then will be the source of your data in that purpose.

I hope it make sense. :)

btw, my youngest son's name is also Karl! :)

Joseph Agarpao
I may not be an expert but I have satisfied a lot of users.

ENTIRE THREAD

RelativeRow - Is there an AbsoluteRow? Posted by Karl Hofer @ 5/18/2009 2:36:27 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Koen Piller @ 5/18/2009 3:01:07 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Karl Hofer @ 5/18/2009 4:04:27 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Stefan Wuebbe @ 5/18/2009 4:12:24 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Karl Hofer @ 5/18/2009 5:09:51 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Cetin Basoz @ 5/18/2009 4:57:06 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Karl Hofer @ 5/18/2009 5:20:36 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Cetin Basoz @ 5/18/2009 5:24:23 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Karl Hofer @ 5/18/2009 5:42:34 PM
RE: RelativeRow - Is there an AbsoluteRow? Posted by Joseph Agarpao @ 5/19/2009 10:18:47 AM