|
-
Jan 31st, 2000, 04:40 AM
#1
Thread Starter
Addicted Member
I like to see in every txtbox a big cursor, therefore I use this in every txtbox_gotfocus:
"h& = GetFocus&(): sb& = Picture1.Picture: Call CreateCaret(h&, sb&, 1, 5): sx& = ShowCaret&(h&)"
Can I get this by just type this once in the form ?
Regards, K. Lensen
------------------
-
Jan 31st, 2000, 05:43 AM
#2
Lively Member
Put your code in a function and pass the textbox as an argument. Like this
Code:
Private Function fnLargeCursor(ByRef MyTextBox as TextBox)
'Place your code here using MyTextBox as the text box name
End Function
In the GotFocus Event call the function:
Code:
Private Sub Text1_GotFocus
call fnLargeCursor(Text1)
End Sub
-
Jan 31st, 2000, 05:52 AM
#3
Thread Starter
Addicted Member
Originally posted by bsmith:
Put your code in a function and pass the textbox as an argument. Like this
Code:
Private Function fnLargeCursor(ByRef MyTextBox as TextBox)
'Place your code here using MyTextBox as the text box name
End Function
In the GotFocus Event call the function:
Code:
Private Sub Text1_GotFocus
call fnLargeCursor(Text1)
End Sub
Yes, I now this works, but I have seen something like:
For Each blabla in forms .... etc
Can I use this and how ?
-
Jan 31st, 2000, 05:59 AM
#4
Lively Member
Is this code more of what you are looking for?
Code:
Private Sub Command1_Click()
' This code will loop through all controls on your form.
' It will only process the textboxes.
Dim Thing As Variant
For Each Thing In Form1
If TypeOf Thing Is TextBox Then
If Thing.Text = "" Then
' Do what you need to do
End If
End If
Next Thing
End Sub
-
Jan 31st, 2000, 06:16 AM
#5
You can't. This is what MSDN has to say:
The system provides one caret per queue. A window should create a caret only when it has the keyboard focus or is active. The window should destroy the caret before losing the keyboard focus or becoming inactive.
ShowCaret shows the caret only if the specified window owns the caret, the caret has a shape, and the caret has not been hidden two or more times in a row. If one or more of these conditions is not met, ShowCaret does nothing and returns FALSE.
------------------
Serge
Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
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
|