?
Solved

Form focus and passing click to controls

Posted on 2003-03-19
14
Medium Priority
?
240 Views
Last Modified: 2013-12-16
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
Comment
Question by:phuckstepp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 3
  • +1
14 Comments
 
LVL 3

Expert Comment

by:Diveblue
ID: 8165869
have you tried coding in the forms gotfocus event?
0
 

Author Comment

by:phuckstepp
ID: 8165926
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
 
LVL 3

Expert Comment

by:Diveblue
ID: 8166022
call sub CotrolName_click()
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:phuckstepp
ID: 8166040
Unfortunately I dont know what control is under the mouse at the time.
0
 
LVL 3

Expert Comment

by:Diveblue
ID: 8166157
have you tried using getcursorpos()?
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8166178
activeform.activecontrol
0
 

Author Comment

by:phuckstepp
ID: 8166207
Unfortunately I dont know what control is under the mouse at the time.
0
 
LVL 3

Expert Comment

by:Shaka913
ID: 8166295
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
 

Author Comment

by:phuckstepp
ID: 8166311
Its possible its the exEdit text box control thats stealing the focus, I'm going to have to check.
0
 
LVL 3

Accepted Solution

by:
Shaka913 earned 500 total points
ID: 8166439
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
 

Author Comment

by:phuckstepp
ID: 8166804
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
 

Author Comment

by:phuckstepp
ID: 8172257
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
 
LVL 3

Expert Comment

by:Shaka913
ID: 8194502
Hi, wondering why the grade of C?
0
 

Author Comment

by:phuckstepp
ID: 8195419
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question