TreeNode End of Editing Event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • StvB

    #1

    TreeNode End of Editing Event

    Hi,
    I just started implementing adding a new node to an existing tree.

    In these statements, I add the node itself and attach the
    "end of editing" event handler to the event
    --------
    id = self.tree.Appen dItem(self.root ,'New Item Node',-1,-1)
    EVT_TREE_END_LA BEL_EDIT(self.t ree, treeID, self.OnEndEdit)
    ---------
    But when I respond to the EVT_TREE_END_LA BEL_EDIT event, I don't get the
    new label when you change it:

    The event handler:
    -------------
    def OnEndEdit(self, event):
    item=event.GetI tem()
    s = self.tree.GetIt emText(item) # for debugging

    ------------

    The 's' variable shows the original label (set above) which is 'New Item
    Node'. Should it not show the new text after entering and then press Enter
    key?


    Am I going about this the wrong way?







  • StvB

    #2
    Re: TreeNode End of Editing Event

    Here's where I loused up: I didn't continue reading the documentation
    carefully.

    You don't use GetItemText(). Instead, in either a BEGIN_LABEL_EDI T event,
    or a END_LABEL_EDIT (which I need to use) event, you use: GetLabel()

    --------------
    wxTreeEvent::Ge tLabel
    const wxString& GetLabel() const

    returns the label if the event was a begin or end edit label event.

    -------------


    "StvB" <mesteve_bpleas eremovethis@hot mail.com> wrote in message
    news:rtdmd.4453 7$QJ3.18312@new ssvr21.news.pro digy.com...[color=blue]
    > Hi,
    > I just started implementing adding a new node to an existing tree.
    >
    > In these statements, I add the node itself and attach the
    > "end of editing" event handler to the event
    > --------
    > id = self.tree.Appen dItem(self.root ,'New Item Node',-1,-1)
    > EVT_TREE_END_LA BEL_EDIT(self.t ree, treeID, self.OnEndEdit)
    > ---------
    > But when I respond to the EVT_TREE_END_LA BEL_EDIT event, I don't get the
    > new label when you change it:
    >
    > The event handler:
    > -------------
    > def OnEndEdit(self, event):
    > item=event.GetI tem()
    > s = self.tree.GetIt emText(item) # for debugging
    >
    > ------------
    >
    > The 's' variable shows the original label (set above) which is 'New Item
    > Node'. Should it not show the new text after entering and then press
    > Enter key?
    >
    >
    > Am I going about this the wrong way?
    >
    >
    >
    >
    >
    >
    >[/color]


    Comment

    Working...