Results 1 to 1 of 1

Thread: WinSuggestion Bug 2

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Dunedin, New Zealand
    Posts
    533

    Default WinSuggestion Bug 2

    When typing suggested text (normally "Full Text search), the search term is bolded within matching lines that are displayed in the rich text edit used to display matching lines.

    The bug is that there is no "End Bold" command sent to the rich text edit at the end of the typed text, thus it bolds to the end of the line.
    Bolding to the end of the line exceeds the display capabilities of the rich text edit when i=there is one matching line only.
    May I suggest the single line after the comment "// Next line fixes bold" Fixes the issue.

    When searching a single column the bolding works perfectly as per the Demo suggestion view in "Order Entry"

    But when more than one column is combined the problem arises.
    This is an extract of my code.

    Code:
    Procedure OnShowSuggestion tSuggestion ByRef suggestion
            Send ReadByRowId to plChartOfAccountCode_DD plChartOfAccountCode.File_Number (DeserializeRowID(suggestion.sRowId))
            Move (Trim(plChartOfAccountCode.description)) to suggestion.aValues[1]
        End_Procedure


    Extract from winsuggestion.pkg

    Code:
    Procedure ShowSuggestion tSuggestion SuggestionData String sSearch        Integer i iCols iPos
            String sValue
            Integer eSuggestionMode
            Boolean bFullText
            
            Get peSuggestionMode to eSuggestionMode
            Get pbFullText to bFullText
            
            Move SuggestionData.aValues[0] to sValue
            If (not(bFullText)) Begin
                Set pbBold of ghoSuggestionList to True
                Send AppendText of ghoSuggestionList (Left(sValue,Length(sSearch)))
                Set pbBold of ghoSuggestionList to False
                Send AppendText of ghoSuggestionList (Mid(sValue,255,Length(sSearch)+1))
            End
            Else Begin
                Set pbBold of ghoSuggestionList to False
                Move (Pos(Uppercase(sSearch),Uppercase(sValue))) to iPos
                If (iPos) Begin
                    Send AppendText of ghoSuggestionList (Left(sValue,iPos-1))
                    Set pbBold of ghoSuggestionList to True
                    Send AppendText of ghoSuggestionList (Mid(sValue,Length(sSearch),iPos))
                    Set pbBold of ghoSuggestionList to False
                End
                Send AppendText of ghoSuggestionList (Mid(sValue,255,iPos+Length(sSearch)))
            End
            
            // if addiitonal columns (usually validation) we assume the first value is the one that is
            // matched and we display all other values (usually just one) to the
            // right of it.
            Move (SizeOfArray(SuggestionData.aValues)) to iCols
            If (iCols>1) Begin
                Move "" to sValue
                For i from 1 to (iCols-1)
                    Move (sValue + If(i=1," - ","  ") + SuggestionData.aValues[i]) to sValue
                Loop
            // Next line fixes bold bug
            set pbBold of ghosuggestionList to False
                Send AppendText of ghoSuggestionList sValue
            End
        End_Procedure
    Last edited by Russell McDougall; 1-Mar-2023 at 05:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •