Index pitfalls

From Vectorlab

Jump to: navigation, search
This vcor page is currently under construction.

By: All of us!. Last edit: 2010.9.25 (YYYY.MM.DD)

In the category:Under construction you'll find a list of all pages currently marked as under construction.

Index pitfalls

Contents

export this page XML wiki

Below a list of index pitfalls.


[edit] Line Style (dash)

line styles
line styles
negative index = line style dash
lineStyle is a negative index, consistent with the document default indices for line styles, with a value in the range -1 to -n. Line Styles are sometimes referred to as Dash Styles. (n = the number of line or dash styles in the document).
  • Document:
    FPenPat: INTEGER;
    active pen pattern setting.
    PenPat(patNumber:INTEGER);
    sets the active line style for the document.
  • Object:
    GetLS(h:HANDLE): INTEGER;
    gets the line style of the referenced object.
    SetLS(h:HANDLE; lineStyle:INTEGER);
    sets the line style of the referenced object.
  • Classes:
    GetClLS(className:STRING):INTEGER;
    gets the line style of the referenced class.
    SetClLS(className:STRING; lineStyle:INTEGER);
    sets the line style of the referenced class.
  • Dialogs:
    GetLineStyleChoice(dialogID:LONGINT; itemID:LONGINT; VAR lineStyle:INTEGER);
    list of linestyles available in current document as pop-up choice menu.
    SetLineStyleChoice(dialogID:LONGINT; itemID:LONGINT; lineStyle:INTEGER);
    list of linestyles available in current document as pop-up choice menu.
positive index = line style dash
styleIndex is a positive index, position according to the available list of dash styles in current document, but NOT as everywhere else negative.
  • List Browsers:
    GetLBItemDashStyle(dialogID, componentID:LONGINT; itemIndex:INTEGER; subItemIndex:INTEGER; VAR styleIndex, VAR lineWeight:INTEGER): BOOLEAN;
    Gets the specified list browser item's dash style.
    SetLBItemDashStyle(dialogID:LONGINT; componentID:LONGINT; itemIndex:INTEGER; subItemIndex:INTEGER; styleIndex:INTEGER; lineWeight:INTEGER): BOOLEAN;
    Sets the specified list browser item's dash style.


[edit] Line (pen) Pattern

patterns
patterns
positive index range 0 to 71 = pen pattern
linePattern is a positive index, consistent with the document's indices for Pen and Fill Patterns, with a value in the range 0 to 71 (try to avoid using patterns over number 8 as the results are very much printer dependent).
  • Document:
    FPenPat: INTEGER;
    gets the active pen pattern index (document defaults).
    PenPat(patNumber:INTEGER);
    sets the active pen pattern index (document defaults).
  • Object:
    GetLS(h:HANDLE): INTEGER
    gets the pen pattern index of the referenced object.
    SetLS(h:HANDLE; lineStyle:INTEGER);
    sets the pen pattern index of the referenced object.
  • Classes:
    GetClLS(className:STRING):INTEGER;
    gets the pen pattern index of the referenced class.
    SetClLS(className:STRING; lineStyle:INTEGER);
    sets the pen pattern index of the referenced class.
negative index = line style dash
if is a negative index then is a lineStyle, see above: Line Style.


[edit] Arrowheads (marker) style

Document defaults routines gets and sets arrowheads using bit values in pairs of 4, while object and class routines use flags in range 0-6. Some Modern Dialogs routines use a 1-based index.

ARROW TYPE INDEX 1-BASED FLAG BIT VALUE
arrowheads
arrowheads
Dialogs - Modern:
GetMarkerChoice, SetMarkerChoice

only when using predefined arrowheads,
and you use the choice index parameter,
otherwise using the style parameter
pass the 0-based flag (on the right)!

GetMarkerPopupSelectedItem

deprecated routine!

Object:
GetMarker, SetMarker
GetObjArrow, SetObjArrow

Classes:

GetClassArrow, SetClassArrow
Document defaults:
FMarker, Marker
Solid arrow 1 0 0=none, 1=start, 2=end, 3=both
Hollow Arrow 2 1 4=none, 5=start, 6=end, 7=both
Open Arrow 3 2 8=none, 9=start, 10=end, 11=both
Dot 4 3 12=none, 13=start, 14=end, 15=both
Circle 5 4 16=none, 17=start, 18=end, 19=both
Slash 6 5 20=none, 21=start, 22=end, 23=both
Cross 7 6 24=none, 25=start, 26=end, 27=both
A value between 0-6
for all object and class marker styles. The object routines allow for checking start and end of marker through boolean values, not all routines allow for checking the angle (and not all markers have an angle parameter, like dots, for example). Class routines do allow for checking end and start marker only since VW 12.5.
Note (objects' markers)
GetMarker, SetMarker do not set the marker's angle!
Use GetObjArrow, SetObjArrow instead
Note (classes' markers)
GetClassArrow, SetClassArrow do not set start and end marker, whereby as to the present VW edition (12.5.1) it is not possible to set different markers for start or end using the "Class Edit" dialog. This might hint to a feature yet to come.
The following vailable routines are not recognized by VW 12.5 Fundamentals:

[edit] Fill Type

The fill type of a referenced object can be retrived through the standard routines FFillPat, GetFPat, GetClFPat, etc, or through the object preference flag 696. The fill index is returned by the previously mentioned routines, while GetObjectVariableLongint(h, 695) seems to return always the same value, no matter how the object attributes are:

FILL FILL TYPE and STYLE INDEX FILL TYPE FILL STYLE INDEX
patterns
patterns
FFillPat, FillPat

GetFPat, SetFPat

GetClFPat, SetClFPat

GetObjectVariableInt

(h, 696) read only

GetObjectVariableLongint

(h, 695) should be read/write

none (no fill) 0 1 unchanging longint value
solid 1 2 unchanging longint value
bitmap pattern 0-71 3 unchanging longint value
hatch negative index value 4 unchanging longint value
gradient negative index value 5 unchanging longint value
image negative index value 6 unchanging longint value
Example
AlrtDialog(Concat(
'Fill type with obj prefs: ', GetObjectVariableInt(FSActLayer, 696), Chr(13), 
'Fill index with obj prefs: ', GetObjectVariableInt(FSActLayer, 695), Chr(13), 
'Fill index with getFPat: ', GetFPat(FSActLayer)
)); { fill type and fill style of the first selected object }

[edit] Poly and Poly3D

The following polygon/polyline routines are toggling the index base from 0-based to 1-based. Special care is needed.

Index 1-based Index 0-based
GetPolyPt GetPolyPt3D from VW 13 it returns z-value adding the layer's Z
SetPolyPt SetPolyPt3D from VW 13 it sets z-value subtracting the layer's Z

[edit] Colors

color palette with color indexes
color palette with color indexes

Colors are a theme for itself. Please read Colours (isma) for a more extensive discussion about the topic. Let here only be given a short comparison list of the different values used.

Undocumented feature
While most routines should accept a LONGINT triplet value in range 0-65535, many basic attributes routines also accept a color index. The routines labelled with 1 or 2 have this feature. This might come handy in many cases, saving needless conversions through: RGBToColorIndex or the other way around ColorIndexToRGB.
Known bug
SetFillBack, SetFillFore will remove the "ByClass" attribute of the PEN as well.
SetPenBack, SetPenFore will remove the "ByClass" attribute of the FILL.
Remember to parse for the "ByClass" attribute and restore it (up to VW 13).
COLOR INDEX (color palette) INT VALUE 0-255 LONGINT VALUE 0-65535
Document defaults:
PenBack[1], PenFore[1]
FillBack[1], FillFore[1]

Object:

SetPenBack[1], SetPenFore[1]
SetFillBack[1], SetFillFore[1]

Classes:

SetClPenBack[1], SetClPenFore[1]
SetClFillBack[1], SetClFillFore[1]

Layer:

LPenBack[1], LPenFore[1]
LFillBack[1]. LFillFore[1]

Hatches:

AddVectorFillLayer, BeginVectorFillN

Dialog - Modern:

GetColorChoice, SetColorChoice
GetPatternData, SetPatternData
GetGradientSliderData, SetGradientSliderData

Worksheet:

GetWSCellFill, SetWSCellFill
GetWSCellTextColor, SetWSCellTextColor
Gradient (document defaults):
GetGradientData, SetGradientData
GetGradientSpotColor, GetGradientSpotColor
InsertGradientSegment

List Browser:

GetLBItemFillBackColor, SetLBItemFillBackColor
GetLBItemFillForeColor, SetLBItemFillForeColor
GetLBItemPenBackColor, SetLBItemPenBackColor
GetLBItemPenForeColor, SetLBItemPenForeColor
GetLBItemTextColor, SetLBItemTextColor
Document defaults:
FPenBack, PenBack[2]
FPenFore, PenFore[2]
FFillBack, FillBack[2]
FFillFore, FillFore[2]

Object:

GetPenBack, SetPenBack[2]
GetPenFore, SetPenFore[2]
GetFillBack, SetFillBack[2]
GetFillFore, SetFillFore[2]

Classes:

GetClPenBack, SetClPenBack[2]
GetClPenFore, SetClPenFore[2]
GetClFillBack, SetClFillBack[2]
GetClFillFore, SetClFillFore[2]

Layer:

LPenBack[2], LPenFore[2]
LFillBack[2]. LFillFore[2]

Light:

GetLightColorRGB, SetLightColorRGB
GetLayerAmbientColor, SetLayerAmbientColor

Dialog - Modern:

GetColorButton, SetColorButton
Exceptions:
  1. 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 Officially documented for accepting three LONGINT values in range 0-65535, this routine also accept a single color index value corresponding to the color palette.
  2. 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 Also accepts a single parameter of type INTEGER corresponding to one of the 256 Colors defined in the document's Color Palette.
Personal tools