Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search and set focus on specific record on my grid
Message
From
02/12/2017 15:51:52
 
 
To
02/12/2017 12:34:18
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01656045
Message ID:
01656048
Views:
68
your code is correct but before you must activate the page 1 where your grid is located as:
SFT.pageframe1.activepage=1
then you can see the record found selected.
this is a test code (search for Wilman kala in cursor ycurs)-in your case the strict exact search (==)
Publi oform
oform=Newobject("asup")
oform.Show
Read Events
Retu
*
Define Class asup As Form
  Top = 0
  Left = 0
  Height = 381
  Width = 823
  Caption = "Text grid setfocus on pageframe"
  Name = "Form1"


  Add Object pageframe1 As PageFrame With ;
    ErasePage = .T., ;
    PageCount = 2, ;
    Top = 36, ;
    Left = 60, ;
    Width = 673, ;
    Height = 269, ;
    Name = "Pageframe1", ;
    Page1.Caption = "Page1", ;
    Page1.Name = "Page1", ;
    Page2.Caption = "Page2", ;
    Page2.Name = "Page2"


  Add Object command1 As CommandButton With ;
    Top = 324, ;
    Left = 300, ;
    Height = 27, ;
    Width = 84, ;
    autosize=.T.,;
    backcolor=Rgb(0,255,0),;
    mousepointer=15,;
    Caption = "Search for ...", ;
    Name = "Command1"


  Procedure Init
    With Thisform.pageframe1
      .Themes=.F.
      .Page1.BackColor=Rgb(200,150,15)
      .Page2.BackColor=Rgb(212,210,208)
      With .Page2
        .AddObject("grid1","grid")
        Sele company From Home(1)+"samples\data\customer" Into Cursor ycurs

        With .grid1
          .Height = 181
          .Left = 47
          .Top = 20
          .Width = 529
          .Name = "Grid1"
          .Visible=.T.
          .RecordSource="ycurs"
          .RecordSourceType=1
          .Refresh
        Endwith
      Endwith
    Endwith
  Endproc


  Procedure command1.Click
    Select ycurs
    Locate
    Locate For Alltrim(company) == 'Wilman Kala'
    If Found()
      Thisform.pageframe1.ActivePage=2
      Thisform.pageframe1.Page2.grid1.SetFocus()
    Else
      Messagebox("not found")
    Endif
  Endproc

  Procedure Destroy
    Clea Events
  Endproc


Enddefine
*
*-- EndDefine: asup
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform