[Top][All Lists]

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

Re: [lmi] Persistent book-control page selection

From: Vaclav Slavik
Subject: Re: [lmi] Persistent book-control page selection
Date: Tue, 12 Aug 2008 17:49:47 +0200


On Tue, 2008-08-12 at 12:38 +0000, Greg Chicares wrote:
> 1. I represent the selection as std::size_t because that's what
> ChangeSelection() takes as an argument, and assign it from the
> result of GetSelection() only if that result is not -1. Would it
> be more tasteful to compare to, e.g., wxNOT_FOUND instead of -1?

Yes, wxNOT_FOUND is used in wx API for this purpose.

> Is the comparison considered necessary at all, or should
>   book_control.ChangeSelection(event.GetSelection());
> always be valid?

I'm pretty sure (but not certain) that event.GetSelection() will always
be valid selection -- because how could user action result in
un-selection of page in *book control? So I'd do just that, with an
added LMI_ASSERT() to verify this assumption.

> 3. I set the page in a wxEVT_INIT_DIALOG handler. Is that the
> ideal place to do it?

I'd probably do it in ctor right after creating the dialog, but it's
just a matter of taste. The only thing you want to ensure is that it is
done before the dialog is shown in order to avoid flicker, and either
place is fine from this point of view.

> I do this by calling ChangeSelection();
> because that function doesn't generate page-change events, should
> I explicitly call the lmi code that such events would trigger?

Generally speaking, yes, I don't know if it (just ConditionallyEnable()
call as far as I can tell?) is needed in particular case or if it would
be called anyway.

> 4. BTW, the entry for ChangeSelection() probably ought to be
> alphabetized in the documentation, instead of coming at the
> bottom, as here:
>   http://docs.wxwidgets.org/2.8/wx_wxnotebook.html
>   http://docs.wxwidgets.org/2.8/wx_wxtreebook.html

Fixed, thanks.


reply via email to

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