[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: QtDesigner/Glade
From: |
Chris Hanson |
Subject: |
Re: QtDesigner/Glade |
Date: |
Wed, 16 Jan 2002 16:28:54 -0600 |
At 2:30 PM +0000 1/16/02, Richard Dale wrote:
Qt Designer assumes event handling would be done in the Qt style, which is
much the same as the AppKit - ie you subclass a widget to do event handling
rather than add event listeners like Java.
This isn't at all what AppKit event handling is like.
Well, I suppose it depends what you mean by "event handling."
If you mean "you subclass NSResponder to handle particular low-level
NSEvents (mouse clicks, keystrokes, etc.) or pass them up the chain"
then what you've said is correct.
However, if you mean "you subclass NSButton to handle when the user
clicks on a button" then it's completely incorrect. In the AppKit,
all NSControl implements the target-action design pattern for its
subclasses. You use -[NSControl setTarget:] to set the object that
should receive an action message and -[NSControl setAction:] to set
the action the target should receive. Actions are invoked by
low-level human interface events, but you only truly need to worry
about these events when you're implementing a brand new type of
control.
Yes, the AppKit itself doesn't have any runtime support for outlets and
actions, that is only done in InterfaceBuilder I think.
Incorrect. The target-action design pattern is implemented by
NSControl, and the setting outlets in an object can be done via
key-value coding.
It's true that Interface Builder parses header files to determine
what the outlet instance variables and action methods in a class are;
there's no runtime support for getting an array of SELs corresponding
to action methods, or for getting an NSArray of outlet keys. But the
nib loading code can use built in AppKit and FoundationKit
functionality to perform the outlet and action manipulations that are
recorded in a nib file.
-- Chris
--
Chris Hanson | Email: cmh@bDistributed.com
bDistributed.com, Inc. | Phone: +1-847-372-3955
Making Business Distributed | Fax: +1-847-589-3738
http://bdistributed.com/ | Personal Email: cmh@mac.com