Subject Re: Changing value of speedTip
From Ken Mayer, dBase, LLC <kmayer@dbasellc.com>
Date Fri, 10 Dec 2021 13:17:10 -0800
Newsgroups dbase.getting-started
Attachment(s) Grid_Speedtip.wfm

On 12/10/2021 9:21 AM, Milind Nighojkar wrote:
> Hi Ken,
> I tried to write syntax. But it seems my understanding is poor....
> Can you further guide me on this....?
>

Milind -- please see the attached form. You should be able to copy
it/download it to a folder and run it.

Examine the code. It's not as complex as I expected it to be. When the
rowset navigates it assigns the speedTip of the first column the value
of the company field (this uses the dBASE Samples, Customers table).

The trick is that the rowset's onNavigate event handler assigns the value.

Of course, much depends on exactly what you want to do.

This is based on what you explained in the first message -- which wasn't
much. If you are more specific as to *EXACTLY* what you want, we can
provide better assistance.

Ken

--
*Ken Mayer*, dBase, LLC
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm


** END HEADER -- do not remove this line
//
// Generated on 12/10/2021
//
parameter bModal
local f
f = new Grid_SpeedtipForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class Grid_SpeedtipForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      scaleFontName = "Calibri"
      scaleFontSize = 12.0
      metric = 6        // Pixels
      height = 400.0
      left = 117.0
      top = 277.0
      width = 811.0
      text = ""
   endwith

   this.DBASESAMPLES1 = new DATABASE(this)
   with (this.DBASESAMPLES1)
      left = 18.0
      top = 352.0
      width = 78.0
      height = 37.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.CUSTOMERS1 = new QUERY(this)
   with (this.CUSTOMERS1)
      left = 119.0
      top = 343.0
      width = 63.0
      height = 37.0
      database = form.dbasesamples1
      sql = "select * from CUSTOMERS.DBF"
      active = true
   endwith

   with (this.CUSTOMERS1.rowset)
      onNavigate = class::ROWSET_ONNAVIGATE
      indexName = "COMPANY"
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 57.0
      left = 20.0
      top = 7.0
      width = 408.0
      fontName = "Calibri"
      fontSize = 12.0
      text = '<p>Miland Speedtip with Grid Column Example</p><p></p><p>Uses SAMPLES table "Customers"</p>'
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      fontName = "Calibri"
      fontSize = 12.0
      headingFontName = "Calibri"
      headingFontSize = 12.0
      dataLink = form.customers1.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN1"])
         dataLink = form.customers1.rowset.fields["company"]
         editorType = 1        // EntryField
         width = 231.0
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN2"])
         dataLink = form.customers1.rowset.fields["firstname"]
         editorType = 1        // EntryField
         width = 150.0
      endwith
      columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN3"])
         dataLink = form.customers1.rowset.fields["lastname"]
         editorType = 1        // EntryField
         width = 150.0
      endwith
      columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN4"])
         dataLink = form.customers1.rowset.fields["city"]
         editorType = 1        // EntryField
         width = 200.0
      endwith
      with (columns["COLUMN1"].editorControl)
         fontName = ""
         speedTip = "Starting Text for Speedtip"
      endwith

      with (columns["COLUMN1"].headingControl)
         fontName = ""
         value = "Company"
      endwith

      with (columns["COLUMN2"].editorControl)
         fontName = ""
      endwith

      with (columns["COLUMN2"].headingControl)
         fontName = ""
         value = "FirstName"
      endwith

      with (columns["COLUMN3"].editorControl)
         fontName = ""
      endwith

      with (columns["COLUMN3"].headingControl)
         fontName = ""
         value = "LastName"
      endwith

      with (columns["COLUMN4"].editorControl)
         fontName = ""
      endwith

      with (columns["COLUMN4"].headingControl)
         fontName = ""
         value = "City"
      endwith

      headingHeight = 25.0
      cellHeight = 25.0
      height = 255.0
      left = 22.0
      top = 72.0
      width = 759.0
   endwith

   this.rowset = this.customers1.rowset

   function form_onOpen()
      // force the rowset to navigate so the speedTip
      // updates:
      form.rowset.first()
   return

   function rowset_onNavigate(type, nRows)
      // need a form reference, because rowset
      // doesn't understand what "form" means.
      // this = rowset
      // parent = query
      // parent = form
      oForm = this.parent.parent
      oForm.grid1.columns["COLUMN1"].editorControl.speedTip := ;
         this.fields["Company"].value.rightTrim()
        
      
   return

endclass