Text Box & Label (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 04:24
Joined
Oct 30, 2008
Messages
1,257
Ok on the .text and .value distinction. I wanted whatever was in either textbox, whether it had the focus or not. But this failed as wiithout focus .text would return Null - when you had just entered something. There's 2 text boxes so determining which had focus (so .text would be reliable) may have been one way (is there a HasFocus ?) but setting focus to a 3rd (otherwise unused) textbox worked and .text not used.
Micron, I meant by setting the other textbox to "", anything there would be gone, so you could never have text in both at the same time.
But is this extra textbox only to grab the focus, is that the 'right' way to do it ? Then you want to hide it too, which wasn't easy. How else might it be done? And of course the image control should take the focus away from the text box, then everything would have been fine.
 

Micron

AWF VIP
Local time
Today, 11:24
Joined
Oct 20, 2018
Messages
3,476
But is this extra textbox only to grab the focus, is that the 'right' way to do it
Sounds like the answer ought to be "no". One way to know which control has the focus is Screen.ActiveControl but this can be problematic at times.
on the .text and .value distinction. I wanted whatever was in either textbox, whether it had the focus or not.
This is not possible as you have written that, or at least as I understand it.
Again, to get the Text property of a control it must have the focus. Period. End of story. Over and out. Fini.

If you have still not solved whatever it was you were trying to do, it is time to post that code if you have not done so already. Not that we're on page 2 of your thread I seem to be losing the focus (so you can't read my text property). 🥴
 

kirkm

Registered User.
Local time
Tomorrow, 04:24
Joined
Oct 30, 2008
Messages
1,257
Hey, Micron. I get that! In order to read .text it must have the focus?. So how would you lose focus to read text.value?

>This is not possible as you have written that, or at least as I understand it.
Then I've written it wrong somehow as that bit is working. You have 2 textboxes and an image control. The image code needs to know what's in the textboxes. I don't know how better to say it! By each setting the other to "" both can never hold text at same time. LOL or am I wrong ?
 

Micron

AWF VIP
Local time
Today, 11:24
Joined
Oct 20, 2018
Messages
3,476
What image control code? Have you shown any?
Maybe it has mouse events or click events but as already pointed out, it appears there is no focus event that works. We've gone from how to independently move a label to something else but that something else has never really been explained fully - or has it and I've missed it in the fog of poking around in too many threads? If you have code you want feedback on, then do post some.
 

Users who are viewing this thread

Top Bottom