Re: Oldschool Highlight Tracking

Pettyjohn, Chris G. (FTC)
 

Hi,
 I have a grid that highlights the selected row of data.  But when navigating the grid with the arrow keys NVDA does not speak the selected row.  I use the code below to search through lines of text in the grid until I find the color I want (aqua-blue) and then speak it.  I run the code when the user is on the grid and uses the up or down arrow.  Maybe you could do something similar.
   
     def getFormatting(self): #grabs the formatting for the current line
        formatConfig={"detectFormatAfterCursor":False,"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,"reportPage":False,"reportLineNumber":False,"reportLineIndentation":True,"reportLineIndentationWithTones":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,"reportLinks":False,"reportHeadings":False,"reportLists":False,"reportBlockQuotes":False,"reportComments":False,"reportBorderStyle":True,"reportBorderColor":True,
        }
        textList = []
        global info
        info=api.getReviewPosition()
        info.expand(textInfos.UNIT_LINE)
        formatField=textInfos.FormatField()
        for field in info.getTextWithFields(formatConfig):
            if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField):
                formatField.update(field.field)
        text=info.getFormatFieldSpeech(formatField,formatConfig=formatConfig) #if formatField else None
        if text:
            textList.append(text)
        if not textList:
        # Translators: Reported when trying to obtain formatting information (such as font name, indentation and so on) but there is no formatting information for the text under cursor.
            ui.message(_("No formatting information"))
            return
        if text.find("white on aqua-blue") != -1:
            return True

Join nvda-devel@groups.io to automatically receive all group messages.