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: nornagon <nornagon@gmail.com>
Date: Tue May 24 2005 - 23:16:03 CEST

Jos Decoster wrote:
> 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.
>

Awesome! Now I understand a little more about Tcl.

Someone else has told me this functionality already exists, though: when
you call NoteBook::raise without any arguments (well, except for the
NoteBook's path).

Thanks! :)

--
- nornagon
Received on Thu Sep 29 14:18:46 2005