Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ActiveX controls always on top
Message
 
To
05/10/1998 14:53:16
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00143914
Message ID:
00144023
Views:
32
Hi Robert,

>The only luck I've had is that ActiveX controls (at least so far) seem to behave w/respect to each other. They just don't like dealing with VFP controls.

One of the next issues of Ask Advisor (I think December) deals with this problem...

The reason that you can't display a VFP control on top of an ActiveX control is that, as David pointed out, VFP's controls are no real windows controls. Lets take a look at it from the other side: ActiveX controls are windows that are displayed inside another window, that is the form. To get a control on top of an ActiveX you have to make that control a window as well.

That sounds harder than it actually is. Just define a new form, remove the caption, the titlebar, the border and everything that makes up a form. Then add you control to that form and resize the form so it has the same size as the control. The result is something that looks like a control, but is really a form, or IOW a window control.

Then open the form with the ActiveX control and add a new property oControl to it. In it's init write code like this:
With This
   .oControl = CreateObject("FrmWithOtherControl")
   Activate Window (.oControl.Name) in Window (.Name)
   .oControl.Left = ....
   .oControl.Top = ....
   .oControl.Visible = .T.
Endwith
The key line here is Activate Window. With this line you display the control with the form within the original form and therefore on top of any control that's in it.

One problem is still that the window control is not in the taborder. If you need this as well, add a line like this in the GotFocus of the control that's the previous one in the tab order:

Thisform.oControl.NameOfControl.SetFocus

Add another control to the window with that control that is outside the visible area. It could be any control, the only reason is that you need its GotFocus event. In the GotFocus event of that control set the focus to the control that is the next one in tab order. You need a reference to that control, so you have to pass it to the init of the second form.

Well, that's the short version.

Christof
--
Christof
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform