Re: Preventing pasting in a TEdit
From: Duncan McNiven (duncan_at_mcniven.net)
Date: 08/05/04
- Next message: J French: "Re: How to do this. Search and list HD or CD?"
- Previous message: jOhN: "Re: Need help: IE pop-ups with WebBrowser component"
- In reply to:(deleted message) not_at_any.adr: "Re: Preventing pasting in a TEdit"
- Next in thread: Rob Kennedy: "Re: Preventing pasting in a TEdit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 05 Aug 2004 06:56:03 +0100
On Wed, 04 Aug 2004 17:53:15 -0400, not@any.adr wrote:
>On Wed, 04 Aug 2004 19:06:55 +0100, Duncan McNiven <duncan@mcniven.net> wrote:
>
>>You are mistaken there. Take your C/C++ hat off for a moment and look at
>>things the Delphi way <g>
>
>I wouldn't know how to write the first line of code in C++ ... so lets not go
>there, ok?
Yet you are writing your code with mindset, ignoring the benefits of the
RAD tool you are using. For the vast majority of tasks that is simply
inefficient and not necessary. Fast forward a decade or so and come up
to the present.
>>You can add a method to handle the WM_PASTE message (yes, it _does_ go
>>to the TEdit) and prevent pasting that way.
>
>In the underying code that amounts to the same thing I was suggesting.
The effect is certainly the same, but it is achieved in quite a
different way. Anyone maintaining apps written with your approach would
find it harder to locate the code in question, would require a greater
knowledge of Windows, and risk introducing bugs into other
functionality. Your approach is expensive up front and asking for
problems and costs down the line.
>>Very easy to do, using very
>>obvious, isolated/self-contained code that is easy to maintain, and
>>avoids having to go anywhere near the windows procedure for the control.
>
>Well, actually not true... the TEdit control subclasses the underlying windows
>Edit control for you.
Exactly; you don't have to bother with all that crap yourself. You just
add a procedure to handle that one message. Very easy, very clear,
maintainable by any junior programmer who picks up your code without
risk to the mountain of code that would inevitably get put into WndProc
if you do anything major via the sub-classing route.
>>There has always been a better way using the Delphi approach.
>
>And, for many things, there has always been a better way THAN using the Delphi
>approach [grin]. No one approach or language is ever adequate to all tasks.
No tool is best for everything, obviously, but ignoring the benefits of
the tools you use is, shall we say, perverse. Then to say that the
normal Delphi approach used by just about every other Delphi programmer
on the planet is not possible ... oh I get it, this is a troll. OK, you
got me.
-- Duncan
- Next message: J French: "Re: How to do this. Search and list HD or CD?"
- Previous message: jOhN: "Re: Need help: IE pop-ups with WebBrowser component"
- In reply to:(deleted message) not_at_any.adr: "Re: Preventing pasting in a TEdit"
- Next in thread: Rob Kennedy: "Re: Preventing pasting in a TEdit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|