Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - How do i sort fonts in combobox?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How do i sort fonts in combobox?

 Post Reply Post Reply
Author
Message
Nung_Gum View Drop Down
Newbie
Newbie


Joined: 09 June 2004
Location: Korea, South
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nung_Gum Quote  Post ReplyReply Direct Link To This Post Topic: How do i sort fonts in combobox?
    Posted: 09 June 2004 at 7:43pm
    Dim FormatBar As CommandBar
    Dim intLoopCount As Integer
    Set FormatBar = CommandBars.Add("Format", xtpBarTop)
    With FormatBar.Controls
        Set Control = .Add(xtpControlComboBox, ID_COMBO_FONT, "Font")
        Control.Width = 140
        Control.DropDownListStyle = True
        For intLoopCount = 1 To Screen.FontCount
        Control.AddItem Screen.Fonts(intLoopCount)
        Next intLoopCount
End with

'not sort combobox
'How do I ?
Back to Top
Nung_Gum View Drop Down
Newbie
Newbie


Joined: 09 June 2004
Location: Korea, South
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nung_Gum Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2004 at 3:37am
'module bas

Public Sub QSStrings(sArray() As String, l As Integer, r As Integer)

    Dim i As Integer
    Dim j As Integer
    Dim x As String
    Dim y As String
    
    i = l
    j = r
    x = sArray((l + r) / 2)

    While (i <= j)
        While (sArray(i) < x And i < r)
             i = i + 1
        Wend
       
        While (x < sArray(j) And j > l)
             j = j - 1
        Wend

        If (i <= j) Then
             y = sArray(i)
             sArray(i) = sArray(j)
             sArray(j) = y
             i = i + 1
             j = j - 1
        End If
    Wend
    
    If (l < j) Then QSStrings sArray(), l, j
    If (i < r) Then QSStrings sArray(), i, r

End Sub

'form load()

    Dim FormatBar As CommandBar
    Dim ControlColorPopup As CommandBarPopup
    Dim intLoopCount As Integer
    ReDim fontArray(1 To Screen.FontCount) As String
    Set FormatBar = CommandBars.Add("Format", xtpBarTop)
    With FormatBar.Controls
        Set Control = .Add(xtpControlComboBox, ID_COMBO_FONT, "Font")
        Control.Width = 140
        Control.DropDownListStyle = True
       
        For intLoopCount = 1 To Screen.FontCount
             fontArray(intLoopCount) = Screen.Fonts(intLoopCount)
        Next intLoopCount
       
        QSStrings fontArray(), LBound(fontArray), UBound(fontArray)
       
        For i = LBound(fontArray) To UBound(fontArray)
        Control.AddItem fontArray(i), i - 1
        Next
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.