Hello.

The official documentation for version 2.8 of wxWidgets [1] presents a
function called GetCurrentPage that does just that.

However, that function is not directly translated into wxHaskell.
Instead, you must use notebookGetSelection [2]. This function returns
an index of the currently selected tab, starting at zero.

Example:
-- basic frame
f <- frame []
p <- panel f []

-- a notebook
n <- notebook p []

-- some tabs
tab1 <- panel n [text := Tab 1]
tab2 <- panel n [text := Tab 2]
tab3 <- panel n [text := Tab 3]

-- example function to get selected tab:
let selected = do
    index <- notebookGetSelection n
    -- do something with index

In this example, if tab2 is the currently active tab,
notebookGetSelection n should return the value 1.

Let me know how it worked out for you.

Regards,
Paulo M. Pocinho

--
[1] http://docs.wxwidgets.org/2.8/wx_wxnotebook.html#wxnotebookgetcurrentpage
[2] 
http://wxhaskell.sourceforge.net/doc/Graphics-UI-WXCore-WxcClassesMZ.html#v%3AnotebookGetSelection



On 19 October 2011 12:26, Johannes Waldmann
<waldm...@imn.htwk-leipzig.de> wrote:
> Dear all,
>
> I am using a "notebook" that has several tabs,
> each one with a panel.
>
> How could I check whether a tab (panel)
> is currently visible (selected)?
> Is there some attribute or selection event?
>
> Because I want to avoid updating the invisible tabs.
>
> Thanks - J.W.
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> wxhaskell-users mailing list
> wxhaskell-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
>
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to