Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default Think I may have screwed myself...

mmm... now I've done it.

I made a keyboard, on-screen, for a touchscreen in a userform. Works great!
It adds characters one at a time into a specific textbox.

Oops....

Now I need to add a few more text boxes... and I want it to go into the text
box with the current focus... problem is, which text box has the current
focus? Because as soon as I press the keyboard keys (Label objects) it is
*they* that have the current focus!

Think I'm in a spot of trouble here :)

Any ideas very much appreciated....

SMS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Think I may have screwed myself...

Hello,

Userform has a property named ActiveControl.

HTH

sjoo.

"rci" wrote:

mmm... now I've done it.

I made a keyboard, on-screen, for a touchscreen in a userform. Works great!
It adds characters one at a time into a specific textbox.

Oops....

Now I need to add a few more text boxes... and I want it to go into the text
box with the current focus... problem is, which text box has the current
focus? Because as soon as I press the keyboard keys (Label objects) it is
*they* that have the current focus!

Think I'm in a spot of trouble here :)

Any ideas very much appreciated....

SMS

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Think I may have screwed myself...

Labels cannot take focus. With this, focus always remains on the text box.

Private Sub Label1_Click()
TextBox1.Text = TextBox1.Text & "A"
End Sub

Do you mean "ActiveControl" ?

NickHK

"rci" wrote in message
...
mmm... now I've done it.

I made a keyboard, on-screen, for a touchscreen in a userform. Works

great!
It adds characters one at a time into a specific textbox.

Oops....

Now I need to add a few more text boxes... and I want it to go into the

text
box with the current focus... problem is, which text box has the current
focus? Because as soon as I press the keyboard keys (Label objects) it is
*they* that have the current focus!

Think I'm in a spot of trouble here :)

Any ideas very much appreciated....

SMS



  #4   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default Think I may have screwed myself...


Thx Nick,

Well, that is good news... so, how do I find what text box (if any) has the
current focus, and then, having that identified in a variable, how do I use
that variable to enter text into the text box?

Seems it would have to go like this: (psydocode)

CurrentTextBox = Me.HasFocus

CurrentTextox.value = CurrentTextBox.value & NewKeyPressed


Looks simple enough... how come I doubt it is :-)

Thx!



NickHK wrote:


: Labels cannot take focus. With this, focus always remains on the text box.

: Private Sub Label1_Click()
: TextBox1.Text = TextBox1.Text & "A"
: End Sub

: Do you mean "ActiveControl" ?

: NickHK

: "rci" wrote in message
: ...
: mmm... now I've done it.
:
: I made a keyboard, on-screen, for a touchscreen in a userform. Works
: great!
: It adds characters one at a time into a specific textbox.
:
: Oops....
:
: Now I need to add a few more text boxes... and I want it to go into the
: text
: box with the current focus... problem is, which text box has the current
: focus? Because as soon as I press the keyboard keys (Label objects) it is
: *they* that have the current focus!
:
: Think I'm in a spot of trouble here :)
:
: Any ideas very much appreciated....
:
: SMS


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Think I may have screwed myself...

The form has an Activecontrol property.

Private Sub Label1_Click()
ActiveControl.Text = ActiveControl.Text & " A"
End Sub

Depending on your form/needs, you should check what the ActiveControl is.
If TypeOf ActiveControl Is MSForms.TextBox Then ..


NickHK

"rci" wrote in message
...

Thx Nick,

Well, that is good news... so, how do I find what text box (if any) has

the
current focus, and then, having that identified in a variable, how do I

use
that variable to enter text into the text box?

Seems it would have to go like this: (psydocode)

CurrentTextBox = Me.HasFocus

CurrentTextox.value = CurrentTextBox.value & NewKeyPressed


Looks simple enough... how come I doubt it is :-)

Thx!



NickHK wrote:


: Labels cannot take focus. With this, focus always remains on the text

box.

: Private Sub Label1_Click()
: TextBox1.Text = TextBox1.Text & "A"
: End Sub

: Do you mean "ActiveControl" ?

: NickHK

: "rci" wrote in message
: ...
: mmm... now I've done it.
:
: I made a keyboard, on-screen, for a touchscreen in a userform. Works
: great!
: It adds characters one at a time into a specific textbox.
:
: Oops....
:
: Now I need to add a few more text boxes... and I want it to go into

the
: text
: box with the current focus... problem is, which text box has the

current
: focus? Because as soon as I press the keyboard keys (Label objects)

it is
: *they* that have the current focus!
:
: Think I'm in a spot of trouble here :)
:
: Any ideas very much appreciated....
:
: SMS




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone screwed over with student loans? Anoxopesype Excel Discussion (Misc queries) 1 October 18th 08 11:07 PM
Sell Program - Screwed by Managers !!! Greg Wilson Excel Programming 10 June 13th 06 04:26 AM
Sell Program - Screwed by Managers !!! Nicolas Noakes Excel Programming 1 June 12th 06 10:58 AM
Help Please, screwed up big time Frank New Users to Excel 7 December 1st 05 08:54 PM
User screwed up L.White Excel Discussion (Misc queries) 1 August 3rd 05 04:21 PM


All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"