wxWidgets/docs/latex/wx/treeevt.tex
Julian Smart dd23c25cde Applied patch [ 605189 ] add edit cancel notify to wxTreeEvent
Benjamin I. Williams

Currently there is no way of receiving notification
that a user cancelled an edit operation on a wxTreeCtrl
tree node label.

This patch adds a method "IsEditCancelled" to the
wxTreeEvent class. During an EVT_TREE_END_LABEL_EDIT
event, the programmer can now determine whether or not
the edit operation was cancelled by the user (by
pressing <ESC>).

This patch provides this implementation for both
wxMSW's wxTreeCtrl and the wxGenericTreeCtrl. Both
situations have been tested and work well.

The patch is not very invasive, and is much smaller
than I had expected.

Please see the relevent discussion on the wx-dev list
for more details.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-09-05 19:50:41 +00:00

101 lines
4.0 KiB
TeX

\section{\class{wxTreeEvent}}\label{wxtreeevent}
A tree event holds information about events associated with wxTreeCtrl objects.
\wxheading{Derived from}
\helpref{wxNotifyEvent}{wxnotifyevent}\\
\helpref{wxCommandEvent}{wxcommandevent}\\
\helpref{wxEvent}{wxevent}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/treectrl.h>
\wxheading{Event table macros}
To process input from a tree control, use these event handler macros to direct input to member
functions that take a wxTreeEvent argument.
\twocolwidtha{9cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_TREE\_BEGIN\_DRAG(id, func)}}{The user has started dragging an item with the left mouse button.}
\twocolitem{{\bf EVT\_TREE\_BEGIN\_RDRAG(id, func)}}{The user has started dragging an item with the right mouse button.}
\twocolitem{{\bf EVT\_TREE\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
\twocolitem{{\bf EVT\_TREE\_END\_DRAG(id, func)}}{The user has released the mouse after dragging an item.}
\twocolitem{{\bf EVT\_TREE\_END\_LABEL\_EDIT(id, func)}}{The user has finished editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
\twocolitem{{\bf EVT\_TREE\_DELETE\_ITEM(id, func)}}{A tree item has been deleted.}
% thy're not very (or at all) useful currently
%\twocolitem{{\bf EVT\_TREE\_GET\_INFO(id, func)}}{Request information from the application.}
%\twocolitem{{\bf EVT\_TREE\_SET\_INFO(id, func)}}{Information is being supplied.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_ACTIVATED(id, func)}}{An item has been activated (e.g. double clicked).}
\twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSED(id, func)}}{The item has been collapsed.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSING(id, func)}}{The item is being collapsed. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDED(id, func)}}{The item has been expanded.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDING(id, func)}}{The item is being expanded. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_RIGHT\_CLICK(id, func)}}{The user has clicked the item with the right mouse button.}
\twocolitem{{\bf EVT\_TREE\_ITEM\_MIDDLE\_CLICK(id, func)}}{The user has clicked the item with the middle mouse button.}
\twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.}
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.}
\twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.}
\end{twocollist}%
\wxheading{See also}
\helpref{wxTreeCtrl}{wxtreectrl}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxTreeEvent::wxTreeEvent}
\func{}{wxTreeEvent}{\param{WXTYPE }{commandType = 0}, \param{int }{id = 0}}
Constructor.
\membersection{wxTreeEvent::GetKeyCode}
\constfunc{int}{GetKeyCode}{}
Returns the key code if the event was is a key event. Use
\helpref{GetKeyEvent}{wxtreeeventgetkeyevent} to get the values of the
modifier keys for this event (i.e. Shift or Ctrl).
\membersection{wxTreeEvent::GetItem}
\constfunc{wxTreeItemId}{GetItem}{}
Returns the item (valid for all events).
\membersection{wxTreeEvent::GetKeyEvent}\label{wxtreeeventgetkeyevent}
\constfunc{const wxKeyEvent\&}{GetKeyEvent}{}
Returns the key event for {\tt EVT\_TREE\_KEY\_DOWN} events.
\membersection{wxTreeEvent::GetLabel}
\constfunc{const wxString\&}{GetLabel}{}
Returns the label if the event was a begin or end edit label event.
\membersection{wxTreeEvent::GetOldItem}
\constfunc{wxTreeItemId}{GetOldItem}{}
Returns the old item index (valid for EVT\_TREE\_ITEM\_CHANGING and CHANGED events)
\membersection{wxTreeEvent::GetPoint()}
\constfunc{wxPoint}{GetPoint}{}
Returns the position of the mouse pointer if the event is a drag event.
\membersection{wxTreeEvent::IsEditCancelled()}
\constfunc{bool}{IsEditCancelled}{}
Returns TRUE if the label edit was cancelled. This should be
called from within an EVT\_TREE\_END\_LABEL\_EDIT handler.