Set focus to new added tab in notebook

Hi,

I use a function to add a tab to my notebook (self.nb) :

       def AddTab( self, event ):
                newgrid = MyGrid(self.nb)
                for j in range(self.colcount-1):
                    for i in range(self.rowcount):
                        newgrid.SetCellValue(i,j, self.data[i][j+1])

                self.nb.AddPage(newgrid, self.tc2.GetValue())

Whenever I add a new tab by using this function, I want it to be the
focused tab in the notebook.
How can I do this?

Thanks in advance.

Call AddPage like this:

  self.nb.AddPage(newgrid, self.tc2.GetValue(), select=True)

···

On 3/2/11 2:57 AM, Shansal wrote:

Hi,

I use a function to add a tab to my notebook (self.nb) :

        def AddTab( self, event ):
                 newgrid = MyGrid(self.nb)
                 for j in range(self.colcount-1):
                     for i in range(self.rowcount):
                         newgrid.SetCellValue(i,j, self.data[i][j+1])

                 self.nb.AddPage(newgrid, self.tc2.GetValue())

Whenever I add a new tab by using this function, I want it to be the
focused tab in the notebook.
How can I do this?

--
Robin Dunn
Software Craftsman

HI all and Robin.

···

2011/3/2 Robin Dunn robin@alldunn.com

On 3/2/11 2:57 AM, Shansal wrote:

Hi,

I use a function to add a tab to my notebook (self.nb) :

   def AddTab( self, event ):

            newgrid = MyGrid(self.nb)
            for j in range(self.colcount-1):
                for i in range(self.rowcount):
                    newgrid.SetCellValue(i,j, self.data[i][j+1])


            self.nb.AddPage(newgrid, self.tc2.GetValue())

Whenever I add a new tab by using this function, I want it to be the
focused tab in the notebook.
How can I do this?

Call AddPage like this:

   self.nb.AddPage(newgrid, self.tc2.GetValue(), select=True)


Robin Dunn
Software Craftsman
http://wxPython.org


To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I have a question to ask yourself about the focused tab in the notebook. If you try to add many different pages to a certain point the last page does not appear and no page is selected. To see the last page you must type on the right button of navigation. Is there a way to resolve this case? For runnable example try FlatNotebook demo.

wxpython 2.8.11.0

Fabio Spadaro
www.fabiospadaro.com

Did you try using FlatNotebook's EnsureVisible method()

···

On 4/12/11 8:49 AM, Fabio Spadaro wrote:

HI all and Robin.

I have a question to ask yourself about the focused tab in the notebook.
If you try to add many different pages to a certain point the last page
does not appear and no page is selected. To see the last page you must
type on the right button of navigation. Is there a way to resolve this
case? For runnable example try FlatNotebook demo.
wxpython 2.8.11.0

--
Robin Dunn
Software Craftsman

Hi.

···

2011/4/12 Robin Dunn robin@alldunn.com

On 4/12/11 8:49 AM, Fabio Spadaro wrote:

HI all and Robin.

I have a question to ask yourself about the focused tab in the notebook.

If you try to add many different pages to a certain point the last page

does not appear and no page is selected. To see the last page you must

type on the right button of navigation. Is there a way to resolve this

case? For runnable example try FlatNotebook demo.

wxpython 2.8.11.0

Did you try using FlatNotebook’s EnsureVisible method()

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks a lot.


Fabio Spadaro

www.fabiospadaro.com