Metodi di Binding Ogetti
Graphical objects Text, Label, Bitmap and Bitmap Label (OBJ_TEXT, OBJ_LABEL, OBJ_BITMAP and OBJ_BITMAP_LABEL) can have one of the 9 different ways of coordinate binding defined by the OBJPROP_ANCHOR property.
Object | ID | X/Y | Width/Height | Date/Price | |||
|---|---|---|---|---|---|---|---|
Text | — | — | Yes | — | Yes | Yes | |
Label | Yes | Yes (read only) | — | Yes | Yes | Yes | |
Button | Yes | Yes | — | Yes | — | — | |
Bitmap | — | Yes (read only) | Yes | — | Yes | — | |
Bitmap Label | Yes | Yes (read only) | — | Yes | Yes | — | |
Edit | Yes | Yes | — | Yes | — | — | |
Rectangle Label | Yes | Yes | — | Yes | — | — |
The following designations are used in the table:
- X/Y – coordinates of anchor points specified in pixels relative to a chart corner;
- Width/Height – objects have width and height. For "read only", the width and height values are calculated only once the object is rendered on chart;
- Date/Price – anchor point coordinates are specified using the date and price values;
- OBJPROP_CORNER – defines the chart corner relative to which the anchor point coordinates are specified. Can be one of the 4 values of the ENUM_BASE_CORNER enumeration;
- OBJPROP_ANCHOR – defines the anchor point in object itself and can be one of the 9 values of the ENUM_ANCHOR_POINT enumeration. Coordinates in pixels are specified from this very point to selected chart corner;
- OBJPROP_ANGLE – defines the object rotation angle counterclockwise.
La variante necessaria può essere specificata usando la funzione ObjectSetInteger(Chart_handle, object_name, OBJPROP_ANCHOR, Anchor_point_mode), dove anchor_point_mode è uno dei valori di ENUM_ANCHOR_POINT.
ID | Descrizione |
|---|---|
ANCHOR_LEFT_UPPER | Punto di ancoraggio in alto a sinistra |
ANCHOR_LEFT | Punto di ancoraggio a sinistra nel centro |
ANCHOR_LEFT_LOWER | Punto di ancoraggio nell'angolo in basso a sinistra |
ANCHOR_LOWER | Punto di ancoraggio sotto sotto nel centro |
ANCHOR_RIGHT_LOWER | Punto di ancoraggio nell'angolo in basso a destra |
ANCHOR_RIGHT | Punto di ancoraggio a destra al centro |
ANCHOR_RIGHT_UPPER | Punto di ancoraggio in alto a destra |
ANCHOR_UPPER | Punto di ancoraggio sopra nel centro |
ANCHOR_CENTER | Punto di ancoraggio strettamente nel centro dell'oggetto |
The OBJ_BUTTON, OBJ_RECTANGLE_LABEL, OBJ_EDIT and OBJ_CHART objects have a fixed anchor point in the upper left corner (ANCHOR_LEFT_UPPER).
Esempio:
string text_name="my_OBJ_TEXT_object"; |
Gli oggetti grafici Freccia (OBJ_ARROW) hanno solo 2 modi di collegamento delle loro coordinate. Gli identificatori sono elencati in ENUM_ARROW_ANCHOR.
ID | Descrizione |
|---|---|
ANCHOR_TOP | Ancoraggio sul lato superiore |
ANCHOR_BOTTOM | Ancoraggio sul lato inferiore |
Esempio:
voidOnStart() |
Dopo l'esecuzione dello script il grafico sarà come in questa figura.
