VIEW get

view get index ?prop ...?

This command is similar to [mk::get]. It's purpose is to retrieve the value of properties in a particular row of a view.

[view get index] returns a list of alternating property names and property values for row index of view.

[view get index prop] returns the value of property prop on row index of view.

[view get index prop prop ...] returns the list of property values found on row index of view corresponding to the list of prop property name arguments supplied by the caller.

Note that the second variation is not a special case of the third variation, because in Tcl a list of one element need not be the same thing as the one element itself. This same subtle distinction is also true for [mk::get], but is not documented correctly.

   % mk::file open foo
   foo
   % mk::view layout foo.bar {a b}
   foo.bar
   % mk::row append foo.bar a "a test" b see?
   foo.bar!0
   % mk::get foo.bar!0 a     ;# Returns "a test", not "{a test}"!
   a test
   % mk::get foo.bar!0 a b   ;# Only multiple props -> return a list.
   {a test} see?

So, callers of either [mk::get] or [view get] must know whether they are passing 0, 1, or more prop arguments in order to be able to interpret the result properly. This makes it tricky to use Tcl's [eval] and related commands to evaluate these commands.

    % eval mk::get $cursor $propertyList
    a test

We can only interpret the result based on [llength $propertyList].

DGP