 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andreas Krügersen Guest
|
Posted: Fri Aug 08, 2003 2:32 pm Post subject: Editing borderstyle disables edit control functionality?! |
|
|
Hi,
I'm trying to write a simple modification of the standard edit control.
It should hide its border when it is not focused.
So I've written a new component and overridden the two event
handlers OnEnter and OnExit like this:
procedure TStealthyEdit.DoEnter;
begin
inherited DoEnter;
BorderStyle := bsSingle;
end;
procedure TStealthyEdit.DoExit;
begin
inherited DoExit;
BorderStyle := bsNone;
end;
Now I've discovered two problems when setting a focus on the control:
1) While it updates its border correctly, I can no longer edit its content
I cannot even select text inside the control.
2) When the modified edit control resides inside a panel, the text is not
shown
either.
The same problem occurs when I write an event handler for OnExit and
OnEnter for
a normal edit control.
But strangely it only happens when editing the BorderStyle inside the
handler. When changing the color for example, all works fine.
So what's happening here? I'm using Delphi 5.
regards
Andreas Krügersen
Projecteam
www.projecteam.de
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
| Back to top |
|
 |
Andreas Krügersen Guest
|
Posted: Fri Aug 08, 2003 3:48 pm Post subject: Re: Editing borderstyle disables edit control functionality? |
|
|
Little Update:
It seems that I can still edit the control's contents
but the caret is not shown anymore. I can enter and select text
blindly and see the results but I don't see the caret or the
actual selection.
Strange however, when I switch to another task and back to
my app, the caret is there!
So what does OnEnter do with the Caret? I've even tried to use
MouseDown for showing the border. But since it works only for the mouse,
it is no real solution.
regards
Andreas Krügersen
Projecteam
www.projecteam.de
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
| Back to top |
|
 |
Rob Kennedy Guest
|
Posted: Fri Aug 08, 2003 6:59 pm Post subject: Re: Editing borderstyle disables edit control functionality? |
|
|
Andreas Krügersen wrote:
| Quote: | Now I've discovered two problems when setting a focus on the control:
1) While it updates its border correctly, I can no longer edit its content
I cannot even select text inside the control.
2) When the modified edit control resides inside a panel, the text is
not shown either.
|
When you change the BorderStyle property, Delphi actually destroys the
existing window and re-creates it with the new window style. Delphi does
its best to transfer all the attributes from the old window to the new
one, but doing that while in the middle of a focus-changing sequence can
cause major problems for Windows.
You may be able to work around the problem. Instead of setting the
BorderStyle property, change the underlying window style directly using
the SetWindowLong API function. Set or clear the ws_Border flag accordingly.
--
Rob
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|