tabIndex property

int tabIndex

Gets or sets the tab index for form fields.

The default value is 0.

Implementation

int get tabIndex {
  if (_fieldHelper.isLoadedField) {
    if (page != null) {
      final PdfDictionary annotDic = _fieldHelper.getWidgetAnnotation(
          _fieldHelper.dictionary!, _fieldHelper.crossTable);
      final PdfReference reference =
          PdfPageHelper.getHelper(page!).crossTable!.getReference(annotDic);
      _tabIndex =
          PdfPageHelper.getHelper(page!).annotsReference.indexOf(reference);
    }
  }
  return _tabIndex;
}
void tabIndex=(int value)

Implementation

set tabIndex(int value) {
  _tabIndex = value;
  if (_fieldHelper.isLoadedField &&
      page != null &&
      page!.formFieldsTabOrder == PdfFormFieldsTabOrder.manual) {
    final PdfAnnotation annotationReference = WidgetAnnotationHelper.load(
        _fieldHelper.dictionary!, _fieldHelper.crossTable!);
    final PdfReference reference = PdfPageHelper.getHelper(page!)
        .crossTable!
        .getReference(IPdfWrapper.getElement(annotationReference));
    int index =
        PdfPageHelper.getHelper(page!).annotsReference.indexOf(reference);
    if (index < 0) {
      index = _fieldHelper.annotationIndex;
    }
    final PdfArray? annots =
        PdfAnnotationCollectionHelper.getHelper(page!.annotations)
            .rearrange(reference, _tabIndex, index);
    PdfPageHelper.getHelper(page!)
        .dictionary!
        .setProperty(PdfDictionaryProperties.annots, annots);
  }
}