newObjects Active Label Edit object

Obtained from the VisiLabel object:
e = VisiLabel.Edit;
The Edit object exposes the the properties and methods related to the interactive editing mode. The application uses this object to implement interactive label editing functionality in a WEB page or in a hosting application.

Text command:

The settings held by this object are represented by the EDIT text command

Members reference:

Properties
EditMode Read/Write, Boolean
Puts the Active Label ActiveX in edit mode if set to true and in view-only mode if set to false.
Syntax:
obj.Edit.EditMode = true;
var b = obj.Edit.EditMode;

Where obj is an instance of the VisiLabel object 
Remarks:
In edit mode (or interactive editing) the user is able to select, resize and move the elements on the label displayed in the control. Furthermore using the InteractiveNew method the application/WEB page which hosts the control can instruct it to expect the user to click/drag a rectangle and create a new element at that location. The edit mode enables also a number of keyboard accelerators and additional mouse actions that give the user the opportunity to change the label.
Zoom Read/Write. long integer
Sets the current zoom factor for the control. The value is in percents, thus the default value is 100 - meaning 100%.
Syntax:
obj.Edit.Zoom = 150; // Set the zoom to 150%
var currentZoom = obj.Edit.Zoom;

Where obj is an instance of the VisiLabel object.
XTranslation Read/Write, long integer
Sets/gets the translation of the label area in the visual area of the control - corresponds to the user interaction with the scrollbars.
Syntax:
obj.Edit.XTranslation = 100; // moves the label one millimeter to the right
var curTrans = obj.Edit.XTranslation;

Remarks:
These properties are rarely used by the hosting application/page. Usually you would show the scrollbars (ShowScrollbars) and leave the user to scroll the label in the visible area. However if you want to scroll the visible area programmatically you can do this through these properties. 
YTranslation
ShowRulers Read/Write, Boolean
Shows (true) or hides (false) the rulers.
Syntax:
obj.Edit.ShowRulers = true; // Shows the rulers
var areRulersShown = obj.Edit.ShowRulers;
ShowScrollBars Read/Write, Boolean
Shows (true) or hides (false) the scrollbars.
Syntax:
obj.Edit.ShowScrollbars = true; // Shows the rulers
var areScrollbarsVisible = obj.Edit.ShowScrollbars;
Remarks:
When the control is used for preview and/or print only you may want to keep the scrollbars hidden if the size of the control is sufficient for the labels viewed in it. This is usually a good policy when you want to avoid distracting the user with unnecessary features. However you should consider the need if the control shows a label that must be for example verified by the user. Assume, for instance that the label(s) show data that was just entered (on the same page or the page before it) - you may want to allow the user to take a look and check if everything is ok and go back if something is missing or wrong.
SelectedElement Read/Write, long integer
Sets/gets the index of the currently selected graphical element on the label. The index is 0-based, negative value indicates no selection.
Syntax:
obj.Edit.SelectedElement = 3; // Selects the 3-d element
var selElement = obj.Edit.SelectedElement;
alert(obj(selElement).Name); //
shows the name of the selected
Remarks:
The property may return/set the selected element index even if the ActiveX is not in edit mode (EditMode), but this will have no visual indication and the user will not be able to interact with the selection. In edit mode the the selection is immediately displayed (when the property is set).
ProtectLockedElements Read/Write, Boolean
If set to true disables most of the actions that can be performed with the elements that have their Locked property set to true. 
Syntax:
obj.Edit.ProtectLockedElements = true; // protect locked
var areProtected = obj.Edit.ProtectLockedElements;

Remarks:
Using the Locked property (Every graphical element has it) an user who designs a label can specify that certain elements must be protected from further editing on other pages or forms. On these pages/forms the control should have the ProtectLockedElements property set to true. This will forbid all the interactive actions for them in edit mode and most of their properties programmatically. 
Note that sometimes you may need to implement a page/form where the protection is on, but you may still want a limited number of changes of some protected elements to be possible through special user interface you placed outside the control. In such case you will need to disable the protection temporarily while performing these actions.
AddElementsForbidden Read/Write, Boolean
If set to true new elements cannot be added to the label.
Syntax:
obj.Edit.AddElementsForbidden = true;
var b = obj.Edit.AddElementsForbidden;

Remarks:
Usually this property is used with ProtectLockedElements to add one more restriction - forbid any new elements to be created on the label. Both properties are useful when you want to implement restricted editing capabilities on a page or form.
VisiLabel Returns the VisiLabel (root) object. For example this is the object in the obj variable in the syntax examples. If you have saved a reference to the current object in a variable and you need to obtain its parent object you can do it through this property.
Syntax:
var myLabel = oEdit.VisiLabel;
Methods
ShowProperties Displays the property sheets of the object giving the user the opportunity to change the corresponding settings controlled by it.
Syntax:

obj.Edit.ShowProperties();
CopyTextCmd Copies the selected element (if any) to the clipboard.
Syntax:
var success = obj.Edit.CopyTextCmd();
obj.Edit.CopyTextCmd();
Return value
Indicates if the operation has been successful.
Remarks:
The data copied into the clipboard is the representation of the selected element as text command(s) - the syntax is the same as in the file formats. The text is copied both as UNICODE and as ANSI text.
PasteTextCmd Attempts to paste a new element from the clipboard. 
Syntax:
var success = obj.Edit.PasteTextCmd();
obj.Edit.PasteTextCmd();
Remarks:
An attempt is made to obtain a textual data from the clipboard (UNICODE or ANSI whichever is available). Then the control tries to parse it as a text command (see file formats) and if successful it is executed over the label and creates and element or changes the corresponding settings.
InteractiveNew Requires edit mode. Tells the control that the next mouse action the user will perform should create the specified element.
Syntax:
obj.Edit.InteractiveNew(elType [, name]);
Parameters:
elType - the element type that the user will create (see remarks)
name - The name for the new element. if omitted an auto name will be generated.
Remarks:
The elType is long integer which can be in Active Label 1.0 one of the values listed below. Each element type is created using a different user action - for example a text label or barcode is created by single click while an image requires rectangle to be dragged.
1 - Text label (mouse click)
2 - Text box (rectangle drag)
3 - Shape (rectangle drag)
4 - Symbol (mouse click)
5 - Image (rectangle drag)
6 - Barcode (mouse click)
InteractiveCancel Cancels the expected user action previously scheduled by IntereactiveNew.
Syntax:
obj.Edit.InteractiveCancel();
Remarks:
When the user decides that he/she does not want to create a new element this method can be called to cancel the previously scheduled expected user action. Usually the InteractiveNew is called when the user clicks a button or other control that means "Create element ...", then the user may decide to not do it and cancel the action. How this will look on your page/form depends on your user interface  - you may have a button or do it in response to another action.

Remarks: 

The Edit object controls settings that concern the entire control. It is a helper object that exposes them for the hosting applications/pages.

For information about the property sheets of this object see the ActiveX user interface documentation.

 

 

 

newObjects Copyright 2001-2006 newObjects [ ]