Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vamp, Strongm, others... please read

Status
Not open for further replies.

TheTuna

Programmer
Dec 13, 2002
544
US
In a previous thread (thread222-543543) I asked a question about stopping a VB Developed OCX from firing a Validate event.

Said OCX doesn't have a CausesValidation property, and it does not get focus, yet it still causes the Validation event to fire.

How might I stop the OCX from doing this?

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Tuna,

The CausesValidation property is actually part of the Extender, which is a wrapper around the user control ( OCX ) that you have. All of the user control properties are passed through the extender to the control itself.

Although I just guessing here, you might try putting this code in the Show event for the OCX:

Extender.CausesValidation = False

And see if that helps.

I'll dig a little more and see if I can find anything else.

Robert
 
Thanks! It's been a while since I've read anything on deving OCX's, but now I remember... I'll have to find my books and actually read them.

If you find anything more on this, I'll sling a star your direction Vamp... and of course, I'll try your suggestion right away.

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Well, that won't work, but I'm closer now to getting it at least. MS Help says about extender:

Returns the Extender object for this control that holds the properties of the control that are kept track of by the container. The Extender property is not available at the control’s authoring time, and read-only at the control’s run time.

CausesValidation isn't extended in this case, because the ocx doesn't get focus (an assumption). I've not tested the ocx with CanGetFocus = True, but I will, in order to test my assumption. Back in a second or two...

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Tuna,

According to my reference book, the extender properties are modifiable at run time. You can have the control move itself and other things through the extender object.

Actually, the OCX can get focus. It has an internal GotFocus event that only fires if none of the internal controls of the OCX can get focus ( which is what I remember your other post saying is the case ).

The extender itself also has a GotFocus and LostFocus event.

Robert
 
I'll look into it further as well...

Again, my OCX's .CanGetFocus propert = False... it uses two intrinsic controls, neither of which can get focus either, they are a label and an image control. Both will receive click events, but neither can get focus.

This is necessary to keep the OCX from getting focus, since all it does to act as a keyboard is sendkeys. It doesn't even know which control has the focus, it just blindly sends to wherever the focus is. It works surprisingly well. The only problem I've ever had, is this issue, which only becomes a problem if I'm trying to validate that the text box is not empty.

The gotfocus event of the OCX never fires, I tested it...

Thanks again for your efforts... lets continue, because I really want this to work, and I beleive we're on the right track.



[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Well, I'm off for the day. Got to see if I have to swim home or not ( it's been raining almost non stop for the last 3 days... )

Good luck and let us know how it goes.

Robert
 
Looks to me like Properties, Methods and Events extended via the extender can be modified at run-time, but the extender itself isn't available.

[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top