Subject Re: FIELD DISPLAY
From Andy Taylor <andy.taylor@which.net>
Date Sat, 15 Jul 2017 07:11:42 -0400
Newsgroups dbase.getting-started

Mustansir:

I have borrowed ideas from both Bruce and Mervyn here and also managed to find a way of inserting a
calculated field into the designer and getting it to use it properly in the design environment!

If you asked me last week I'd have said this can't be done. HeHe!

Have a look; it should be easily usable for your purpose.

Cheers,
Andy

> > On 13/07/2017 09:17, Mustansir Ghor wrote:
> > > I have a logical field SEX which is displaying as entryfield shown below
> > > How can I modify this to display MALE or FEMALE

// save from here as "Gender.wfm"....
if not file('gender.dbf')
   create table gender (Name Character(10), Sex boolean)
        use Gender
        aData = {"Mary",false,"Brian",true,"Jenny",false,"Sidney",true}
        aData.resize(4,2,0)
        append from array aData
        use
endif

** END HEADER -- do not remove this line
//
// Generated on 15/07/2017
//
parameter bModal
local f
f = new genderForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class genderForm of FORM
   with (this)
      height = 14.0909
      left = 69.0
      top = 10.5455
      width = 53.5714
      text = "Gender Bender"
   endwith

   this.QRYGENDER = new QUERY(this)
   with (this.QRYGENDER)
      left = 6.0
      top = 11.0
      width = 8.0
      height = 1.0
      sql = "select gender.*, 'F' as cSex from gender"
      active = true
   endwith

   with (this.QRYGENDER.rowset)
      with (fields["cSex"])
         beforeGetValue = {||iif(this.parent.parent.fields["sex"].value,"Male","Female")}
      endwith
   endwith

   this.GRDMAIN = new GRID(this)
   with (this.GRDMAIN)
      dataLink = form.qrygender.rowset
      height = 8.8182
      left = 7.0
      top = 1.1818
      width = 35.5714
   endwith

   this.CMBGENDER = new COMBOBOX(this)
   with (this.CMBGENDER)
      onChange = {;form.chkSex.value=(this.value="Male");form.QryGender.rowset.save()}
      dataLink = form.qrygender.rowset.fields["csex"]
      height = 1.0909
      left = 25.7143
      top = 10.4091
      width = 14.8571
      dataSource = 'array {"Male","Female"}'
      style = 1        // DropDown
   endwith

   this.CHKSex = new CHECKBOX(this)
   with (this.CHKSEX)
      dataLink = form.qrygender.rowset.fields["sex"]
      visible = false
      height = 1.0909
      left = 25.8571
      top = 11.8182
      width = 14.1429
      text = "ChkSex"
   endwith

endclass
// Gender.wfm ends here........