Skip to content

Commit 0c1d139

Browse files
committed
Minor documentation updates
1 parent 7449357 commit 0c1d139

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

src/checkbox/Checkbox.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,25 @@ if(!javaxt.dhtml) javaxt.dhtml={};
66
//******************************************************************************
77
/**
88
* Form input that can be either checked or unchecked. The input consists of
9-
* a square box with a checkmark when activated and text label.
9+
* a square box with a checkmark when selected.
10+
* <br/>
11+
* Here's a simple example of how to instantiate a checkbox using an existing
12+
* div (DOM element) and a minimal config. See config settings for a full
13+
* range of options.
14+
<pre>
15+
var checkbox = new javaxt.dhtml.Checkbox(div, {
16+
label: "I Agree",
17+
checked: false
18+
});
19+
</pre>
20+
* Once the checkbox is instantiated you can call any of the public methods.
21+
* You can also add event listeners by overriding any of the public "on" or
22+
* "before" methods like this:
23+
<pre>
24+
checkbox.onClick = function(checked){
25+
console.log("I Agree", checked);
26+
};
27+
</pre>
1028
*
1129
******************************************************************************/
1230

src/form/Form.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@ javaxt.dhtml.Form = function (parent, config) {
1616

1717
var defaultConfig = {
1818
onsubmit: null,
19+
20+
/** An array of items that make up the form (e.g. form inputs and labels).
21+
*/
1922
items: [],
2023

2124

25+
/** An array of buttons that will be placed at the bottom of the form
26+
* (e.g. submit, cancel, reset).
27+
*/
28+
buttons: [],
29+
30+
2231
/** Style for individual elements within the component. Note that you can
2332
* provide CSS class names instead of individual style definitions.
2433
*/

src/utils/Utils.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,24 @@ javaxt.dhtml.utils = {
10371037
//**************************************************************************
10381038
//** initDrag
10391039
//**************************************************************************
1040+
/** Used to update a DOM element and enable dragging. It is up to the caller
1041+
* to process the drag events and update the DOM element via event handlers
1042+
* defined in the config. Example:
1043+
<pre>
1044+
initDrag(div, {
1045+
onDragStart: function(mouseX, mouseY){
1046+
//Do something, like compute x/y offsets, update cursor, etc
1047+
},
1048+
onDrag: function(mouseX, mouseY){
1049+
this.style.left = x + 'px';
1050+
this.style.top = y + 'px';
1051+
},
1052+
onDragEnd: function(){
1053+
//Do something, like repost position, update cursor, etc
1054+
}
1055+
});
1056+
</pre>
1057+
*/
10401058
initDrag : function(dragHandle, config){
10411059
javaxt.dhtml.utils.addNoSelectRule();
10421060

@@ -1245,11 +1263,17 @@ javaxt.dhtml.utils = {
12451263
//**************************************************************************
12461264
//** addResizeListener
12471265
//**************************************************************************
1248-
/** Used to watch for resize events for a given element. Credit:
1249-
* http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/
1266+
/** Used to watch for resize events for a given element.
12501267
*/
12511268
addResizeListener: function(element, fn){
12521269

1270+
/* This is a really old hack from 2013 when there were limited
1271+
* cross-browser options to watch for resize events. The code was
1272+
* lifted directly from this link:
1273+
* http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/
1274+
*/
1275+
1276+
12531277
var destroy, isDestroyed = false;
12541278

12551279
var requestFrame = (function(){

0 commit comments

Comments
 (0)