wxNotebook - GetSelection issue Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
wxuser
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Feb 25, 2005 5:45 am
Location: India

wxNotebook - GetSelection issue

Post by wxuser » Fri Oct 28, 2005 10:34 am

Hi all,

I have been trying to add a feature similar to whats in firefox. middle mouse button closing the page.

But the problem is GetSelection always gives the visible page regardless of what page i click on.

for example
Page1 | Page2 | Page3

If 'Page3' is currently selected, even if i middle click on 'Page1', 'Page3' is closed.

And the documentation also tells that GetSelection always gives the previous one. Is there a workaround for this. or has anyone tried this on wxNotebook.

thanks in advance

deez

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Fri Oct 28, 2005 11:19 am

Maybe you could have a look at the wxNotebook::HitTest function
wxwidgets wrote: wxNotebook::HitTest
int HitTest(const wxPoint& pt, long *flags = NULL)

Returns the index of the tab at the specified position or wxNOT_FOUND if none. If flags parameter is non NULL, the position of the point inside the tab is returned as well.

NB: This method is currently only implemented under wxMSW and wxUniv.

wxuser
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Feb 25, 2005 5:45 am
Location: India

Post by wxuser » Fri Oct 28, 2005 2:19 pm

Thanks a lot benedicte,

it works perfectly on windows. But will be porting the app into linux in a couple of weeks, any ideas for a platform independent solution.

thanks

deez

PS: I would like to wait few more hours for any other ideas before accepting the solution, hope its ok.

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Sat Oct 29, 2005 12:24 pm

In fact, wxNotebook::HitTest() was implemented on GTK by Daniel Lundqvist in wxWidgets 2.5.1. (see CHANGES.TXT in the wx install dir).

wxuser
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Feb 25, 2005 5:45 am
Location: India

Post by wxuser » Sat Oct 29, 2005 2:52 pm

Ya, it is there!!. Thanks a lot benedicte

deez

ghao
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Dec 08, 2005 12:29 pm

Post by ghao » Thu Dec 08, 2005 2:23 pm

Hi,
How can I use Function wxNotebook::HitTest() ?
It returns always -1. Why ?

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Thu Dec 08, 2005 2:34 pm

from the wxWidgets documentation:
documentation wrote:NB: This method is currently only implemented under wxMSW and wxUniv.
Which platform are you trying to use it on ?

ghao
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Dec 08, 2005 12:29 pm

Post by ghao » Thu Dec 08, 2005 2:43 pm

MS Windows.

Post Reply