right click causes focus to go to another control

I suspect the solution to this falls under the category of reformat your disk, reinstall everything, then get a new computer.  I have WIN 98, vb 6, sp 3, 64 mb Ram.

Don't bother trying to re-create this - it used to work fine and I'm sure it will work fine in your code.

Here's the problem:
I have a text box (plus other controls) where I have a mouseup event handler where I test for right button and then popup a context menu if it was.
This worked fine until I made a lot of changes in another part of the form.
Then what would happen is if I right clicked on the text box, instead of the context menu, focus would transfer to another text box.
I tried closing vb, reboot, build EXE and run that, all give same behavior.
I then made a copy of the text box which was getting the focus, deleted the original text box, and gave the new textbox the name of the one I deleted.
Now instead of that textbox getting the focus on rightclick, a command button got the focus.
I noticed that the command button had tabindex one higher than the textbox I was right clicking on - I changed tabindexes which resulted in different controls getting the focus (the next control in tab order would get it).
I copied the textbox with mouseup handler, gave the copy the original name and deleted the original.  I still have the problem.
If I don't right click there is no problem  (Yes, I know; I can solve the problem by instructing the user not to right click and if I get any complaints about weird behavior with right clicking, I can sneer and ask "don't you read the documentation?").

I guess the next step is to reinstall VB (after deleting it - as I've read here on EE).
LVL 1
leg1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vettrangerCommented:
If you'd like to send me the project just so you can verify the behavior on another vb6 sp3 system, I'd be happy to take a look at it for you :
vetteranger@carolina.rr.com
0
Erick37Commented:
Post the code for your Mouse events for the textbox in question.
0
leg1Author Commented:
Vettranger: thanks for the offer - it's a good idea but I'll just try it on a second machine I have.

Erick37: I removed the mouseup eventhandler altogether and it still happens.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

leg1Author Commented:
In fact I removed all event handlers for the text box, I right click on it, and off it goes.  It now switched targets and focus ended up on a different control.
0
AnswerTheManCommented:
<<This worked fine until I made a lot of changes in another part of the form.
>>
i belive that's where the problem is.
maybe some boolean update causing the click not to do what it suppose to.

IS there ANY CONDITION for the context menu to pop up as a result of the click ??? if so - check it validity.

IS there any code under MouseDOWN event of the control ? if so - it may CANcel some boolean there needed as a condition for displaying the menu, or just moving the focus to another control.

check all that very carfully.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
leg1Author Commented:
Aha!
I've managed to outfox myself again.
I didn't give a complete description above in the interest of brevity.  I thought I was explaining everything that was relevant but I left out something.  The textbox with the mouseup event handler is placed over a listbox to allow the user to modify entries in the listbox.  (the user is really modifying the textbox which gets placed over the listbox entry which is selected).

What I didn't realize was that a "lostfocus" event handler for the listbox sets the textbox.visible to false, but this occurs at the time that I right-click on the textbox.  The interesting thing is that the textbox mouseup event handler still fires even though the textbox is now invisible.  So it never occurred to me that the textbox was invisible (also, it looks like the listbox entry below it).

I don't understand how the next control to receive the focus is selected.  A few times it was the following tabindex but other times it is not.

At least I have more confidence in VB and can dig my way out

Thanks for your support.

As far as awarding the points, it was of course impossible to answer, given the data I supplied, but I guess AnswerTheMan came closest in saying "check all that very carfully".
I'll accept your answer tomorrow so you don't have to pay points to see my response.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.