Re: BWidget NoteBook: Retrieve current page?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: BWidget NoteBook: Retrieve current page?

From: Jos Decoster <decoster@raphael.retarget.com>
Date: Tue May 24 2005 - 15:12:29 CEST

Hi,

This little proc is added as part of the 'NoteBook' namespace and uses the
notebook internals to return the name of the currently selected page. If has
one argument, the name of the notebook widget.

NoteBook::use ;# Make sure the notebook widget is loaded

proc NoteBook::selected_page { path } {
    variable $path ;# Internal variables are stored in a variable with
                            # the name $path
    upvar 0 $path data ;# Make the variable with name $path accessible with
                            # name 'data'
    return $data(select) ;# The 'select' item of the array 'data' contains
                            # the name of the selected page
}

The BWidget widget methods 'conventions' requires the first parameter to be
the widget path. Because the proc uses this convention, you can call it like
this:

  $nb selected_page

which is equivalent to

  NoteBook::selected_page $nb

for BWidget widgets.

Jos.
Received on Thu Sep 29 14:18:42 2005