Recent

Author Topic: DBGrid Tabbing questions  (Read 1319 times)

daveinhull

  • Sr. Member
  • ****
  • Posts: 273
  • 1 divided by nothing must still be 1!
DBGrid Tabbing questions
« on: December 23, 2018, 09:41:28 am »
Hi, I don't want to be able to tab within a DBGrid across fields, but I do want to be able to tab from one DBGrid to another.

So I set the tab advance to aaNone and left the TabStop True with the TabOrder 9 on the first DBGrid and the same for the second with a TabOrder of 1.

However, it doesn't work, the tab key does nothing.

Is there a way to do this without reverting to coding key movements to switch focus between them?

Thanks
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

dsiders

  • Sr. Member
  • ****
  • Posts: 388
Re: DBGrid Tabbing questions
« Reply #1 on: December 23, 2018, 10:30:48 am »
Hi, I don't want to be able to tab within a DBGrid across fields, but I do want to be able to tab from one DBGrid to another.

So I set the tab advance to aaNone and left the TabStop True with the TabOrder 9 on the first DBGrid and the same for the second with a TabOrder of 1.

However, it doesn't work, the tab key does nothing.

Is there a way to do this without reverting to coding key movements to switch focus between them?

Make sure the TDBGrid.Options property does NOT include the value goTabs in both grids.
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

daveinhull

  • Sr. Member
  • ****
  • Posts: 273
  • 1 divided by nothing must still be 1!
Re: DBGrid Tabbing questions
« Reply #2 on: December 23, 2018, 11:31:06 am »
Hi dsiders,

I assume you mean dgTabs, but when I do not include (ie False unset) it still doesn't work - do I also need to set something with TabAdvance?

Thanks
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

dsiders

  • Sr. Member
  • ****
  • Posts: 388
Re: DBGrid Tabbing questions
« Reply #3 on: December 23, 2018, 11:53:20 am »
I assume you mean dgTabs, but when I do not include (ie False unset) it still doesn't work - do I also need to set something with TabAdvance?

You're correct of course... it is dgTabs That's what I get for looking at the documentation.

There are a lot of other things that could affect TDBGrid. Does it have an active/opened dataset in DataSource. Is it ReadOnly? AutoAdvance, AutoEdit, TabAdvance, TabStop of course.


Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

daveinhull

  • Sr. Member
  • ****
  • Posts: 273
  • 1 divided by nothing must still be 1!
Re: DBGrid Tabbing questions
« Reply #4 on: December 23, 2018, 12:00:04 pm »
Hi dsiders,

Yes it has an active opened dataset in Datasource (but not sure if this would affect it), no not read only, autoadvance = aaRightDown (haven't touched this), TabAdvance (Tried all options), TabStop  True, TabOrder set to a value.

Any other thoughts?

Thanks for you help
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

dsiders

  • Sr. Member
  • ****
  • Posts: 388
Re: DBGrid Tabbing questions
« Reply #5 on: December 23, 2018, 12:30:00 pm »
Yes it has an active opened dataset in Datasource (but not sure if this would affect it), no not read only, autoadvance = aaRightDown (haven't touched this), TabAdvance (Tried all options), TabStop  True, TabOrder set to a value.

I built a demo just to see if it works. It does, Here's the form that I created. It'll demonstrate the values that worked for me.

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <Component>
    <component name="Form1" class="TForm1">
      <properties>
        <integer name="Left" value="799"/>
        <integer name="Height" value="597"/>
        <integer name="Top" value="145"/>
        <integer name="Width" value="765"/>
        <string name="Caption" value="Form1"/>
        <integer name="ClientHeight" value="597"/>
        <integer name="ClientWidth" value="765"/>
        <string name="LCLVersion" value="1.8.2.0"/>
      </properties>
      <children>
        <component name="DBGrid1" class="TDBGrid">
          <properties>
            <integer name="Left" value="0"/>
            <integer name="Height" value="268"/>
            <integer name="Top" value="0"/>
            <integer name="Width" value="765"/>
            <ident name="Align" value="alTop"/>
            <ident name="AutoAdvance" value="aaNone"/>
            <boolean name="AutoEdit" value="false"/>
            <boolean name="AutoFillColumns" value="true"/>
            <ident name="Color" value="clWindow"/>
            <collectionproperty name="Columns">
              <collection/>
            </collectionproperty>
            <ident name="DataSource" value="DataSource1"/>
            <set name="Options" value="dgTitles,dgIndicator,dgColumnResize,dgColumnMove,dgColLines,dgRowLines,dgRowSelect,dgConfirmDelete,dgCancelOnExit"/>
            <ident name="TabAdvance" value="aaDown"/>
            <integer name="TabOrder" value="0"/>
          </properties>
        </component>
        <component name="DBGrid2" class="TDBGrid">
          <properties>
            <integer name="Left" value="0"/>
            <integer name="Height" value="329"/>
            <integer name="Top" value="268"/>
            <integer name="Width" value="765"/>
            <ident name="Align" value="alClient"/>
            <ident name="AutoAdvance" value="aaNone"/>
            <boolean name="AutoEdit" value="false"/>
            <boolean name="AutoFillColumns" value="true"/>
            <ident name="Color" value="clWindow"/>
            <collectionproperty name="Columns">
              <collection/>
            </collectionproperty>
            <ident name="DataSource" value="DataSource2"/>
            <set name="Options" value="dgTitles,dgIndicator,dgColumnResize,dgColumnMove,dgColLines,dgRowLines,dgRowSelect,dgConfirmDelete,dgCancelOnExit"/>
            <ident name="TabAdvance" value="aaDown"/>
            <integer name="TabOrder" value="1"/>
          </properties>
        </component>
        <component name="DataSource1" class="TDataSource">
          <properties>
            <ident name="DataSet" value="MemDataset1"/>
            <integer name="left" value="193"/>
            <integer name="top" value="134"/>
          </properties>
        </component>
        <component name="DataSource2" class="TDataSource">
          <properties>
            <ident name="DataSet" value="MemDataset2"/>
            <integer name="left" value="203"/>
            <integer name="top" value="387"/>
          </properties>
        </component>
        <component name="MemDataset1" class="TMemDataset">
          <properties>
            <boolean name="Active" value="true"/>
            <collectionproperty name="FieldDefs">
              <collection>
                <list>
                  <string name="Name" value="MemDataset1ID"/>
                  <ident name="DataType" value="ftAutoInc"/>
                </list>
                <list>
                  <string name="Name" value="MemDataset1Name"/>
                  <ident name="DataType" value="ftString"/>
                  <integer name="Size" value="30"/>
                </list>
              </collection>
            </collectionproperty>
            <integer name="left" value="333"/>
            <integer name="top" value="144"/>
          </properties>
        </component>
        <component name="MemDataset2" class="TMemDataset">
          <properties>
            <boolean name="Active" value="true"/>
            <collectionproperty name="FieldDefs">
              <collection>
                <list>
                  <string name="Name" value="MemDataset2ID"/>
                  <ident name="DataType" value="ftAutoInc"/>
                </list>
                <list>
                  <string name="Name" value="MemDataset2Value"/>
                  <ident name="DataType" value="ftString"/>
                  <integer name="Size" value="16"/>
                </list>
              </collection>
            </collectionproperty>
            <integer name="left" value="347"/>
            <integer name="top" value="409"/>
          </properties>
        </component>
      </children>
    </component>
  </Component>
</CONFIG>
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

daveinhull

  • Sr. Member
  • ****
  • Posts: 273
  • 1 divided by nothing must still be 1!
Re: DBGrid Tabbing questions
« Reply #6 on: December 23, 2018, 04:26:10 pm »
Hi dsiders,

OK, thanks for helping. I looked at your code and found that the differences were:
Autoadvance was aaNone hereas I had aaRightDown
AutoEdit was False whereas I had True
TabAdvance was aaDown whereas I had (tried multiple settings)

So I set my setting to the same as your and all I got was the grid moving down a row on tab.

I still cannot get it to tab across from one grid to another.

Anu other thoughts?
Dave
Version #:1.8.4 Date 2019-01-08 FPC Version: 3.0.4 and SVN Revision 57972 for x86_64-win64-win32/win64

 

TinyPortal © 2005-2018