On 16 May 2013 14:37, Camillo Bruni <camillobr...@gmail.com> wrote: > > On 2013-05-16, at 13:04, Denis Kudriashov <dionisi...@gmail.com> wrote: >> Hello. >> >> 2013/5/16 Camillo Bruni <camillobr...@gmail.com> >> >>> I have a question concerning the new TxText layout. >>> How hard is it support inline non-text nodes (aka inline morphs) in a text >>> layout? >>> >> >> Do you mean supporting "TxMorphSpan" objects from text model at text layout >> level? >> I think it is is not hard. Main issue here is supporting such kind of spans >> at text model level. But I think it is not difficult too, >> I should look at code to answer in detail (can't do it now). >> >> >>> >>> My dream is still to be able to drag and drop an "instance" from an >>> inspector to a workspace and do some operations on it using standard >>> smalltalk. >> >> >> +1 >> And I want drag and drop objects between inspectors and between workspaces. >> >> >>> The only difference here would be instead of using a variable or >>> expression to get an instance of something I would have a textual/visual >>> node directly representing an instance! >>> >> >> I'm not understand it. >> By dropping some object to workspace It can create named variable and then >> you can use it for scripting inside workspace. >> But what you suggest here? Can you explan deeply? > > > Indeed I am not very clear (as usual :). > a) I want to have a morph representing an object > b) I want to embed these morphs into text > c) I want to interact with these morphs and the text > > Let's say [Set] is the morph representing a set and I have the following > source code with this morph inside: > > [Set] includes: #a > > Then this would be equivalent to the following: > > Smalltalk at: #MySetInstance put Set new. > > MySetInstance includes: #a > > However [Set] is not just text but a real morph I can drag around, right click > and get a decent, instance specific menu on... and so forth :) > > is that more clear?
Yes. That's probably the good reason why Object should have #asMorph protocol. Right now it is a bit far from your idea: Object>>asMorph "Open a morph, as best one can, on the receiver" ^ self asStringMorph P.S. but please do not use "Smalltalk at: put:" in examples, because someone could take it literally :) P.P.S. since inspector lists objects in left-side pane, i think it would be nice to be able to drag item out of it and drop into workspace. The morph should keep a reference to dragged object and represent it as morph, embedded in text or not... and you don't need to keep it somewhere else (e.g in globals). -- Best regards, Igor Stasenko.