• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Form focus and passing click to controls

Hi,

I wonder if anyone can help me, I've been trying to find a solution to this problem for weeks.

I have an MDI based application in VB6 that has multiple docked windows (uses Vermod dockable OCX) and a child form in the middle (as the main editing area).

The problem is when I go to click on one of the docked forms(or even an undocked or normal form) you have to click once to focus the window and once again to focus the control you want on that form, and you can't do it with a double click either. What I want to happen is when the user clicks the control on the docked form (without focus) it performs the action on the control and focus's the form.

I've tried using the mouse_event api calls and the SendMessage api call but neither seem to work well enough. I know its possible because other applications (such as Macromedia Homesite, VB6 IDE) that have docking windows do exactly what I want. Obviously most of these weren't created in VB

Hope that makes sense.
0
phuckstepp
Asked:
phuckstepp
  • 7
  • 3
  • 3
  • +1
1 Solution
 
DiveblueCommented:
have you tried coding in the forms gotfocus event?
0
 
phucksteppAuthor Commented:
I tried to add the mouse_event api calls to the gotFocus event and also the Activate event but it didnt work.

Do you know of any other bits of code I could use in the gotFocus to pass the click on?
0
 
DiveblueCommented:
call sub CotrolName_click()
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
phucksteppAuthor Commented:
Unfortunately I dont know what control is under the mouse at the time.
0
 
DiveblueCommented:
have you tried using getcursorpos()?
0
 
EDDYKTCommented:
activeform.activecontrol
0
 
phucksteppAuthor Commented:
Unfortunately I dont know what control is under the mouse at the time.
0
 
Shaka913Commented:
phuckstepp
When I create the a MDI form with children, they take the focus when I click on them, I dont require 2 clicks. Are you sure something (like the docking control) is throwing away that message to those windows? The behaviour you want is what I'm seeing in VB right now.  

0
 
phucksteppAuthor Commented:
Its possible its the exEdit text box control thats stealing the focus, I'm going to have to check.
0
 
Shaka913Commented:
i downloaded the vemod control... and installed it, and you are correct it doesn't give up focus... it is the control. For some reason it is intercepting all mouse clicks over the controls in its list and discarding them.  

I found a VB code download that show how to create your own dockable control (then you can modify any behavior)... it is http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3843&lngWId=1 

Good Luck
0
 
phucksteppAuthor Commented:
Thanks for that I'll take a look at the code as soon as I can. I had a quick look and it seems it only supports docking to one side of the window, but I'll take a look anyway.
0
 
phucksteppAuthor Commented:
It turns out its the exEdit control (Exontrol) that I use for syntax color highlighting of text files. It seems to steal the focus once when it looses focus. Any other control used allows the docked windows to operate normally.

I'm not sure if theres anything that can be done. I've emailed exontrol regarding the matter and they replied stating that clip controls and clip children should be used, but that doesn't seem to change anything either.
0
 
Shaka913Commented:
Hi, wondering why the grade of C?
0
 
phucksteppAuthor Commented:
Your answer was in the correct area, but I discovered that another control was causing the problem, and therefore didnt need to use the alternative docking routines.

I didn't mean any offence, I just felt that it helped point me in the correct direction to find the problem but didn't entirelly solve my issue.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now