|
-
Oct 30th, 2000, 09:20 PM
#1
Thread Starter
Addicted Member
I use an GetAsyncKeyState api to catch a hotkey press and set my form to visible. I have a specific text box I wanted to get the focus the second the form is visible so my users can begin typing immediately. When I coded my timer to catch the hotkey press I also coded it to give txtSend.Focus but all that happens is that my form appears and the title barflashes a few times but neither my form nor the txtSend gets a focus. How do I allow my form once it is visible, to give my txtSend the focus so my users can begin typing into the txtSend box immediately after the form is visible, without having to manually click the form with a mouse?
I appreciate any time or effort,
Daniel Christie
-
Oct 30th, 2000, 09:47 PM
#2
Hyperactive Member
Have you tried this
Hello,
Have you tried to set the focus of the text this way
Code:
frmName.Visible = True
frmName.txtSend.SetFocus
This way i can be able to start typing in the textbox without
any trouble, give it a try...
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Oct 30th, 2000, 10:40 PM
#3
Thread Starter
Addicted Member
hmmm... "nope go fish".
It didn't work...
Here is the form load:
Private Sub Form_Load()
Dim address As String
'Begin security coding
Call RemoveProgramFromList
frmBrowser.Visible = False
'Start the watch for HideME HotKey presses
tmrVisibleF.Enabled = True
'Begin Navigate
Open "file.dat" For Input As #1
Input #1, address
Close
brwWebBrowser.Navigate address
'Get the current size of the HTML Chat file
Open address For Binary As #1
lblLOF.Caption = LOF(1)
Close
End Sub
HERE IS THE TMR CODE TO MAKE FORM VISIBLE:
Private Sub tmrVisible_Timer()
'Check whether the ((Shift) + (Numeric pad's +)) keys have been pressed.
'If they have been pressed then frmBrowser Shows.
If (GetAsyncKeyState(&H10)) And (GetAsyncKeyState(&H6B)) Then
frmBrowser.Visible = True
tmrVisible.Enabled = False
tmrVisibleF.Enabled = True
txtSend.SetFocus
End If
End Sub
Why is it that once the form is visible=false on form load and then visible=true for the first time, the title bar always flashes and the txtSend box does not get the focus?
Every other time it is Visible=False then back to visible=True the txtSend gets the focus, it's justfirst time from the load thatit never gets the focus, know why?
I appreciate your time and efforts,
Daniel Christie
-
Oct 30th, 2000, 11:16 PM
#4
Try using hide and show rather than visible.
Code:
frmBrowser.Hide
'''''''''
frmBrowser.Show
txtSend.SetFocus
-
Oct 30th, 2000, 11:32 PM
#5
Thread Starter
Addicted Member
It has to be Visible insteade of hide for security reasons
Nope, unfortunately this has to be visible instead of hide for security reasons.
Thanks for the good suggestions though.
Daniel Christie
-
Oct 31st, 2000, 07:04 AM
#6
Try using the SetForegroundWindow api function.
Code:
Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Usage
SetForegroundWindow Text1.hwnd
-
Oct 31st, 2000, 07:14 AM
#7
_______
<?>
Have you tried disabling the timer once it has completed it's task.
tmrVisible_Timer.enabled = false
[Edited by HeSaidJoe on 10-31-2000 at 08:53 AM]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|