?
Solved

Move ListBox into RTF, 1 line under.

Posted on 1998-11-02
2
Medium Priority
?
174 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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

765 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