❓ Whats wrong with my textbox?

Posts 1–13 of 13 · Page 1 of 1
❓ Whats wrong with my textbox?
I have a form that i can show/hide when user presses insert.
A text box on my form is supposed to be selected/ready to be typed into when the form shows...
i got the text box to be selected when the form shows but i can't type into the text box?!?!
The text box is selected but can't be typed into ?!?!?!?!?!
BTW: my form is unfocusable so i can use it in-game. eg; cannot be in focus
If a form doesn't have focus, how would it know when you're using it's controls? I don't think it can. Just wait and someone will correct me.. : p

So basically you can't use the textbox's natural way to handle input. You could use GetAsyncKeyState() like you did with the Insert key (?) to check for keys then manually update the OtherForm.TextBox.Text .

edit: I've heard windows don't have to have focus to receive input (think background bot) -- using PostMessage() or something similar. So it's possible. Might be easier to just update the textbox manually.
msdn for PostMessage: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
You'll need to get the handle of the window. Off top of my head I'm not sure. Will update.
Quote Originally Posted by abuckau907 View Post
If a form doesn't have focus, how would it know when you're using it's controls? I don't think it can. Just wait and someone will correct me.. : p

So basically you can't use the textbox's natural way to handle input. You could use GetAsyncKeyState() like you did with the Insert key (?) to check for keys then manually update the OtherForm.TextBox.Text .

edit: I've heard windows don't have to have focus to receive input (think background bot) -- using PostMessage() or something similar. So it's possible. Might be easier to just update the textbox manually.
msdn for PostMessage: PostMessage function (Windows)
ive tried updating the textbox manually...does not work.
But just to let you know when i click on the button that shows the form with the textbox (i have 2 forms and on the first form is a button that shows the second form and when i click on this button the textbox works...) BUT when i use my insert hot-key the textbox has the same problem mentioned above.
weird?
How are you making the form 'unfocusable'? maybe it's getting focus when your button code is run, but not the key code? Are they different? Post code : ) Also you said updating manually didn't work: post code for that as well. Plz and thnx.
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim CP As CreateParams = MyBase.CreateParams
CP.ExStyle = CP.ExStyle Or &H8000000
Return CP
End Get
End Property














Unfocusable code
'get menue to appear and dissapear
If GetAsyncKeyState(Keys.Insert) = -32767 Then

If appear = True Then
TextBox1.Text = ""
TextBox1.Select()
Me.Hide()
codebreaker.Hide()
appear = False
Exit Sub
Else

codebreaker.Show()
Me.Show()
TextBox1.Select()
TextBox1.Refresh()
'just in case it didnt eork
TextBox1.Select()
appear = True


Exit Sub
End If







Refresh code
Window Styles (Windows)


WS_DISABLED 0x08000000L
The window is initially disabled. A disabled window cannot receive input from the user. ...
I'm not sure why the txtbox receives input when you show it from a command button (which you didn't post code for), but not when you show it from the keypress.

And how did you try to manually update it?
codebreaker.TextBox1.Text += aCharacter ?
codebreaker.TextBox1.Update()

wait a sec. Are you trying to modify the textbox on the main form, or the one you create? I assumed Me was the main form, and 'codebreaker' was the one that was unfocusable and had the txtboxes. Try using Me.Focus() after you display the codebreaker form? If you're trying to type into the box on form 1, I'm not sure .Select() or .Refresh() will cause the window to have focus - and codebreaker got focus when you show it? Try Me.Focus() (?). I'm not quite sure what you're trying to do exactly. Which form is unfocusable, and which one has the textboxes? Please clear up.

I tested..


results in:


which I didn't expect. I thought the form couldn't receive input? Unfocusable??
Did you change anything else about the window, or ?
Quote Originally Posted by abuckau907 View Post
Window Styles (Windows)



I'm not sure why the txtbox receives input when you show it from a command button (which you didn't post code for), but not when you show it from the keypress.

And how did you try to manually update it?
codebreaker.TextBox1.Text += aCharacter ?
codebreaker.TextBox1.Update()

wait a sec. Are you trying to modify the textbox on the main form, or the one you create? I assumed Me was the main form, and 'codebreaker' was the one that was unfocusable and had the txtboxes. Try using Me.Focus() after you display the codebreaker form? If you're trying to type into the box on form 1, I'm not sure .Select() or .Refresh() will cause the window to have focus - and codebreaker got focus when you show it? Try Me.Focus() (?). I'm not quite sure what you're trying to do exactly. Which form is unfocusable, and which one has the textboxes? Please clear up.

I tested..


results in:


which I didn't expect. I thought the form couldn't receive input? Unfocusable??
Did you change anything else about the window, or ?
Alright
Both forms main and menu form is unfocusable so I can use in game.
The menu form has a textbox that recieved input.

The menus form can be hidden/showed when user presses the insert key on keyboard

The first time the menu form is shown (when the user clicks on a button on the main form) the text box works

BUT when the user uses the insert key on keyboard to hide and show the text box the text box does not work...it is selected but won't recieve any input.

BUT when user just goes on main form again and presses the same button that shows the menu form the textbox works again....
I thought "unfocusable" meant the form was unable to receive input..

The first time the menu form is shown (when the user clicks on a button on the main form) the text box works
Idk man, it's not something I've worked with before - I don't know the answer, I'm just trying to help you find it.

The first time the menu form is shown (when the user clicks on a button on the main form) the text box works
What happens if you show the form 1st from the Insert key, and not the button?

Apparently something is different between your code in button_click and code that shows the form after 'Insert' is pressed. ? Please also post code from the button I guess.

edit: unanswered from before..
And how did you try to manually update it?
codebreaker.TextBox1.Text += aCharacter ?
codebreaker.TextBox1.Update()
Quote Originally Posted by abuckau907 View Post
I thought "unfocusable" meant the form was unable to receive input..



Idk man, it's not something I've worked with before - I don't know the answer, I'm just trying to help you find it.


What happens if you show the form 1st from the Insert key, and not the button?

Apparently something is different between your code in button_click and code that shows the form after 'Insert' is pressed. ? Please also post code from the button I guess.

edit: unanswered from before..
i just used textbox1.refresh to update.
the menu cannot be shown until main form brings it up at least once
The form revives input but the game does not detect input so i can use the form without affecting game.
also nothing is different from the button code and the insert code...
I did some poking around the problem seems to be related to the form.show and form.hide...
when i set it to opacity the problem was fixed....but the form was responsive.....which is why i preferred .show and .hide
not sure why .shoe and .hide would affect textbox any ideals?
I'm still not clear on your goal.

What do you mean by "unfocusable"? That you cannot move the form - or use any of it's controls?
If a "unfocusable" form has a button and a text box..can we click the button, or modify the text box?

So MAINFORM is always visible (but also unfocusable), and when you press the "Insert" key (or the command button), it shows a 2nd form?
The 2nd form has txtBoxes that you want to receive input?

-And when I said manually update the text box, I meant use a loop and getasynckeystate to check for input and then manually update the Form.TextBox.Text. Please post full code, maybe even a screenshot would be helpful.
Quote Originally Posted by abuckau907 View Post
I'm still not clear on your goal.

What do you mean by "unfocusable"? That you cannot move the form - or use any of it's controls?
If a "unfocusable" form has a button and a text box..can we click the button, or modify the text box?

So MAINFORM is always visible (but also unfocusable), and when you press the "Insert" key (or the command button), it shows a 2nd form?
The 2nd form has txtBoxes that you want to receive input?

-And when I said manually update the text box, I meant use a loop and getasynckeystate to check for input and then manually update the Form.TextBox.Text. Please post full code, maybe even a screenshot would be helpful.
1.the form is visible and can be interacted with...it is "unfocusable" to the game....or as you say "in the background"

2. You are correct

3.ill post a screencap tomorrow I can't use my computer now I'm on mobile
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us