Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on smart list box and RTF

Status
Not open for further replies.

ixian

Programmer
Jul 13, 2001
128
0
0
US
Okay I have a "smart" list box coded
If some one type in application then a "." then a list box pops up with list of various items.

My question is I need to expand the "smart" list boxes to include "_", "(", ":" and " = "?

I know that I have to the keyup function...but do I have to do a case select listing? or should I create a (class) module for each one?


I have tried used to use "or" in the if statement but it doesnt work?

Aaron Fear is the mind killer!!!!!!
 
How are you getting it to respond/react to a '.'?

Can you not expand that test to include the other characters? For example just doing a bunch of Ors in the if statement, or changing the check to a Case statement?

If Or doesn't work - as you suggest - can you post your current code so that we can try and figure out why, and suggest a fix/solution?
 
Strogm,

Here is the code for this problem


Private Sub RTF1_KeyUp(KeyCode As Integer, Shift As Integer)


If KeyCode <> 190 Then
Picture4.Visible = False
Picture6.Visible = False
Exit Sub
End If


Dim FF As Integer
Dim PT As POINTAPI
Dim tmpEnd As Integer
Dim tmpBeg As Integer
Dim iEval As Integer
Dim tmpStr As String
Dim tmp2 As String
Dim X As Integer
Dim eChar As String
Dim codeObj As String 'LOCAL &quot;gObjName&quot; Temp String
Dim F As String
Dim lngStart As Integer
Dim tmpLeft As Integer
Dim tmpTop As Integer
Dim A As String

GetCaretPos PT

iEval = 600


tmpEnd = RTF1.SelStart
tmpBeg = tmpEnd - iEval
If tmpBeg < 0 Then tmpBeg = 0
RTF1.SelStart = tmpBeg
RTF1.SelLength = tmpEnd - tmpBeg
If Right$(RTF1.SelText, 1) <> &quot;.&quot; Then
Do Until Right$(RTF1.SelText, 1) = &quot;.&quot;
RTF1.SelLength = RTF1.SelLength + 1
Loop
End If

tmpStr$ = RTF1.SelText
RTF1.SelStart = tmpEnd
RTF1.SelLength = 0
tmp2$ = &quot;&quot;

For X = 1 To (Len(tmpStr$) - 1)
eChar$ = Mid$(tmpStr$, X, 1)
If eChar <> Chr$(10) And eChar <> Chr$(13) _
And eChar <> &quot; &quot; And eChar <> &quot;.&quot; Then
tmp2$ = tmp2$ & eChar$
Else
tmp2$ = &quot; &quot;
End If

Next
tmp2$ = Trim$(tmp2)
If Right$(tmp2, 1) <> &quot;.&quot; Then tmp2 = tmp2 & &quot;.&quot;


codeObj = tmp2$


List1.Clear
F$ = CurDir & &quot;\obj.txt&quot;
gObjName = &quot;&quot;
FF = FreeFile
Open F$ For Input As FF

Do Until LCase$(Trim$(A$)) = LCase$(codeObj$)
If EOF(FF) Then Exit Do
Line Input #FF, A$
Loop
gObjName = codeObj$
Do Until Trim$(A$) = &quot;!&quot;
Line Input #FF, A$
If Trim$(A$) <> &quot;!&quot; And Trim$(A$) <> &quot;&quot; Then
List1.AddItem Right$(A$, Len(A$) - Len(codeObj))
End If
Loop
Close FF


If List1.ListCount = 0 Then Exit Sub


lngStart = RTF1.SelStart
RTF1.SelStart = RTF1.SelStart - Len(codeObj$)
RTF1.SelLength = Len(codeObj$)


If (PT.X * 15) + (RTF1.SelFontSize * 15) + _
Picture4.Width + 45 < Width Then
tmpLeft = (PT.X * 15) + (RTF1.SelFontSize * 15) + 45
Else
tmpLeft = (PT.X * 15) + (RTF1.SelFontSize * 15) - _
Picture4.Width - 45
End If

If (PT.Y * 15) + (RTF1.SelFontSize * 25) + _
Picture4.Height + 45 < Height Then
tmpTop = (PT.Y * 15) + (RTF1.SelFontSize * 25)
Else
tmpTop = (PT.Y * 15) + (RTF1.SelFontSize * 25) - _
Picture4.Height - RTF1.SelFontSize * 25
End If


Picture4.Move tmpLeft, tmpTop
Picture4.Visible = True


Picture6.Move tmpLeft + 45, tmpTop + 45, _
Picture4.Width, Picture4.Height
Picture6.Visible = True


List1.SetFocus

I hope this option can be doable.

Aaron
Fear is the mind killer!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top