-
Subclassing...
What the heck is that? Can somebody explain?
I have studied subclassing in Java and I know OOPS fairly well. Only I have no experience of it with VB.
More specifically I want to extend the features of a textbox that's within an ActiveX control. Certain properties of the textbox, such as Multiline, Scrollbars etc. are unavailable even inside the ActiveX control as these are readonly at runtime. I want to manipulate them.
.
-
Win32 subclassing means that you intercept messages to the control/window before they get processed and do something with it. For example if you want to change a natural behavior of a certain window/control, or to add functionality which is not exposed to the control.
-
Well ...
Thanks.
After posting that I scouted around the net and looked at a few sites with material on subclassing. It essentially is a technique of putting in your own message handler instead of the concerned window's default one.
Can you or anyone else then explain how I can get around my problem? I am using a textbox in my activeX control and I want to enable the properties such as Multiline or Scrollbars of the textbox when my ActiveX control will be in design/run mode. But as soon as the ActiveX control is being used in another form in the IDE design mode, it is in Run mode, and the textbox therefore does not let me change the Multiline and Scrollbars property, as they are read-only at runtime. Is there any way I can subclass or use an API function to set these properties on the textbox within my ActiveX control?
.
-
This could be a hassle. Probably the easiest way to get around your problem is to have 2 textboxes. One that is single lined and the other one as multilined. Then just show the appropriate one depending on the property value. This technique will actually allow you to change style in runtime.
-
Well ...
I thought about it for a while, but I think I could do it using some SendMessage option. Is that possible?
Since I am replicating most of the properties of the textbox, using two boxes means I shall have to set any property on both the textboxes.
Then again, for Multiline, I shall need two boxes, then for the various values of Scrollbars and other design-time properties it soon is more than I can manage.
.