ICnrEditHandler

The ICnrEditHandler class supports direct editing of data in the container.

Create a handler derived from ICnrEditHandler and attach it to the container whose data is to be edited. You can do this by calling ICnrEditHandler::handleEventsFor to pass the container or the container's owner window to the container edit handler.

ICnrEditHandler processes the following events from the container:

When the container edit handler receives one of these container edit events, it creates a corresponding event object and routes that object to the appropriate ICnrEditHandler virtual function. You must override these virtual functions to supply your own specialized processing of a container edit event. Note that when overriding beginEdit, you must call the base class function ICnrEditHandler::beginEdit before adding your own behavior. If you override endEdit, you must call the base class function ICnrEditHandler::endEdit after you complete your processing.

The return value from the virtual functions specifies whether the container edit event should be passed on for additional processing, as follows:

Return Value :ddhd.Meaning
true
The container edit event requires no additional processing. Do not pass it to another handler.
false
Pass the container edit event to the next handler for additional processing, as follows:
  • If there is another handler for the container, pass the container edit event to the next handler.
  • If this is the last handler for the container, call IWindow::dispatch to dispatch the container edit event to the container's owner window.
  • If this is the last handler for the owner window, call IWindow::defaultProcedure to process the container edit event.


ICnrEditHandler - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~ICnrEditHandler
public:
virtual ~ICnrEditHandler()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ICnrEditHandler
public:
ICnrEditHandler(StringType stringType = isIString)

You can only construct instances of this class by providing the type of the user data that needs to be edited. The data can be one of the types specified by the StringType enumeration.

The default behavior of this class provides for the reallocation of the user data. The default behavior of this class also manages the allocation of other types of editable data, such as the following:

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Dispatching

Use these members to implement the class.


[view class]
handleEventsFor
public:
virtual ICnrEditHandler& handleEventsFor( IContainerControl* container )

Attaches the handler to the specified container control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
stopHandlingEventsFor
public:
virtual ICnrEditHandler& stopHandlingEventsFor( IContainerControl* container )

Detaches the handler from the specified container control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
dispatchHandlerEvent
protected:
virtual bool dispatchHandlerEvent(IEvent& event)

If a container edit event is found, the appropriate event processing virtual function is called.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Processing

Event-processing members must be supplied by a derived class to provide additional processing for an edit event.


[view class]
beginEdit
public:
virtual bool beginEdit(ICnrBeginEditEvent& event)

Called when an edit window has been opened in the container. The default behavior creates an IMultiLineEdit object by calling ICnrEditHandler::multiLineEdit. If ICnrEditHandler::setMLEHandler has been previously called to store an edit handler, the handler is added to the IMultiLineEdit object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
endEdit
public:
virtual bool endEdit(ICnrEndEditEvent& event)

Called when editing has ended. This is received after reallocateString is called.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isDataIString
public:
bool isDataIString() const

If the user data is type IString, true is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
reallocateString
public:
virtual bool reallocateString( ICnrReallocStringEvent& event )

Called when text has been modified in the container and storage needs to be reallocated. If the data is an IString, the reallocation is provided by calling ICnrReallocStringEvent::reallocateString. If the data is of the type isCharacterPointer, the reallocation is provided by calling ICnrReallocStringEvent::reallocateText.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Multiline Edit Processing

Use these members to enable processing of events to the container's edit field.


[view class]
mleHandler
public:
IHandler* mleHandler() const

Called to return the handler for a multiline entry field. If a handler has not been provided, 0 is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
multiLineEdit
public:
virtual IMultiLineEdit* multiLineEdit( const IWindowHandle& handleMultiLineEdit )

Called to return an IMultiLineEdit "wrapper." You can override this function to specialize the edit control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Ignored


[view class]
setMLEHandler
public:
virtual void setMLEHandler(IHandler* anMLEHandler)

Stores a handler to be added to the IMultiLineEdit control when that control is created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ICnrEditHandler - Enumerations


[view class]
StringType
enum StringType { isIString, 
                  isCharacterPointer }

Enumeration identifying the type of user data in the details view of the container:

isIString
The data is an IString object.
isCharacterPointer
The data is a pointer to a character (char*).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ICnrEditHandler - Inherited Member Functions and Data

Inherited Public Functions

IHandler

Inherited Public Data

Inherited Protected Functions

IHandler

Inherited Protected Data