onInitialize

Description

An event fired when Ink Control is initialized.

To create a simple onInitialize event click the [...] button next to the onInitialize property. In the editor add a simple alert event.

alert('onInitialize fired');
images/initalert.png

When you open the Ink control in Working Preview you should see the alert fire as soon as the control is initialized.

images/initalert2.png

When an overlay is added to an Ink Control using the Ink Genie then the genie will automatically add some code to the onInitialize event. For example, selecting "Note taking-default > Color and Style > OK" might look generate something like this in the onInitialize event:

if(this.ui){
	this._renderIcon = function(icon){
		if(icon.indexOf('</svg>') != -1){
			return icon;
		} else{
			return A5.u.icon.html(icon);
		}
	}
	$(this.contId+'.ERASER').innerHTML = this._renderIcon(this.ui.icons.eraser);
	$(this.contId+'.REDO').innerHTML = this._renderIcon(this.ui.icons.redo);
	$(this.contId+'.UNDO').innerHTML = this._renderIcon(this.ui.icons.undo);
	$(this.contId+'.LEFT').innerHTML = this._renderIcon(this.ui.icons.left);
	$(this.contId+'.RIGHT1').innerHTML = this._renderIcon(this.ui.icons.right);
	$(this.contId+'.RIGHT2').innerHTML = this._renderIcon(this.ui.icons.right);
	$(this.contId+'.NEWLINELTR').innerHTML = this._renderIcon(this.ui.icons.newLineLTR);
	$(this.contId+'.TOGGLEFULL').innerHTML = this._renderIcon(this.ui.icons.expand);
}
this._curPenStyle = '3';
this._curPenColor = '0,0,0';
this._penUpdate = function(){
	var p = {};
	var ps = this._curPenStyle;
	ps = ps.split(';');
	p.width = Number(ps[0]);
	if(ps.length > 1){
		p.color = 'rgba('+this._curPenColor+','+ps[1]+')';
	} else{
		p.color = 'rgb('+this._curPenColor+')';
	}
	if(ps.length > 2){
		p.lineCap = ps[2];
	}
	this.setPen(p);
}