background image
<< Custom Objects - Supporting graphical controls | Custom Objects - Irregularly sized or spaced controls >>
Custom Objects - Evenly sized and spaced controls
<< Custom Objects - Supporting graphical controls | Custom Objects - Irregularly sized or spaced controls >>
320
User's Guide
17 S
UPPORTING
C
USTOM
O
BJECTS
Supporting graphical controls
Add a location suffix
to the declaration's
tag
You can, however, create declarations for each discrete object. To do this,
make as many copies of the original recorded declaration as there are discrete
objects. Then add a location suffix to the tag in each declaration, which is the
location of the object within the graphical area.
SilkTest provides two ways to specify the location suffix of "contained"
graphical objects, depending on the size and spacing of the control:
·
Controls that are sized and spaced evenly in a grid
·
Controls that are irregularly sized and spaced
Evenly sized and
spaced controls
If a group of graphical controls are equal in size and evenly spaced in a grid,
you can specify the location of each control as column y of the total number
of columns and row x of the total number of rows. This syntax is both
cross-platform and resolution independent.
Example Consider the following declaration for a tool bar that contains a
single row of 26 icons:
CustomWin PaintWindow1
mswdos tag "[PaintWindow]#1"
Note the following:
·
Because there is no label or caption for the tool bar, SilkTest uses an
index for the tag.
·
SilkTest qualifies the tag with the name of the class, PaintWindow,
enclosed within square brackets ([] ).
·
SilkTest bases the identifier PaintWindow1 on the internal class, since
the tool bar has no label or caption.
Procedure To modify declarations for each of the icons contained in an
evenly sized and spaced tool bar:
1
In the window declarations file make as many copies of this recorded
declaration as there are discrete objects.
2
You can retain the original class (CustomWin) if the functionality
inherited from the AnyWin class is sufficient. Or you can specify the
name of a class you create that contains the added functionality you
need.
3
Change the identifier to some string that represents the icon's action.
4
Append the tag with the icon's location suffix in the tool bar. You express
the location using this syntax:
(
column:total-columns, row:total-rows)
For example, you specify the icon in the third column, first row, like this: