473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Event based on tab rotation

11
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
Jul 31 '06 #1
4 1933
BSOB
77
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.
Aug 1 '06 #2
Ducknut
11
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.
Aug 1 '06 #3
BSOB
77
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"
Aug 1 '06 #4
Ducknut
11
That seems to work!

Thanks for the response.

DuckNut
Aug 2 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

21
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
5
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...
2
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...
0
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...
2
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...
6
by: Ramtin Kazemi | last post by:
Hi How can i perform bitwise rotation in C#?
6
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...
8
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
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...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.