Javascript - mcUIHexByte test

This page was used to develop the hex data fields needed for color specifications.

mcNumber mcUIHexByte
Not connected
Connected


Test procedure

There are 2 lines The basic test can be performed in either hex field - valid values are from 00 to FF In the second row, the number and hex fields are connected - any change in the hex value should be automatically converted to decimal and displayed in the associated numeric field. Numbers entered in the decimal field are not automatically displayed in the hex field.


Usage

To use a hex control, add the following to the head section.

Hex byte field code example - class is case sensitive, sync points to a number field.


MS Edge design problem

In an input field, the position of the caret (text input cursor) indicates where new text will be inserted. In HTML5 javascript, this can be controlled by setting selectionStart and selectionEnd to the same value. This worked fine in every browser I tested, except MS Edge 25 (Windows 10). The following code Produced this error According to this stackoverflow post Well, that actually makes sense - the caret should only be visible in the element that has focus.

On the other hand, I should be able to set highlights in text that is not visible. Therefore, there is absolutely no reason to make a rule like that.

To determine which object has focus, use

According to w3schools And this is the fix I used This problem was not discovered using the testcases on this page. The mcUIColorPicker was using the component in a slightly different way (several components being updated at the same time via software). When only one component was modified at a time, there was no error.

Javascript - write once, test everywhere !!


Author: Robert Clemenzi
URL: http:// mc-computing.com / Languages / Javascript / mcUIHexByte.html