Re: Preventing pasting in a TEdit

not_at_any.adr
Date: 08/04/04


Date: Wed, 04 Aug 2004 12:13:35 -0400

On Wed, 4 Aug 2004 17:57:26 +0200, "Maarten Wiltink"
<maarten@kittensandcats.net> wrote:
>>> Don't mess with standard Windows behaviour.
>>
>> Why not?
>
>Because people then have to learn about it before they can become
>productive again. I do not have much illusions about the skill
>level of the average user, but I'll be damned if I let the few who
>are worth working for be amputated like this.

Almost every program for windows uses subclassing... right click on this
message in OE, Agent, whatever and you're going to see a much larger than
normal edit menu, giving lots and lots of extra activities in addition to the
normal cut/copy/paste offered by the control. THAT is done by subclassing the
edit control, whether transparently by VCL tools or overtly in WinApi
programming it's the same thing.

Not only is subclassing common practice, it's *expected*... produce an
application with no subclassing at all and people will be asking you what's
wrong with the menus within a couple of hours. Others will be crabbing that
Enter doesn't lock text into an edit window or activate a pulldown list
selection... and on and on... all these things are done by subclassing.

>> Windows actually provides all the tools you need to modify the
>> behaviour of any of it's native controls... It's called subclassing
>> or superclassing (depending where you intercept message flow) and
>> it's intended to let you do exactly that.
>
>That it's possible doesn't necessarily make it a good idea.

But it's done, literally all the time.

I don't think I've ever written a single windows program (well, except
"HelloWorld") that hasn't subclassed at least one window.

-----
Laura



Relevant Pages

  • Re: Write onto Active-X Control
    ... Do you have sample-code for subclassing a control in VB? ... >> the to API coords (that twips to pixels thing)? ... Windows API", ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Determine name and path of dropped object?
    ... MDE I would really suggest the use of external DLL to hold the subclassing ... windows after loading the Microsoft Office Visual Basic Editor, ... Public Declare Sub DragAcceptFiles Lib "shell32.dll" _ ...
    (microsoft.public.access.modulesdaovba)
  • Re: Preventing pasting in a TEdit
    ... >the WndProc method or add custom message-handling methods? ... Far and away the largest number of messages going into Windows ... Subclassing is a fairly common and easily enacted way of modifying the ... Now what happens is that instead of the messages for the Edit control going ...
    (comp.lang.pascal.delphi.misc)
  • Re: reading mouse wheel rotation in VB6
    ... gracefully and doesn't give Windows a hissy fit. ... the concept of subclassing should't be that daunting. ... Each object has their own message handler to interpret and handle ... ByVal uMsg As Long, _ ...
    (microsoft.public.vb.general.discussion)
  • Re: How to resolve new "Unable to find file" error with a DLL
    ... That looks pretty cool:) One thing though I think you meant SubClassing as per Windows subclassing//WndProc types of thing, ... Additionally he is working on a complete Unicode widget set, again implemented using pure VB in one COM-dll. ... By the way, Dependency Walker and PE Explorer both suck if there is a dependency on "VC++ 2008 Runtime" and neither of them mention that, when opening up the file. ...
    (microsoft.public.vb.general.discussion)