Subject Re: Changing value of speedTip
From Milind Nighojkar <milinigh@yahoo.com>
Date Fri, 10 Dec 2021 12:21:08 -0500
Newsgroups dbase.getting-started

Hi Ken,
I tried to write syntax. But it seems my understanding is poor....
Can you further guide me on this....?

My form code is

**********************************************

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

class employeeForm of FORM
   set procedure to databuttons.cc additive
   with (this)
      onOpen = class::FORM_ONOPEN
      onClose = class::FORM_ONCLOSE
      persistent = false
      height = 25.4091
      left = 0.1429
      top = -0.0455
      width = 188.1429
      text = "User Maintenance"
      topMost = false
      windowState = 0        // Normal
      autoSize = true
      autoCenter = true
      mdi = true
      smallTitle = false
      sysMenu = true
      scrollBar = 2        // Auto
      showSpeedTip = true
      useTablePopup = true
   endwith

   this.EMPLOYEES1 = new QUERY(this)
   with (this.EMPLOYEES1)
      left = -308.0
      top = 2.0
      sql = 'select * from "C:\Users\HP\Desktop\dbase2019\GST_Recon\employees.DBF"'
      active = true
   endwith

   with (this.EMPLOYEES1.rowset)
      onNavigate = class::ROWSET_ONNAVIGATE
      autoEdit = false
   endwith

   this.LINE1 = new LINE(this)
   with (this.LINE1)
      left = -660.5714
      right = 0.0
      top = 2.0
      bottom = 2.0
      width = 1
   endwith

   this.LINE2 = new LINE(this)
   with (this.LINE2)
      left = -284.0
      right = 188.7143
      top = 2.0
      bottom = 2.0
      width = 1
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 1.0
      left = 82.0
      top = 0.5
      width = 20.0
      fontSize = 5.0
      text = "<font size=5><b>User Login Details</b></font>"
   endwith

   this.IMAGE2 = new IMAGE(this)
   with (this.IMAGE2)
      height = 2.0
      left = 0.0
      top = 0.0
      width = 6.0
      dataSource = 'FILENAME "C:\Users\HP\Desktop\dbase2019\Indus logo.jpg"'
   endwith

   this.BUTTONFILTER1 = new BUTTONFILTER(this)
   with (this.BUTTONFILTER1)
      height = 1.1818
      left = 4.4286
      top = 24.0455
      width = 10.0
      text = "&Filter"
   endwith

   this.BUTTONNEXT1 = new BUTTONNEXT(this)
   with (this.BUTTONNEXT1)
      height = 1.1818
      left = 32.4286
      top = 24.0455
      width = 10.0
      text = "&Next"
   endwith

   this.BUTTONLAST1 = new BUTTONLAST(this)
   with (this.BUTTONLAST1)
      height = 1.1818
      left = 54.4286
      top = 24.0455
      width = 10.0
      text = "&Last"
   endwith

   this.BUTTONAPPEND1 = new BUTTONAPPEND(this)
   with (this.BUTTONAPPEND1)
      height = 1.1818
      left = 73.0
      top = 24.0
      width = 10.0
      text = "&Add"
   endwith

   this.BUTTONPREVIOUS1 = new BUTTONPREVIOUS(this)
   with (this.BUTTONPREVIOUS1)
      height = 1.1818
      left = 43.4286
      top = 24.0455
      width = 10.0
      text = "&Previous"
   endwith

   this.BUTTONFIRST1 = new BUTTONFIRST(this)
   with (this.BUTTONFIRST1)
      height = 1.1818
      left = 21.4286
      top = 24.0455
      width = 10.0
      text = "F&irst"
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.employees1.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN1"])
         dataLink = form.employees1.rowset.fields["name"]
         editorType = 1        // EntryField
         width = 34.2857
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN2"])
         dataLink = form.employees1.rowset.fields["password"]
         editorType = 1        // EntryField
         width = 22.8571
      endwith
      columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN3"])
         dataLink = form.employees1.rowset.fields["emp_active"]
         editorType = 2        // CheckBox
         width = 14.2857
      endwith
      columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1)
      with (columns["COLUMN4"])
         dataLink = form.employees1.rowset.fields["emp_status"]
         editorType = 4        // ComboBox
         width = 14.2857
      endwith
      with (columns["COLUMN1"].editorControl)
         onGotFocus = class::EDITORCONTROL_ONGOTFOCUS
      endwith

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

      with (columns["COLUMN2"].editorControl)
         onGotFocus = class::EDITORCONTROL_ONGOTFOCUS
      endwith

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

      with (columns["COLUMN3"].editorControl)
         onGotFocus = class::EDITORCONTROL_ONGOTFOCUS
      endwith

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

      with (columns["COLUMN4"].editorControl)
         onGotFocus = class::EDITORCONTROL_ONGOTFOCUS
         beforeCellPaint = class::EDITORCONTROL_BEFORECELLPAINT1
         style = 1        // DropDownList
         dataSource = 'array {" ","Hired","Resigned","Releived"}'
      endwith

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

      height = 19.5
      left = 3.57
      top = 4.0
      width = 184.0
   endwith

   this.rowset = this.employees1.rowset

   function editorControl_beforeCellPaint1(bSelectedRow)
                do case
                        case this.value = 'Hired'
                                this.colorNormal = "green/white"
                        case this.value =        'Resigned'
                                this.colorNormal = "red/white"
                        case this.value =        "Releived"
                                this.colorNormal = "blue/white"
                        otherwise
                                this.colorNormal = "black/white"
                endcase
      return true

   function editorControl_onGotFocus()
                if form.employees1.rowset.fields["emp_active"].value = true
                        form.employees1.rowset.fields["name"].speedtip = 'Test speedtip'
                        form.rowset.beginEdit()
                endi
      return true

   function form_onClose()
      form.close()
      form.release()
                form := null
      return

   function form_onOpen()
                public t_emp_active,crec
      return

   function rowset_onNavigate(type, nRows)
      if this.fields["emp_active"].value = false
                        this.CanEdit := false
                endif
      return true

endclass
**********************************************




Regards


Ken Mayer Wrote:

> On 12/9/2021 9:55 AM, Milind Nighojkar wrote:
> > Hi Ken,
> >
> > I wrote code as below for a grid. Not able to see the change in speedtip based on the field value
> >
> > ****************
> >   function rowset_onNavigate(type, nRows)
> >        if this.fields["emp_active"].value = false
> >           this.CanEdit := false
> >        else
> >           this.fields["name"].speedtip = 'Changed Speedtip'
> >       endif
> >        return true
> > ****************
>
> The speedTip is not a property of the field, it is a property of
> individual visual controls.
>
> For the grid, you would have to get pretty specific:
>
>      oForm = this.parent.parent // this = rowset
>                                 // parent = query
>                                 // parent = form
>      oForm.grid.columns["Column01"].editorControl.speedTip := "Changed
> SpeedTip"
>
> Ken
>
> --
> *Ken Mayer*
> 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