|
-
Oct 10th, 2000, 06:47 PM
#1
Thread Starter
Addicted Member
how can i get the combo box to apear when the user presses "<" but i want the combo box to apear where the test is , can we do this
" i type in
<
combobox here
<
combobox here
[Edited by BoB on 10-10-2000 at 07:51 PM]
WHat would we do with out Microsoft.
A lot more.
-
Oct 10th, 2000, 09:36 PM
#2
Lively Member
will this work
Code:
Option Explicit
' code by John Crowley - freevbcode.com
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCaretPos Lib _
"user32" (lpPoint As POINTAPI) As Long
'CHANGE NAME OF EDIT CONTROL IF NECESSARY
Private Sub Text1_KeyPress(KeyAscii As Integer)
'=================================
'This example grabs the current X and Y of a Text Cursor
'Position within a Text Box Control (works equally well in a
'Rich Text Box) and prints the Cursor's X & Y position in
'the Form's Title Bar
'The Unit of Measure returned is Pixels
'The Co-ordinates returned are from the Top and Left of the
'text box or RTF
'Control's absolute position - so don't forget to add/remove
'the control's .left and .top co-ordinates if required.
'If you require the Text Cursor's X and Y position in a
'different control (as in a Find and Replace' example, where
'a text box contains the search criteria, but you
'require the Cursor's position in the main Text's control),
'set the focus to the desired control before calling the
'GetTCurs...
'i.e. insert the following
'RichTextBox1.SetFocus
'=================================
Dim XPos As Long
Dim YPos As Long
If KeyAscii = 60 Then
XPos = GetTCursX * 15
YPos = GetTCursY * 15 + 600
Combo1.Left = XPos
Combo1.Top = YPos
Combo1.Visible = True
'=================================
'However, as vbTwips are the default unit of measure, you
'can obtain
'the position in vbTwips using the following call
'XPos = ScaleX(GetTCursX, vbPixels, vbTwips)
'YPos = ScaleY(GetTCursY, vbPixels, vbTwips)
'=================================
Me.Caption = "X: " & XPos & " Y: " & YPos
End If
End Sub
Public Function GetTCursX() As Long
Dim pt As POINTAPI
GetCaretPos pt
GetTCursX = pt.X
End Function
Public Function GetTCursY() As Long
Dim pt As POINTAPI
GetCaretPos pt
GetTCursY = pt.Y
End Function
-
Oct 11th, 2000, 03:27 PM
#3
Thread Starter
Addicted Member
thanks man your a big help now i gotta get it to work
WHat would we do with out Microsoft.
A lot more.
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
|