Subject Re: Combobox
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 6 Oct 2019 12:55:43 -0700
Newsgroups dbase.getting-started
Attachment(s) comboboxTest.wfm

On 10/6/2019 9:32 AM, Mustansir Ghor wrote:
> Dear All
>
> The datasource of combobox does not display list, if the field assigned to it comes from a query which is indexed on the same field. (When I remove index it does)
>
> Is this true.

using the FISH table in dBASE 2019's samples, which has an index on
NAME, the attached works as I would expect it. It's not dataLinked to
anything ... but the combobox has the dataSource set to the NAME field
which is also set as the Index for the form's rowset ...

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



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

class comboboxTestForm of FORM
   with (this)
      scaleFontName = "Calibri"
      scaleFontSize = 11.0
      height = 17.2917
      left = 73.5
      top = 0.0
      width = 52.25
      text = ""
   endwith

   this.DBASESAMPLES1 = new DATABASE(this)
   with (this.DBASESAMPLES1)
      left = 7.0
      top = 15.0
      width = 9.0
      height = 1.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.FISH1 = new QUERY(this)
   with (this.FISH1)
      left = 7.0
      top = 15.0
      width = 3.0
      height = 1.0
      database = form.dbasesamples1
      sql = "select * from FISH.DBF"
      active = true
   endwith

   with (this.FISH1.rowset)
      indexName = "NAME"
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      fontName = "Calibri"
      fontSize = 11.0
      headingFontName = "Calibri"
      headingFontSize = 11.0
      dataLink = form.fish1.rowset
      height = 6.0
      left = 1.0
      top = 1.5
      width = 50.0
   endwith

   this.COMBOBOX1 = new COMBOBOX(this)
   with (this.COMBOBOX1)
      height = 1.0
      left = 7.0
      top = 9.0
      width = 34.0
      fontName = "Calibri"
      fontSize = 11.0
      dataSource = form.fish1.rowset.fields["name"]
      style = 1        // DropDown
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 3.75
      left = 2.0
      top = 10.5
      width = 46.0
      fontName = "Calibri"
      fontSize = 11.0
      l0 = "Question was about a combobox that is dataSourced to a field in a table that the table is indexed on. This is not datalinked to anything, but the dataSource is to the Name field in the Fish table, which is set to the index NAME ... the grid is to show the "
      l0 += "table in full ..."
      text = l0
   endwith

   this.rowset = this.fish1.rowset

endclass