Transparency and ClipControls

OK here goes:

  I have an OCX component (VisualWriter by Visual Components Inc. as it happens) which has a property BackStyle which can be set to transparent. The problem is that the component seems to have been written very much with Visual Basic in mind. When I try to set the BackStyle property to transparent I receive a warning telling me to set the Object's container's ClipControls property. This ClipControls property is presumably a VB property and I assume that it is simply an implementation of some Windows API functionality.
  What I need to know is how to replecate this VB ClipControls property within Delphi, such that I can have my transparent component.

  Steven.
LVL 4
StevenBAsked:
Who is Participating?
 
fsanchezConnect With a Mentor Commented:
Hello, Steven. I don't have that component, so I'm not sure if this will work. It seems to me that the property ClipControls is really the CS_CLIPCHILDREN flag, or perhaps CS_CLIPSIBLINGS, or may both. This flags are used in the parameter dwStyle of the CreateWindow function of the Windows API. To change this parameter in Delphi you have (sorry, bad news) to derive your own control from the type of control that you use as container of the VisualWriter component and redefine one method. It's something like this:

...
procedure TXXX.CreateParams(var Params: TCreateParams); override;

...

procedure TXXX.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);

  with Params do
  begin
    Style := Style and ~WS_CLIPCHILDREN;
  end;
end;

In this example I have eliminated the flag WS_CLIPCHILDREN. If this doesn't work, you should try these too:
    Style := Style and ~WS_CLIPSIBLINGS;
    Style := Style and ~(WS_CLIPCHILDREN or WS_CLIPSIBLINGS);

Good luck.
0
 
ywoedtaCommented:
hrmmm - i have plenty of experience with the visual writer in VB, but have not yet used it in Delphi.... what is you planned implementation of the writer?  (I would heavily dissaude you from usuing the component - it is very buggy and not worth nearly the $$ it costs.... for instance, the only thing keeping ym current project from leaving is the fact that visualwriter has not yet fixed a pretty serious memory leak in the writer, causing my program to suck windows into oblivion.  They even admit to the error, but won't fix it "until the next version...")  If you still want to use it, then i'd say to look around the API for clip controls and similar functions and messages.  I'll do some more research on this and get back to you.
0
 
StevenBAuthor Commented:
 Thanks for the words. The reason I'm investigating the VisualWriter is that it seems to be one of the few text editors that scales its fonts correctly in different zoom modes. This is crucial as several of the other I've looked at actually alter the word wrapping at different zooms as the absolute font sizes change, obviously useless. I also require a transparent control and the visual writer seems to at least offer that potential.
  Do you know if the companies other products are equally problem prone? I'm also investigating First Impressions and Formula One. Any more advice and suggestions would be most welcome. If you were to recomend an alternative text editor then what would it be?

  Cheers, Steven.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
ywoedtaCommented:
well, here is my take on the visualwriter situation.... the VisualWriter component was designed to be the main text editing area on a word processing program.  It work pretty well at this, but my company wanted what you describe..  a rich text editor with transparent capabilities that we would use as a large text box.  It DOES NOT function well as this...  if you are looking for a text box style control that would be used more than once per form, then i'd say stay away from the VisualWriter.  If you're making something similar to a word processor / text editor, then go ahead and test away....  As per other components, have you checked out the Delphi Depot and the Deplhi SuperPage for similar, less expensive controls?  (oh - i am going to poke around the API help for getting the visualwriter to be transparent today.... if i figure anything out, then i'll take those points off of your hands for this question ;] )
0
 
StevenBAuthor Commented:
 If you can find out how to effect transparency then you're more than welcome to the points. Keep in touch through these comments, any tips, advice or comments are appreciated.

  Steven.
0
 
StevenBAuthor Commented:
 OK. I've just got back off holiday and I've got a lot of catching up to do, so bear with me and I will get round to checking this. Cheers for your interest.

  Steven.
0
 
fsanchezCommented:
Sorry, I have found a mistake. Please replace '~' with 'not'.
0
 
InteqamCommented:
thanks guys ,

i will appreicate if somebody told me how to set this property (ClipControls )( and make it work ) at run time in a VB project.
0
 
StevenBAuthor Commented:
 Whoah, I thought this thread was long dead :o)


  Sorry, Inteqam, can't help you myself I'm afraid. I never did get to the bottom of this problem, in the end I went for a completely different approach.

  Steven
0
 
InteqamCommented:
thanks alot

i searched for CS_CLIPCHILDREN  along time to find that it is WS_CLIPCHILDREN

:o)

i found it and it worked just fine , thank you again .

but can i ask one last question ,

what are static controls , other than option button and check box?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.