2014-10-03 13:26 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 03 Oct 2014, at 13:14, Nicolai Hess <nicolaihess@web.de> wrote:
Am 03.10.2014 12:34 schrieb "Yuriy Tymchuk" <yuriy.tymchuk@me.com>:
Hi.
I want to make something like a browser on a single class. I.e. just use
2 last lists out if 4 in standard browser.
Is there already something like that? If not, should I use existing
widgets, or implement my own using spec?
Cheers! Uko
Sent from my iPhone
I think that is pretty easy with some spec models. Maybe there is already an example
yes, but a few models means a few classes :) in a single class, it will e a lot easier glamour (which btw, is specially designed for that: to make browsers).
You can work with ready made models like ListModel/TextModel and just need one class for sticking them together. Here some code, evaluateable from workspace, that shows how we can build a "simple browser" with spec models: This is just the simple skeleton, for more details it would be a bit confusing doing all this in one workspace "script" :) class:=Morph. method:=class>>#openInWorld. composed:= DynamicComposableModel new. composed instantiateModels: #(code TextModel protocols ListModel methods ListModel). composed code text:method sourceCode. composed protocols items: class protocols. composed methods items: class selectors. composed code aboutToStyle:true. composed code behavior:class. composed title: class asString. composed code acceptBlock:[:text | class compile:text notifying:nil. ]. composed protocols whenSelectedItemChanged:[:item | composed methods items:( class selectorsInProtocol: item) ]. composed methods whenSelectedItemChanged:[:item | item ifNotNil:[ method:=class methodDict at:item. composed code text:method sourceCode] ]. composed openWithSpecLayout:( SpecLayout composed newColumn:[:c | c newRow:[:r | r add: #protocols; add: #methods ]; add: #code]; yourself).
Esteban
Hilaire asked for a simple Method editor and i wrote a simple example build with DynamicComposableModel, search the Mailingliste.