problem with a component that has other components

Hi ! I am writing a component that has multiple elements inside (edit, buttons etc).
I started with TWinControl and then created inside TEdit and other elements.
The problem: when window below my component is updated, the Edit does not repaint (looks transparent).
Apparently I violate the paint message propagation ... Please help me! Also let me know if there are better ways to make such a control. 
Boris
0
Boris
12/3/2010 7:48:56 PM
embarcadero.cppbuilder.writing 359 articles. 0 followers. Follow

5 Replies
1360 Views

Similar Articles

[PageSpeed] 55
Get it on Google Play
Get it on Apple App Store

<Boris Epel> wrote in message news:310889@forums.embarcadero.com...

> I started with TWinControl

Consider deriving your main component from TPanel or TFrame or some other 
container, instead of TWinControl directly.

-- 
Remy Lebeau (TeamB)
0
Remy
12/3/2010 10:33:55 PM
Thank you, Remy.
> Consider deriving your main component from TPanel or TFrame or some other 
> container, instead of TWinControl directly.

TPanel container works the same like TWin Control (edit disappears until it forced to repaint).
When I put my control on Form - no problem. When I use control as a child on a stringgrid to edit a cell and grid is updated later then my control
the Edit is not repainted. Funny enough buttons are fine. Panel itself is also fine. May be it is a Windows bug ...

Regards,
Boris
0
Boris
12/4/2010 12:53:47 AM
<Boris Epel> wrote in message news:311013@forums.embarcadero.com...

> TPanel container works the same like TWin Control
> (edit disappears until it forced to repaint).

Then you are likely not setting up the components correctly to begin with. 
Please show your actual code.

-- 
Remy Lebeau (TeamB)
0
Remy
12/6/2010 7:23:33 PM
Hi Remy,
The control is derived from TPanel, beside TEdit a custom made button is added.
everything else is painted directly on TPanel in Paint
other functions are keyboard events.
Boris

..h
class PACKAGE SSpinEdit : public TPanel
{
private:
    SSpinButton *FButton;
    TEdit       *FEdit;
....
    void __fastcall ChangeControlLayout(void);
    void __fastcall Paint(void);
}

..cpp
__fastcall SSpinEdit::SSpinEdit(TComponent* Owner)
        : FEdit(NULL), FButton(NULL), TPanel(Owner)
{
  FButton = new SSpinButton(this);
....
  FEdit   = new TEdit(this);
  FEdit->Visible = true;
  FEdit->Parent = this;
  FEdit->OnKeyDown = EditKeyDown;
  FEdit->OnKeyUp = EditKeyUp;
  FEdit->OnKeyPress = EditKeyPress;
  FEdit->OnChange = EditChange;
  FEdit->ParentFont = true;
....
}


void __fastcall SSpinEdit::ChangeControlLayout(void)
{
....
    FButton->SetBounds(0, 0, Height, Height);
    FEdit->SetBounds(Height, 0, btn_shift, Height);
....
}
0
Boris
12/6/2010 9:20:16 PM
<Boris Epel> wrote in message news:311476@forums.embarcadero.com...

> The control is derived from TPanel, beside TEdit a
> custom made button is added.

If that is all the component consists of, then I would suggest deriving from 
TEdit directly instead, and let it manage its own associated button (much 
like the VCL's own TLabeledEdit and TButtonedEdit components do), eg:

{code:cpp}
class PACKAGE SSpinEdit : public TEdit
{
    typedef TEdit inherited;

private:
    SSpinButton *FButton;

    MESSAGE void __fastcall CMEnabledChanged(TMessage &Message);
    MESSAGE void __fastcall CMVisibleChanged(TMessage &Message);

protected:
    virtual void __fastcall Notification(TComponent *AComponent, TOperation 
Operation);
    virtual void __fastcall SetBounds(int ALeft, int ATop, int AWidth, int 
AHeight);
    virtual void __fastcall SetParent(TWinControl *AParent);

    DYNAMIC void __fastcall KeyDown(Word &Key, TShiftState Shift);
    DYNAMIC void __fastcall KeyUp(Word &Key, TShiftState Shift);
    DYNAMIC void __fastcall KeyPress(Char &Key);
    DYNAMIC void __fastcall Change();

public:
    __fastcall SSpinEdit(TComponent *Owner);

    BEGIN_MESSAGE_MAP
        VCL_MESSAGE_HANDLER(CM_ENABLEDCHANGED, TMessage, CMEnabledChanged)
        VCL_MESSAGE_HANDLER(CM_VISIBLECHANGED, TMessage, CMVisibleChanged)
    END_MESSAGE_MAP(TEdit)
};

__fastcall SSpinEdit::SSpinEdit(TComponent* Owner)
    : TEdit(Owner), FButton(NULL)
{
    FButton = new SSpinButton(this);
    FButton->FreeNotification(this);
    ParentFont = true;
}

void __fastcall SSpinEdit::CMEnabledChanged(TMessage &Message)
{
    inherited::Dispatch(&Message);
    if( FButton ) FButton->Enabled = Enabled;
}

void __fastcall SSpinEdit::CMVisibleChanged(TMessage &Message)
{
    inherited::Dispatch(&Message);
    if( FButton ) FButton->Visible = Visible;
}

void __fastcall SSpinEdit::Notification(TComponent *AComponent, TOperation 
Operation)
{
    inherited::Notification(AComponent, Operation);
    if( (AComponent == FButton) && (Operation == opRemove) )
        FButton = NULL;
}

void __fastcall SSpinEdit::SetBounds(int ALeft, int ATop, int AWidth, int 
AHeight)
{
    FButton->SetBounds(ALeft, ATop, AHeight, AHeight);
    inherited::SetBounds(ALeft + AHeight, ATop, AWidth - AHeight, AHeight);
}

void __fastcall SSpinEdit::SetParent(TWinControl *AParent)
{
    inherited::SetParent(AParent);
    if( FButton ) FButton->Parent = AParent;
}

void __fastcall SSpinEdit::KeyDown(Word &Key, TShiftState Shift)
{
    ...
    inherited::KeyDown(Key, Shift);
}

void __fastcall SSpinEdit::KeyUp(Word &Key, TShiftState Shift)
{
    ...
    inherited::KeyUp(Key, Shift);
}

void __fastcall SSpinEdit::KeyPress(Char &Key)
{
    ...
    inherited::KeyPress(Key);
}

void __fastcall SSpinEdit::Change()
{
    ...
    inherited::Change();
}
{code}

-- 
Remy Lebeau (TeamB)
0
Remy
12/6/2010 10:51:27 PM
Reply:

Similar Artilces:

Components in Components
I'm finishing up on a component that I've been creating at run-time but thought I'd go ahead and compile it and add it to my palette. The component contains a number of TPersistent components and a couple of TComponents. It's working well, and it compiles OK, but in the Object Inspector each of the TComponent properties has a drop-down control next to it, as if I was supposed to pick a component from a list. What is going on with this? Do I need to define the owner differently, or specify a parent-lik e object? I'd rather it just list the name of the class, like how i...

Having problems with Components that use other Custom Components [Edit]
I need to understand how the components work and interact with each other better. I have three components that I have created for my software so they can be included in a bunch of related applications. Host.bpl - Low level Disk I/O, Licensing, INI file functions, encryption, etc. Database.bpl - Database functions for many different databases Resource.bpl - GUI level functions. Any visual components My Database component uses the Host component for some of its functions My Resource component uses the Host and Database component functions All I need to place on my high level applicati...

Problem : Components disappearing from component palette in D7
Having recently installed my D7 on a new PC (WinXp pro) I've experienced problems when trying to (re)install 3'rd party components. These components are : Quick Report - which is shipped with the D7, but needs to be manually installed - and a series of "skinning" components from "alphacontrols". Installation of the said components seems to work just fine as they initially show up on their respective pages on the palette. However, when I exit and restart D7, the components have disappeared from the palette. When I open the palette configuration tool (Component - ...

Problems deriving a component from another derived component.
I have been learning how to write components in Delphi Rad Studio 2007 and during one of the examples I encountered a fustrating problem. In this example I made a new component that was derived from TComponent, Added some code to modify the component slightly. I installed it and it seemed to function correctly. The next step was to derive a component from my derived component, then add some code to override an existing procedure. This all seemed to function correctly, meaning that when I did file -->> New Package and then added a new VCL Component, I could select my initial component f...

problem writing basic component
Hi, I'm having trouble trying to write a basic component. Effectively the component simply stores values so I can see if those values exist first from other forms, and if they do - I can obtain the value. This is my workaround I'm trying to the "Sharing data / variables between various units" I posted on earlier. The problem that I have with the component is that the constructor runs if I create the component dynamically at runtime, but it won't run if I place the component on the form at design time. Therefore one of the properties is not initialize...

How to do a component containing other components
Hello, I try to create a Component from TPanel that contains a tool bar and other components my problem is to access to the tool bar at design time mainly to edit the menu allowing to add a button and after that to access the button itself here's my first version: class PACKAGE TPan_Viewer : public TPanel { private: TToolBar *ToolBar1; TButton* Bout1; protected: public: void __fastcall OnClickButton(TObject *Sender); __fastcall TPan_Viewer(TComponent* Owner); __published: __property TButton* Button={read=Bout1,write=Bout1}; __property TTool...

Component to component method call passing a component reference.
From all investigation this seems like something I should be able to do, but.... I have a stateless component named "n_manager" that through createinstance() gets references to three stateful components named "n_comtest1", "n_comtest2", and "n_comtester". I then wish to call a method on the instance of "n_comtester" passing the references to "n_comtest1" and "n_comtest2". The IDL generated for the "of_test" function I'm calling is: interface n_comtester : n_combase { string of_test...

Components calling other components
Hi, I have a Java component that calls methods on other Java components inside Jaguar (2.0 on NT). To do that I had to insert the Jaguar iiop address in the calling component code. Is there any other way to do that? Maybe some function that gets the current environment (Name Server)? thanks Eduardo Kamada On intercomponent calls, and you can see SVU for an example. You dont need to create a Manager and Session for an intercomponent call, as the in process orb can verify user credentials that were passed to the root component. The intercomponent call would look like ...

Problem initiating / calling PB SHARED component from another PB component
Dear Experts, I run EAServer 5.2 with PBVM 9.0.1 build 7151 on Windows 2003. I try to use a JSP to call a PowerBuilder component "comp1" which in turns calls another PowerBuilder SHARED component "comp2". "comp1" and "comp2" belong to the same package "package1". However, "comp1" fails to initiate / call "comp2". The calling thread just hangs and does not return. Nevertheless, I can use the JSP to directly call the PowerBuilder SHARED component "comp2" without any problem. Besides, once I have s...

problem with component
after changing script of any NVO, in spite of recreating component project and proxy server project sometimes the effect of new scripting doesnt show effect after deployment. why is it like that? and the size of forms differ from designtime after deploying it to the web. how can i cope up with this situation? ...

asp component or html component?
hey guys, i was just wondering, if no postback has been used, which component has a better performance? <input type="text" id="HiddenText" name="HiddenText" runat="server"/> <asp:textbox ID="HiddenText" runat="server"/> i can both get the data from the server side, so is there any difference? Generally, the HTML Controls have less overhead than the Web Controls.RegardsAndre Colbiornsen ---------------------------------Seventh DayRåbygatan 1A,SE-223 61 LundSwedenMob.: +46-(0)708-97 78 79Mail: info@seventhday...

date component and rtf component
hi 1. I need a component for data(calendar style)for asp.net that he has supported mask 2. I have a field in my data base that is with texts in rtf format. FIELD IN DATABASE: {\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset0 Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\g...

component problem
Hi everybody, I am having a problem using Jaguar component built with PB7. The datastore.print() command always returns -1. Is this known Jaguar bug or it is some special server setting ? Does anybody had similar experince? Thanks for any help. Dear Valued Sony Customer ~g~ Using EAS 3.0.1 I am able to execute ds.Print() just fine and it spits out my report. You may want to contact Tech Support @ Sybase to help you trouble shoot this since there isn't much code that we can tweak in this situation. Jason -- Jason R. Weiss CPD-P, CPI, MCT, MCSE Wiseman Technologies, In...

Component problem
Hi I have create a package and I have succesfully insert five components from class files. I also generate stub and Skeleton. But when I try to insert a new Component form a Class file that uses the clas java.util.Timer the EAS complains that it can't find this class. I have verified that the EAS starts with JDK1.3 but it still not working? Any ideas? Thanks Matias I believe this has something to do with JagManager, which uses jdk 1.2.2, and since Timer was not added until 1.3, JagManager cannot find the class. Now as to why JagManager is even involved in the hangup...

How to read Component Property (from the component itself)
I am using this code to read a Jaguar Component Property (from the Component itself) : private String getProperty(String _s) throws javax.ejb.EJBException, com.sybase.jaguar.util.JException { String propVal = null; try { powersoft.powerj.jaguar.InitialContext ctx = new powersoft.powerj.jaguar.InitialContext (); propVal = (String)ctx.lookup(_s); } catch (java.lang.Exception e) { com.sybase.jaguar.server.Jaguar.writeLog(true, getClass().toString() + e.toString()); } return (propVal); } ...

Component problem..
I have created a upload, download files component. And thats working perfectly on server.(even on ms xp and ms xp home edition) But on client machine this component does not appear I made him check the options under tools .security tab..custom level----- everything is perfect in his machine. I also made him delete if that component exists in c:\windows\downloaded program files. But in vain. Anybody knows whats the problem? Its urgent bcoz client is waiting for that only every other thing is ready. Any help would be appreciated....

Component problems.
I have a component built with Power++ 2.1. It works fine. I got a new machine, loaded Power++ on drive C instead of D (like it was on my old machine), restored my source code to drive D, and loaded my component project. It compiles fine. However I can't "Run" it to get it to install. I get Can't create directory 'D:\Program Files\Powersoft\Power21\Projects\JFCLib\\' So I hunted down all the files that contained D:\Program Files and changed them to C:\Program Files. There were hard-coded paths in wxc, wxt, and wxu files! Now it installs fine. ...

Linking a component to another component
Hi, I'm trying to link a component to another one by its pointer, wich means that whe I create the component it creates 3 other components, and when I destroy it it destroys the other compoents associated example: I'm using this: type TSystem = class(TComponent) private F1, F2, F2: TButton; FPanel: TPanel; procedure SetPanel(Panel: TPanel); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property Panel: TPanel read FPanel write SetPanel; <- when I get a new panel, it crea...

How to create a component within a component
Any idea where I can find some info on how to create a component within a component. What I mean is a like the TRibbon. You can create a TRibbonPage and TRibbonGroup at design time. You can even play and move the TRibbonGroup at design time. The component I have created is okay but I cannot move it. The only reading I have is Programming Delphi Custom Components published in 1996. Thanks in advance. Peter. "Peter Herijgers" <spam@unipro-tech.com> wrote in message news:303051@forums.embarcadero.com... > The component I have created is okay but I &g...

Component that references another component
Hi, I have implemented two components, TCOMPort and TCOMIndicator. TCOMPort has a property named CTSIndicator written as follows. __property TCOMIndicator *CTSIndicator = {read = FCTSIndicator, write = FCTSIndicator, default = NULL}; For a TCOMPort component, the CTSIndicator property appears in the object inspector as expected and I am able to select any TCOMPortIndicator objects as expected. If, after selecting TCOMIndicator component, I then delete the TCOMIndicator component from the form I get an access violation, which is not totlly unexpected since the property that was assi...

Components disappear from the component palette
Hi, I have a project containing a run-time and design-time package plus a test application which all build as expected to reveal three components on the component palette. If I now close BCB6 down and then re-open it, the components are no longer there. I need to select Component|Install packages|Design Packages... and re-apply the check mark next to my component package. I recall that I had this problem quite some time ago and was able to resolve it by moving my component tab to the left-most position on the component palette. Until recently this has worked fine (but never did get to ...

.net component to Delphi component ?
Hello, Is there a way to use .net component inside Delphi ? Thanks On Tue, 18 Nov 2008 13:16:37 -0800, isaac sam wrote: > Is there a way to use .net component inside Delphi ? http://www.managed-vcl.com/ has some libraries for this. -- Marc Rohloff [TeamB] marc -at- marc rohloff -dot- com Marc Rohloff wrote: > On Tue, 18 Nov 2008 13:16:37 -0800, isaac sam wrote: > >> Is there a way to use .net component inside Delphi ? > > http://www.managed-vcl.com/ has some libraries for this. > I was hoping for a free tool but thanks On Tue, 18 Nov 2008...

Instanciating components from service component
Im trying to instanciate a PB component from a javaservicecomponent. I can see in the log that the servicecomponent is starting but when instanciateing pb comp A which intanciates pb comp B I get this error in the logfile: SRVLIB Message: 16253/10/0: srv_thread_props(): property SRV_T_USER not valid for service thread Any id�a?? TIA, Darko Guberina ConNova Systems This is a known bug in the GA release which is fixed in the upcoming maintenence release. For a workaround until the fix, dont make the intercomponent call using the TransactionService, instead connect like from ...

Component to host VCL component
In the old days, when FireMonkey was still VGScene, we had a nice component that would host any good old VCL component. Very practical. How is this achieved with FireMonkey? I'm not interested in any cross-platform stuff, just want to use it on Windows. ...

Web resources about - problem with a component that has other components - embarcadero.cppbuilder.writing

Component - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

DPRK may have tested components of hydrogen bomb
DPRK may have tested components of hydrogen bomb

It’s a new year, and time for the claimed iPhone 7 component photos to begin
Taiwanese site Apple Club has posted what it claims are leaked photos of iPhone 7 components. The photos appear to show the backlight of a new ...

Waterproof components listed for Galaxy S7 on import tracking site
... at least water-resistant – rumors are starting to look increasingly solid. Import tracking site Zauba has revealed several “waterproof” components ...

Lumentum, Fabrinet: Component Makers at Start of 5-Year Boom, Says Needham
Needham & Co .’s Alex Henderson today advises fiber optics enthusiasts to look to component makers , such as Lumentum ( LITE ), in 2016, more ...

The hidden story of one of the iPhone’s most important components
... it’s probably the software and the ecosystem around it that stand out. But to make all this software magic possible possible, there’s one component ...

A fundamental component of the 'Making a Murderer' mystery relies on a single test — here’s what we know ...
The moment viewers think the tide could change in the trial of Steven Avery comes with the discovery of a hole in a tube. Avery, the subject ...

Auto Expo 2016 - The Motor Show & Components, Delhi,India - Business Standard
Get latest Cars, bikes, auto vehicle launches and News on The Motor & Components Show from Auto Expo 2016. Get exclusive updates for car, bike ...

North Korea may have tested components of H-bomb
U.S. officials now believe that North Korea may have tested components of a hydrogen bomb at an underground facility on January 6. CNN's Barbara ...

John Ridley Extends ABC Studios Deal For Three More Years; Film Component Added
John Ridley and his production arm, International Famous Players Radio Picture Corporation, have extended their first-look deal with ABC Studios ...

Resources last updated: 2/18/2016 3:53:00 PM