|
-
Dec 31st, 2002, 04:34 AM
#1
Thread Starter
Fanatic Member
Need some help searchng through a font box efficently *resolved*
I'm writing a lite text editor and I have a font box (a custom control I downloaded from http://www.connetica.co.uk) populated with font names. I have it all working now but the font list always says the last used font, which if I have moved to a different part of the text may not necessarly be the font I'm using.
I've made a loop that goes through the font list to find the apropriate font but it slows down everything while it goes through the list.
VB Code:
For i = 0 To cboFont(Index).ListCount - 1
If cboFont(Index).ItemFont(i).Name = rtxtDesc(Index).SelFontName Then
cboFont(Index).ListIndex = i
Exit For
End If
Next
Any ideas on how to speed this up or possibly a better way?
Last edited by Graff; Dec 31st, 2002 at 04:45 AM.
If wishes were fishes we'd all cast nets.
-
Dec 31st, 2002, 04:39 AM
#2
-= B u g S l a y e r =-
It might be quicker using the sendmessage api
sample
VB Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private Const CB_FINDSTRING = &H14C
Private Sub Text1_Change()
Combo1.ListIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal CStr(Text1.Text))
End Sub
-
Dec 31st, 2002, 04:41 AM
#3
Thread Starter
Fanatic Member
If wishes were fishes we'd all cast nets.
-
Dec 31st, 2002, 04:46 AM
#4
Thread Starter
Fanatic Member
Worked like a charm, thanks again.
If wishes were fishes we'd all cast nets.
-
Dec 31st, 2002, 04:47 AM
#5
-= B u g S l a y e r =-
Just want to know Graff, was it a lot quicker ?
-
Dec 31st, 2002, 02:52 PM
#6
Thread Starter
Fanatic Member
With my method there was a noticable lag of about ~250 - 500 ms where as the api method is almost instantaneous.
If wishes were fishes we'd all cast nets.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|