That could also be done by keeping an invisible
Combobox on the form and making visible when the TEdit
receives focus. You would have to make it's clientRect
area match the TEdit's is all. This is done for
inplace Editing in a DBGrid and there's a good article
on Delphi.About with source code. You could customize
that to your needs quite easily. I'm not trying to
distract you from creating a new component though if
that's what you want to do.

DJS

--- Paul Bennett <[EMAIL PROTECTED]> wrote:

> My current project requires me to create a custom
> control to provide a required 'look and feel' to the
> data entry forms.
> 
> This look and feel involves having a control that
> appears to be a standard TEdit when it has not got
> the focus, but on receiving focus changes to a
> standard ComboBox!
> 
> I have not done any custom control programming
> before. I have started with deriving from
> TCustomEdit and adding a private TComboBox field.
> I have then tried to expose the Items property
> (using Getter/Setter routines) I get an error
> message telling me that the control has no parent
> window. I have tried assigning the parent in the
> constructor, but no good.
> Below is the Constructor code plus the
> Getter/Setters:
> 
> constructor TtwsEditCombo.Create(Owner: TComponent);
> begin
>   inherited Create (Owner);
>   fCombo := TComboBox.Create(Self);
>   fCombo.ParentWindow := Self.ParentWindow;
> end;
> 
> function TtwsEditCombo.GetItemIndex: Integer;
> begin
>   Result := fCombo.ItemIndex;
> end;
> 
> function TtwsEditCombo.GetItems: TStrings;
> begin
>   Result := fCombo.Items;
> end;
> 
> procedure TtwsEditCombo.SetItemIndex(const Value:
> integer);
> begin
>   fCombo.ItemIndex := Value;
> end;
> 
> procedure TtwsEditCombo.SetItems(const Value:
> TStrings);
> begin
>   fCombo.Items := Value;
> end;
> 
> Any pointers would be most gratefully received.
> 
> Paul.
> 
> Experience is something you don't get until just
> after you need it. 
> 
> 
> -- 
> _______________________________________________
> Surf the Web in a faster, safer and easier way:
> Download Opera 8 at http://www.opera.com
> 
> Powered by Outblaze
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to