Re: Problem with Rich Text Box
From: Les (vb4_at_prodigy.net)
Date: 01/04/05
- Next message: David Youngblood: "Re: Problem with Rich Text Box"
- Previous message: David Youngblood: "Re: Problem with Rich Text Box"
- In reply to: David Youngblood: "Re: Problem with Rich Text Box"
- Next in thread: David Youngblood: "Re: Problem with Rich Text Box"
- Reply: David Youngblood: "Re: Problem with Rich Text Box"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 Jan 2005 01:27:02 -0500
Hi Randy and Dave,
You guys are right on top of things!! Great suggestion Randy! Listen Dave I
do agree that your code snippet works much smoother visually then the other.
However I dont know if it was an oversight or not but the code you posted in
the other forum works great like I just said but my Home and End keys dont
trigger any events. I will now run over to Randy's link and check this
stuff out. You know you are 100 % right that when a bug is found sometime
the onll alternative is either killing yourself to force the work around or
like you suggest do it with API's. FYI not to long ago I had a similar
problem working with the Replace function and that thing does nothng like it
is suppose to. I did figure out, I think, a fine, simple work around to
make it work. I dont know if you are familair with the inherent problems
with that function but if yo uare interested in the workaround let me know.
Guys thanks alot for all the hard work,
Les
"David Youngblood" <dwy@flash.net> wrote in message
news:ebIACUi8EHA.1228@tk2msftngp13.phx.gbl...
> "Les" <vb4@prodigy.net> wrote...
> > Any recommendations for a good beginners book on them?
>
> I will second Randy's suggestion. I visit there often.
>
> > I do have Visual Basic 5 Win 32 API's...
>
> Also a good source. You can find a listing (with description) of the most
common
> edit control messages in chapter 17. Sometimes using an API call is the
only way
> to work around one of these bugs.
>
> David
>
> > but have not done much with it yet. I am going
> > to test it hopefully tonight so stay tuned. Unfortunately I am working
in
> > Windows 98 se and will let you know how it works.
> >
> > Talk to you soon,
> >
> > Les
> >
> > "David Youngblood" <dwy@flash.net> wrote in message
> > news:e4nog4h8EHA.3504@TK2MSFTNGP12.phx.gbl...
> > > "Randy Birch" <rgb_removethis@mvps.org> wrote...
> > > > I can't repro that using the posted code - the selection works as
> > expected
> > > > with no scrolling unless the line is out of view...
> > >
> > > The problem does not occur on W2k nor XP, only WinMe and most likely
9x (I
> > don't
> > > have 9x to test on). Tested on vb5sp3 and vb6sp5. The problem appears
to
> > be in
> > > the rich edit dll, not the ocx.
> > >
> > > David
> > >
> > > > in which case it's
> > > > scrolled just into view. The setting of the scrollbar property has
no
> > effect
> > > > on the code, FWIW.
> > > >
> > > > --
> > > >
> > > >
> > > > Randy Birch
> > > > MS MVP Visual Basic
> > > > http://vbnet.mvps.org/
> > > >
> > > >
> > > > "Les" <vb4@prodigy.net> wrote in message
> > > > news:eQiLUaf8EHA.2568@TK2MSFTNGP11.phx.gbl...
> > > > :A developer helped me with thiscode snippet from the General Forum
and
> > it
> > > > : worked the way it was intended on his machine but on mine and
another
> > > > : gentlleman from that forum had a similar problem like mine. Can
> > someone
> > > > see
> > > > : if they can reproduce this problem and perhaps if a fix exists for
it.
> > > > What
> > > > : happens is explained after the code snippet.
> > > > :
> > > > : Thanks for your help here. Following is the code I used.
> > > > :
> > > > : Dim t As String
> > > > : t = "Line 1 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 2 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 3 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 4 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 5 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 6 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 7 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 8 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 9 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 10 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 11 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 12 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 13 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 14 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 15 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 16 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 17 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 18 This is a test to see if it works"
> > > > : t = t & vbCrLf & "Line 19 This is a test to see if it works"
> > > > :
> > > > : RichTextBox1 = t
> > > > : End Sub
> > > > : Private Sub RichTextBox1_Click()
> > > > : With RichTextBox1
> > > > : .UpTo vbLf, False, False
> > > > : .Span vbCr, True, True
> > > > : End With
> > > > : ' The line the user clicked on is now highlighted; put
> > > > : ' whatever code you wanted to follow this action here
> > > > : End Sub
> > > > :
> > > > : Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As
Integer)
> > > > : Dim HighLight As Boolean
> > > > : With RichTextBox1
> > > > : Select Case KeyCode
> > > > : Case vbKeyUp, vbKeyDown, vbKeyPageUp, vbKeyPageDown
> > > > : HighLight = True
> > > > : Case vbKeyHome
> > > > : HighLight = True
> > > > : .SelStart = 0
> > > > : Case vbKeyEnd
> > > > : HighLight = True
> > > > : .SelStart = Len(.Text)
> > > > : End Select
> > > > : If HighLight Then
> > > > : .UpTo vbLf, False, False
> > > > : .Span vbCr, True, True
> > > > : End If
> > > > : End With
> > > > : ' The line the user clicked on is now highlighted; put
> > > > : ' whatever code you wanted to follow this action here
> > > > : End Sub
> > > > :
> > > > : Now when I run this and click on say Line 5 it pushes the list up
and
> > > > : appears to always highlight the first line. It does select the
right
> > line
> > > > : but on my machine it seems to always put the line I select at the
top
> > of
> > > > the
> > > > : list. When I use the up or down arrows it selects again the
correct
> > line
> > > > : but it moves the lines up so that the selected line is always the
> > first
> > > > : line. I hope this is clearer. Sorry for the trouble.
> > > > :
> > > > : Does this happen to you?
> > > > :
> > > > : Les
> > > > :
> > > > :
> > > > :
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: David Youngblood: "Re: Problem with Rich Text Box"
- Previous message: David Youngblood: "Re: Problem with Rich Text Box"
- In reply to: David Youngblood: "Re: Problem with Rich Text Box"
- Next in thread: David Youngblood: "Re: Problem with Rich Text Box"
- Reply: David Youngblood: "Re: Problem with Rich Text Box"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|