Re: wxTreeCtrl with no selected item?

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Tue, 26 Dec 2023 18:27:01 +0100 Andreas Falkenhahn wrote:

AF> For some reason I can't get wxTreeCtrl to work properly with no selected item on MSW. I'm using the following code to deselect the focused item:
AF> 
AF> 	wxTreeItemId id = tc->GetFocusedItem();	
AF> 	if(id.IsOk()) tc->Unselect();	
AF> 
AF> This works correctly. However, when using ALT+TAB to switch to another TLW window and then switching back to the TLW that contains the wxTreeCtrl the item I've just deselected automatically gets the focus again and becomes selected and EVT_TREE_SEL_CHANGED is triggered.
AF> 
AF> Is this intended behaviour?

 I think it is because this is how the native tree control behaves and this
also seems to make sense, at least for the single selection case. Maybe we
should avoid it when multiple selection is allowed, however...

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZYtwVgAKCRAG6kHeT2we
hs95AJ9z9d7tXq44dOOHgZRq9Qy71kFTIwCfTdTDCONu5jqfcsf2E+4kdeGOxqE=
=0KWJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.