Results 1 to 40 of 4199

Thread: CommonControls (Replacement of the MS common controls)

Threaded View

  1. #11

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    FONTCOMBO

    Small problem

    This occurs only if the control is set to RecentMax > 0.

    Let's say, the last selected font name was "Zürich".
    Then it appears at the top of the list.

    If we now press 'End' on the keyboard, the list doesn't scroll down to "Zürich".
    It stops at the top, the place where "Zürich" ist found in the recents list.

    I would expect that 'End' would go down to the list.
    It's not a problem with the control. It's a event problem in connection with the RichTextBox.
    The same problem occurs in the Demo.

    The reason is that FontCombo1_Click sets the SelFontName of the RichTextBox which on the other hand fires it's own SelChange event and then again sets the Text of the FontCombo.
    In order to avoid this circular thing I added in the Demo (RichTextBoxForm.frm) a Freeze boolean flag: (red marked)
    Code:
    Private Sub FontCombo1_Click()
    If FontComboFreezeClick = True Then Exit Sub
    RichTextBoxFreezeSelChange = True
    If FontCombo1.ListIndex > -1 Then RichTextBox1.SelFontName = FontCombo1.Text
    RichTextBoxFreezeSelChange = False
    End Sub
    
    Private Sub FontCombo1_CloseUp()
    RichTextBox1.SetFocus
    End Sub
    
    Private Sub RichTextBox1_SelChange(ByVal SelType As Integer, ByVal SelStart As Long, ByVal SelEnd As Long)
    If RichTextBoxFreezeSelChange = True Then Exit Sub
    If (SelType And RtfSelTypeText) <> 0 Or SelType = RtfSelTypeEmpty Then
        FontComboFreezeClick = True
        If IsNull(RichTextBox1.SelFontName) Then
            FontCombo1.ListIndex = -1
        Else
            FontCombo1.Text = RichTextBox1.SelFontName
        End If
        FontComboFreezeClick = False
    End If
    End Sub
    Last edited by Krool; Jul 13th, 2018 at 11:22 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
  •  



Click Here to Expand Forum to Full Width