Color-chooser, part II. Three pieces of the Puzzle.

Functionality of our color-chooser requires some code to be designed as we definitely need to handle UI events and do some initialization of our component. Typical OOP solution for that is to design such code in a form of some class. Then we need some mechanism that will allow us to "bind" such class with…

Designing Reusable UI Components in Sciter. Color-chooser, part I.

This is a start of a sequence of articles explaining design and architecture of reusable components (a.k.a. scripting behaviors) in Sciter. First of all small specification. We need a component in HTML allowing user to select and apply color. Such control shall be defined in HTML as: < input type="color-chooser" /> This input element shall…

Windowless HTMLayout

Build #3.1.1.45 of HTMLayout contains new set of API functions allowing to use htmlayout in windowless mode. There are cases where such windowless mode (to be precise HWND-less) is needed. Think about games. They use DirectX surfaces and implement window or view structures internally. Now HTML can be used inside such internal views.

What the hell is that JSON-DB?

JSON-DB… You can, probably, guess that it’s a compound word, which consists of JSON and DB (database). And you are absolutely right! It’s a way to save javascript objects in a persistent storage. Let’s imagine that you have a state object in javascript, which you’d love to persist. And the state consists of different objects…

Eval, JSON and curly braces.

Say, you have JSON data (object literal) stored as a string somewhere: “{ one:1, two:2 }” and you want to parse (convert) this string into scripting object. Obvious solution for this would be to write something like this: var dataStr = “{ one:1, two:2 }”; var data = eval( dataStr ); Looks nice and simple…

Delegates in JavaScript. Now with parameters.

Here is an extended delegate function: function delegate( that, thatMethod ) { if(arguments.length > 2) { var _params = []; for(var n = 2; n < arguments.length; ++n) _params.push(arguments[n]); return function() { return thatMethod.apply(that,_params); } } else return function() { return thatMethod.call(that); } } And here is an example. Note that obj.method now accepts additional...

Java GUI executable without JRE… Are you kidding me?

Three years ago (or so) I did experimental project named J-SMILE to prove that it is possible. Main idea of it is simple – to create as small as possible Java (Virtual Machine) that can be attached to compiled Java bytecode (.class files). Physically J-SMILE VM is an .exe file of size 200k. These 200k…

Phrase that made my day.

“… people knew how to write small, efficient programs in those days, a skill that has subsequently been lost.” © Tanenbaum (?)

Delegates in JavaScript

Simple definition: delegate is a value – reference to the pair of object and its method. Lets name them as delegate.object and delegate.method. delegate invocation is a way of calling of delegate.method in context of delegate.object. So inside code of the delegate.method variable this points to the delegate.object. To be practically useful delegate in JavaScript…