Hi all,
I have a procedure that will execute on a "on exit" event, but I only want it to fire when you exit by hitting the Tab button. I don't want it to fire when focus is lost by hitting Shift+Tab or by clicking a different control.
Any suggestions?
Thanks.
DuckNut
4 1933
ok, im sure there are (much) better ways to do this, and people like sashi (that actually know how) will come in right behind me and give you the easier, faster, more logical method. but until then, heres how i would go about this:
the keydown event does not register when tab is pressed. (but you already knew that, or you wouldnt be asking)
so i would create an object (any object, as long as it can receive focus, like a text box, or command button. im going to assume a text box)
place the text box off the screen (left = -100, top = -100) but visible property = true, or else it can not recieve focus.
set the tabindex of your new text box to be one greater than the textbox in question (the one loosing focus)
on the getfocus event of your new text box, do your stuff and then send the fucus to the next logical object.
it isnt pretty. but it isnt difficult.
Thanks for the response. It works.......but. Now when I have to move backwards through the form by shift+tab it stalls at the new text box. When I shift+tab back, the text box gets focus again and the code fires, setting the focus back to the text box I just left.
ok, im sure there are (much) better ways to do this, and people like sashi (that actually know how) will come in right behind me and give you the easier, faster, more logical method. but until then, heres how i would go about this:
the keydown event does not register when tab is pressed. (but you already knew that, or you wouldnt be asking)
so i would create an object (any object, as long as it can receive focus, like a text box, or command button. im going to assume a text box)
place the text box off the screen (left = -100, top = -100) but visible property = true, or else it can not recieve focus.
set the tabindex of your new text box to be one greater than the textbox in question (the one loosing focus)
on the getfocus event of your new text box, do your stuff and then send the fucus to the next logical object.
it isnt pretty. but it isnt difficult.
lol. ok, i handnt thought of tabing the other way onto it. are you ready for some more not-so-pretty code?
terms that i will use:
text2 > the textbox loosing focus (tab index 1)
text1 > the invisible text box (tab index 2)
command1 > the next logical tab index control (tab index 3)
Dim FocusFromControl as boolean
sub text2_lost focus()
FocusFromControl = true
end sub
sub text1_get focus()
if focusfromcontrol then
<"your stuff">
command1.setfocus
else
text2.setfocus
end if
end sub
sub command1_lost focus()
focusfromcontrol = false
end sub
if people are tracking my posts they will have been getting quite the idea of my programming style; "whatever works"
That seems to work!
Thanks for the response.
DuckNut
Sign in to post your reply or Sign up for a free account.
Similar topics
by: M. Clift |
last post by:
Hi All,
Could someone help me out with this?
items = ('a', 'b', 'c', 'd')
items + 1 = ( 'b', 'c', 'd', 'a')
items + 2 = ( 'c', 'd', 'a', 'b')
items + 3 = ( 'd', 'a', 'b', 'c')
trans = 1
|
by: jcrouse |
last post by:
I have a program that is an external viewer. It is launched with a hotkey
from within another application. The program has 30 labels that can be
displayed. Since the labels may not always be...
|
by: the other john |
last post by:
I am looking for ideas on how to create a rollover that triggers an
image rotation in another location. I know how to create a function
for basic rollovers, image swapping sort of thing, but I...
|
by: VorTechS |
last post by:
I'm having a problem with an inherited label, applying text rotation to
aligned text.
If text rotation is applied to the aligned text, the alignment goes 'nuts'.
I can find no logic to what is...
|
by: Roger Li |
last post by:
I got a problem about the mean rotation calculation.
I have a group of rotation matrics in my program and I want to calculate the mean rotation on the basis of these rotation matrics.
I think it...
|
by: Ramtin Kazemi |
last post by:
Hi
How can i perform bitwise rotation in C#?
|
by: elrondrules |
last post by:
I want to create a simple log rotation for the following scenario:
I have a script that when executed will write debug and error messages
to a specific file (say script.log).
I want to create...
|
by: infoseekar |
last post by:
Image Resize & Rotation
Hi
I have 2 scripts, one for Image rotation and other image resize and they both are working.
Image resize scripts load the picture and resize it and Image rotation...
|
by: JobRotation |
last post by:
Hi, i am working on a database, which are making job rotation on factory on diffrent task.
We have 25 people totaly at work
14 of them are working at the same time on 14 diffrent tasks.
Not all...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |