Board index » cppbuilder » CoClass Pointer or Pointer to ActiveForm GUI
Paul Lewi
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
|
Paul Lewi
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
CoClass Pointer or Pointer to ActiveForm GUIStill no luck on getting a pointer to the CoClass of my BCB 4.0 ActiveX Form Please help! (I hope that sounded pathetic.) |
Alex Bakaev [TeamB
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUIPaul, now I'm confused. What are you trying to do ? When VC generates a wrapper, don't you get the whole access to the interfaces of an ActiveX ? Alex QuotePaul Lewis wrote: |
Paul Lewi
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUIYes. I do get access to all the functions in the interface, but I do not get a pointer to the ActiveX Form itself. So for instance if i have 5 controls (TButton for instance) on my form and I want to be able to access each of their Enabled, Visible, Caption, and Hint properties I would have to add methods to the interface for each of them. -- Get and Get (2) for each Enabled, Visible, Caption, and Hint (4) for each of the buttons (5). 2 X 4 X 5 is 40 functions. Thats a lot of functions I would have to write, considering some of my forms have upwards of 40 components on them this would tae quite a while. What would be better is if I could have access to the m_VclCtl variable or a pointer to the coClass itsself from Visual C++ so I could access those properties directly without having to write all the interface functions myself. Can this be done? Alex Bakaev [TeamB] <al...@jetsuite.com> wrote in message Quote> Paul, now I'm confused. What are you trying to do ? When VC generates a |
Alex Bakaev [TeamB
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUIPaul, you could define a method/property that returns the m_VclCtl. But this will be useless in VC++. If may define one big mother of a structure that defines states of all objects on the form and use that to set states of all the objects in single call. Alex QuotePaul Lewis wrote: -- |
Paul Lewi
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUICool! Don't know if this is exactly what you were saying, but after reading your message I came up with the following idea. I added a function to the interface that took 3 BSTR's as inputs. The first was a componentName, the second the Property I wanted to access and the third was the value I wanted to assign to the Property. I then added the following Code to my new interface method. (Long and ugly, but it works!) STDMETHODIMP TPaulActiveXImpl::setComponentProperty(BSTR ComponentName, String property = AnsiString(Property); int numControls = m_VclCtl->ComponentCount; // TMenuITem is the only control that I use that is a // If we are setting the Caption... menuItem->Enabled = boolValue; menuItem->Visible = boolValue; // If we are setting the Caption... // TMenuButton // TSpeedButton // TButton // TLabel } control->Enabled = boolValue; control->Visible = boolValue; if(!success) } Quote}; add one function to each ActiveX Form. And I can cut and paste that! Or possibly inherit it. Of course I will add more properties to my function and maybe add another Could something like this be an enhancement for future versions of BCB? Thanks for all your timely and appropriate help! You have saved me some Thanks again, Paul Lewis Alex Bakaev [TeamB] <al...@jetsuite.com> wrote in message Quote> Paul, you could define a method/property that returns the m_VclCtl. But |
Alex Bakaev [TeamB
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUIPaul, glad you found a solution; this certainly is a good approach. One thing you could add, if needed is a query function that will return all possible names of a component and tha range of values for each. You could use this in a UI, if needed. Cheers, QuotePaul Lewis wrote: -- |
Binh L
![]() CBuilder Developer |
Sat, 19 Jan 2002 03:00:00 GMT
Re:CoClass Pointer or Pointer to ActiveForm GUIThis is the right way to do it. If you need to expose something through COM, especially for "contained" components, you will need to create extra methods/properties/sub-property interfaces to provide access to COM clients. have fun QuotePaul Lewis <sl...@cc.usu.edu> wrote in message Quote> Cool! Don't know if this is exactly what you were saying, but after - Hide quoted text - - Show quoted text - Quote> { |