Zoolbar

The Zoolbar is something like an orphan inside of the Gestalt Items. There are cross-platform reasons for this lack of enthusiasm from my side: Under AQUA® windows managed by TkZinc 3.3.6 are overdrawn –they are present, but invisible. The TkZinc 3.3.6 window is always the top window, regardless of the stacking order.

These limitation rules TkZinc 3.3.6 out as a common element of a Graphical User Interface. Such as constituted by a toolbar environment.

When using a Zoolbar window ensure that the used vectors creates two graphical objects: one for Tk canvas –with TkPath– and another one for the TkZinc 3.3.6 window.

Example 7.9. A Zoolbar vector

# Implement »zincsample« and »canvassample«.
# And remember both must exist.
proc vsample {drw tags x y size} {
  switch [winfo class $drw] {
      Zinc { zincsample $drw $tags $x $y $size }
    Canvas -
PathCanvas -
   default { canvassample $drw $tags $x $y $size }
  }
}


package require zoolbar

zoolbar .z
.z add command sample \
     -label "Sample" \
     -token Z \
  -iconFont myGlyphFont \
     -image mySampleGif \
    -vector vsample \
   -command { ... }
          

The canvas variety is used inside of Goolbars, and more importantly inside the Gooleditor. The Gooleditor can’t be used for TkZinc 3.3.6 based vectors.

Using the Gooleditor with a Zoolbar has other somewhat strange effects –at least under AQUA®– the Zoolbar remains on-top of the Gooleditor. The result of this is very close to the original AQUA® toolbars.

Both TkZinc 3.3.6 and canvas support embedded windows. This is the way how any kind of control can be embedded inside a toolbar. Use a the section called “The »Template« Way” as the root for such embedded windows. This way, you may also take advantage of Gstripes, too.

Example 7.10. Windows Embedded in Zinc

# »1« is the root group, implicit created.
set groupId 1

zinc .z
.z add window $groupId \
    -window [button .z.b -text "Zinc embedded"] \
  -position {1 1}
          

Example 7.11. Windows Embedded in Tk Canvas

canvas .c
.c create window 1 1 \
   -window [button .c.b -text "Canvas embedded"]
          

Note: canvas does not know »groups«, whereas a TkZinc 3.3.6 window always requires a group. There is a group »1« automatically created by a TkZinc 3.3.6 window. Avoid putting items directly under the root group (1). The root group has some special features.

TkZinc 3.3.6 maintains a viewport for each objects, this allows commutative transformation on the same object. Under Scalable Vector Graphics a new viewport must be created to reach the same ability. For better Scalable Vector Graphics support use only a single transformation type on a TkZinc 3.3.6 object and apply the other transformations on the containing group.