Unlike VL for Windows VLWEB has no color picker control. I imagine that this can be provided using a widget around a JavaScript control. Has anyone done this or can recommend a good (touch friendly) control.
Cheers
Jim
VLWEB Color picker
-
GregSippel
- Posts: 25
- Joined: Thu May 19, 2016 11:34 am
Re: VLWEB Color picker
Soa,
A simple widget that uses an input of type equals "color" is what you need, See https://developer.mozilla.org/en-US/doc ... nput/color
Note, while it will work in all browsers it will look different in all browsers.
Cheers
Greg
A simple widget that uses an input of type equals "color" is what you need, See https://developer.mozilla.org/en-US/doc ... nput/color
Note, while it will work in all browsers it will look different in all browsers.
Cheers
Greg
Re: VLWEB Color picker
Greg
That looks pretty good. This needs to work on an ipad and its not clear from googling that it does. I'll give it a go.
Cheers
Jim
That looks pretty good. This needs to work on an ipad and its not clear from googling that it does. I'll give it a go.
Cheers
Jim
Re: VLWEB Color picker
making good progress but need a little help;
1 I'm creating the input element thus
var colorPicker = document.createElement("input");
colorPicker.type = "color";
colorPicker.Id = "cpick";
parentDiv.appendChild(colorPicker);
colorPicker.addEventListener("change",colourUpdated, false);
and its working and I'm getting events.
but I need to set the colour so I have:
PROTOTYPE.SetColour = function( strNewColour )
{
var cpick = document.getElementById("cpick");
cpick.value = strNewColour;
// Implementation...
}
but this crashes with 'cannot set the value of null';
Any ideas?
Cheers
Jim
1 I'm creating the input element thus
var colorPicker = document.createElement("input");
colorPicker.type = "color";
colorPicker.Id = "cpick";
parentDiv.appendChild(colorPicker);
colorPicker.addEventListener("change",colourUpdated, false);
and its working and I'm getting events.
but I need to set the colour so I have:
PROTOTYPE.SetColour = function( strNewColour )
{
var cpick = document.getElementById("cpick");
cpick.value = strNewColour;
// Implementation...
}
but this crashes with 'cannot set the value of null';
Any ideas?
Cheers
Jim
Re: VLWEB Color picker
Check the id attribute
It looks like you have a capital "I" in Id.
Try using a lowercase id
- Joe
Code: Select all
colorPicker.Id = "cpick";
Try using a lowercase id
Code: Select all
colorPicker.id = "cpick";
-
dannyoorburg
- Posts: 177
- Joined: Mon Jan 04, 2016 9:50 am
- Location: Australia
Re: VLWEB Color picker
It's easiest to just keep a reference to the element..
this.colorPicker = document.createElement("input");
this.colorPicker.type = "color";
And then just say
this.colorPicker.value = strNewColour;
This way of coding also allows you to create multiple instances of a widget.....
Danny
this.colorPicker = document.createElement("input");
this.colorPicker.type = "color";
And then just say
this.colorPicker.value = strNewColour;
This way of coding also allows you to create multiple instances of a widget.....
Danny