lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [lmi] Code review: product editor


From: Vadim Zeitlin
Subject: Re[2]: [lmi] Code review: product editor
Date: Thu, 29 Mar 2007 15:59:27 +0200

On Thu, 29 Mar 2007 12:09:27 +0000 Greg Chicares <address@hidden> wrote:

GC> Here's the way we're thinking of handling this situation,
GC> in an EVT_TREE_SEL_CHANGED handler:
GC> 
GC>     wxTreeCtrl& tree = GetTreeCtrl();
GC> 
GC>     wxTreeItemId item_id = event.GetItem();
GC>     if(!item_id.IsOk())
GC>         {
GC>         item_id = tree.GetRootItem(); // QUESTION
GC>         }
GC>     LMI_ASSERT( item_id.IsOk() );
GC>     ...

 IMO this fallback on the (hidden!) root item doesn't make much sense.
Either we should handle the case when item_id is invalid (indicating that
there is no valid selection in the tree). Or we should simply assert that
it's valid immediately.

GC> Suppose a selected non-root item is removed under program
GC> control. Then doesn't some other item gain the selection?

 It does or at least it should.

 I think the selection should really be always valid and if I'm wrong about
it this should probably be fixed in wxWidgets and not worked around in LMI.

 Thanks,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]