Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Move ListBox into RTF, 1 line under.

Posted on 1998-11-02
2
Medium Priority
?
175 Views
Last Modified: 2010-04-30
Fellow VB Programmers,

I am using the RichTextBox control and would like to know
how to move the a ListBox underneath the current line,
like in VB when you dim a value as, a ComboBox or ListBox appears.

For the sake of this question,
Please insert the RTF Control and a ListBox onto a form.
Let the Listbox.Visisble = False and insert the Following code
into your sample...

Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)

Select Case Chr$(KeyAscii)
case "!"
      List1.Visible = True
      ' And the Code to move it here...
case else
end select
end sub

When you press the ! key, it will show you the ListBox.

Now, in order to properly answer this Question,
have the ListBox popup right underneath your current position
in the RichTextBox control. Left & Top.

Thank you.
0
Comment
Question by:s_mccolgan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Expert Comment

by:Poddy
ID: 1442796
Have you considered using the right-click context menu?
0
 
LVL 2

Accepted Solution

by:
Poddy earned 800 total points
ID: 1442797
Private Type POINTAPI
        x As Long
        y As Long
End Type

Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long

  Dim ptX As POINTAPI
  Dim lngRet As Long  
    If KeyAscii = 33 Then
      List1.Visible = True
      lngRet = GetCaretPos(ptX)
      List1.Top = Screen.TwipsPerPixelY * ptX.y + RichTextBox1.Top
      List1.Left = Screen.TwipsPerPixelX * ptX.x + RichTextBox1.Left
    end if
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question