Today marked a very special day for both Steve Aldred and myself. Some of our plans for the V4 engine finally came to fruition. Now, I won't say exactly what those plans were or why we're so happy about it, but I will say that we're well on track to delivering an absolutely rocking follow up to our V3 engine.
So on that note, since we're talking Pollock, I thought I might share with you the basic code that is required to make the simplest web browser you could possibly make. This web browser only has a text input with a drop down for URL history and the actual browser pane itself.
It uses only 100% Pollock and V4 code, so there's no wrappers anywhere to be seen. In V4's current state, don't expect miracles, but if you want to see how it is we test out our system then this might be a fun try for you.
On that note, the latest version of WithStyle has many tests failing - these are all V4 tests. This will be addressed as soon we can, but I can assure you that version is safe to run.
The Web browser code:
| window documentPane urlPane |
window := Pollock.UserInterfaceWindow new.
window frame specifiedSize: 800@600.
window addComponent: (urlPane := Pollock.DropDownList new).
window addComponent: (documentPane := Pollock.WithStyleDocument new).
urlPane frame: (Pollock.FractionalFrame fullyAttached bottomOffset: urlPane preferredExtent y; bottomFraction: 0; yourself).
documentPane frame: (Pollock.FractionalFrame fullyAttached topOffset: urlPane preferredExtent y; yourself).
urlPane list: Set new asList.
urlPane when: #losingFocus do: [ | url | url := urlPane model value. urlPane list add: url. Cursor wait showWhile: [documentPane documentURI: url]].
window open
This code will open up a window with a combobox at the top and the V4 widget filling up the rest of the window space.
Things of interest:
- The Pollock.WithStyleDocument is our pane for the Pollock framework to render XML with CSS.
- Using preferredExtent to position the offsets lets us change font size and have the combobox grow while keeping the rest of the window layout proportional
- #losingFocus is currently the best choice of event for knowing when to navigate to a URL. I've raised this with Sam and hopefully he'll add some more convincing event API's soon.
- If you have an instance of a Pollock.WithStyleDocument you can send it messages such as documentPane documentURI: 'http://www.w3.org' asURI or documentPane documentString: '<html><body>Hello World!</body></html>' to give it content to render.