Injecting objects into Workspace bindings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Injecting objects into Workspace bindings

Karl Ramberg
Better:
Workspace>>acceptDroppingMorph: dropee event: evt inMorph: targetMorph 
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName reference |
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
dropee externalName].
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , reference identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: reference.
dropee rejectDropMorphEvent: evt.
^ true"success"

On Thu, Mar 17, 2016 at 6:30 PM, karl ramberg <[hidden email]> wrote:
A little ugly with the code duplication but it works ;-)

Workspace>>acceptDroppingMorph: dropee event: evt inMorph: targetMorph 
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName |
(dropee isKindOf: TransferMorph)
ifTrue: [externalName := dropee passenger className.
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , dropee passenger identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: dropee passenger]
ifFalse: [externalName := dropee externalName.
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , dropee identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: dropee].
dropee rejectDropMorphEvent: evt.
^ true"success"

On Thu, Mar 17, 2016 at 6:06 PM, karl ramberg <[hidden email]> wrote:
Workspaces are great for scripting and exploring ideas etc. And working with already existing objects. It's not so good for developing but very good for other important computing and learning needs.

Best,
Karl
 

On Thu, Mar 17, 2016 at 5:55 PM, Chris Muller <[hidden email]> wrote:
All Jakob had to do was "do it" on:

  myXml := '<SomeElement>.... all kinds of XML ... </SomeElement>'

He now has access to myXml.  Then replace all the text in the
workspace with that from the other workspace.  Done.

I guess I see Workspaces for learning and discovery for newbies.
Short, simple, explorations of syntax and class library.

Attempting to do work as complex as parsing a large XML is going to
present further challenges above and beyond accessing an object.  If
someone feels the need to "link workspaces" they really should stop
and consider just making a class.  In fact, I think linked workspaces
would lead a newbie down the wrong path..

On Thu, Mar 17, 2016 at 11:28 AM, karl ramberg <[hidden email]> wrote:
>
>
> On Thu, Mar 17, 2016 at 4:39 PM, Chris Muller <[hidden email]> wrote:
>>
>> On Thu, Mar 17, 2016 at 4:58 AM, Bert Freudenberg <[hidden email]>
>> wrote:
>> >
>> > On 17.03.2016, at 01:43, Eliot Miranda <[hidden email]> wrote:
>> >
>> >
>> >
>> > On Wed, Mar 16, 2016 at 11:58 AM, Bert Freudenberg
>> > <[hidden email]>
>> > wrote:
>> >>
>> >>
>> >> > On 16.03.2016, at 18:48, marcel.taeumel <[hidden email]>
>> >> > wrote:
>> >> >
>> >> > Mabye we need a simple way to link bindings across tools. Then, for
>> >> > example,
>> >> > we could simple connect a Workspace window to the text box in the
>> >> > Inspector
>> >> > (resp. Object Explorer) and all would share the same bindings. Then,
>> >> > you
>> >> > could simply select stuff in the Object Explorer, evaluate "x :=
>> >> > self"
>> >> > and
>> >> > you would have access to x in that other Workspace (resp. Inspector's
>> >> > text
>> >> > box).
>> >>
>> >> Not a bad idea … what could be a UI for connecting workspaces?
>>
>> Why not just invoke the halos on the inspectors built-in workspace and
>> clone it with the upper-green button and use that?
>>
> This would break workflow I think because like Jacob wrote, you open a file
> in a Workspace and you need a reference to that from another already open
> Workspace.
>
> How about another copy command, like 'copy as reference' and then you could
> paste it in another Workspace ?
>
>
> Best,
> Karl





Reply | Threaded
Open this post in threaded view
|

Re: Injecting objects into Workspace bindings

Karl Ramberg
It seems though that the TransferMorphs are not very usable the way they are created when dragged out of inspectors. They are direct links to objects not to the instance variables. So they don't update if the instance variable change...

Best,
Karl


On Thu, Mar 17, 2016 at 6:38 PM, karl ramberg <[hidden email]> wrote:
Better:
Workspace>>acceptDroppingMorph: dropee event: evt inMorph: targetMorph 
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName reference |
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
dropee externalName].
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , reference identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: reference.
dropee rejectDropMorphEvent: evt.
^ true"success"

On Thu, Mar 17, 2016 at 6:30 PM, karl ramberg <[hidden email]> wrote:
A little ugly with the code duplication but it works ;-)

Workspace>>acceptDroppingMorph: dropee event: evt inMorph: targetMorph 
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName |
(dropee isKindOf: TransferMorph)
ifTrue: [externalName := dropee passenger className.
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , dropee passenger identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: dropee passenger]
ifFalse: [externalName := dropee externalName.
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName translateToLowercase , dropee identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: dropee].
dropee rejectDropMorphEvent: evt.
^ true"success"

On Thu, Mar 17, 2016 at 6:06 PM, karl ramberg <[hidden email]> wrote:
Workspaces are great for scripting and exploring ideas etc. And working with already existing objects. It's not so good for developing but very good for other important computing and learning needs.

Best,
Karl
 

On Thu, Mar 17, 2016 at 5:55 PM, Chris Muller <[hidden email]> wrote:
All Jakob had to do was "do it" on:

  myXml := '<SomeElement>.... all kinds of XML ... </SomeElement>'

He now has access to myXml.  Then replace all the text in the
workspace with that from the other workspace.  Done.

I guess I see Workspaces for learning and discovery for newbies.
Short, simple, explorations of syntax and class library.

Attempting to do work as complex as parsing a large XML is going to
present further challenges above and beyond accessing an object.  If
someone feels the need to "link workspaces" they really should stop
and consider just making a class.  In fact, I think linked workspaces
would lead a newbie down the wrong path..

On Thu, Mar 17, 2016 at 11:28 AM, karl ramberg <[hidden email]> wrote:
>
>
> On Thu, Mar 17, 2016 at 4:39 PM, Chris Muller <[hidden email]> wrote:
>>
>> On Thu, Mar 17, 2016 at 4:58 AM, Bert Freudenberg <[hidden email]>
>> wrote:
>> >
>> > On 17.03.2016, at 01:43, Eliot Miranda <[hidden email]> wrote:
>> >
>> >
>> >
>> > On Wed, Mar 16, 2016 at 11:58 AM, Bert Freudenberg
>> > <[hidden email]>
>> > wrote:
>> >>
>> >>
>> >> > On 16.03.2016, at 18:48, marcel.taeumel <[hidden email]>
>> >> > wrote:
>> >> >
>> >> > Mabye we need a simple way to link bindings across tools. Then, for
>> >> > example,
>> >> > we could simple connect a Workspace window to the text box in the
>> >> > Inspector
>> >> > (resp. Object Explorer) and all would share the same bindings. Then,
>> >> > you
>> >> > could simply select stuff in the Object Explorer, evaluate "x :=
>> >> > self"
>> >> > and
>> >> > you would have access to x in that other Workspace (resp. Inspector's
>> >> > text
>> >> > box).
>> >>
>> >> Not a bad idea … what could be a UI for connecting workspaces?
>>
>> Why not just invoke the halos on the inspectors built-in workspace and
>> clone it with the upper-green button and use that?
>>
> This would break workflow I think because like Jacob wrote, you open a file
> in a Workspace and you need a reference to that from another already open
> Workspace.
>
> How about another copy command, like 'copy as reference' and then you could
> paste it in another Workspace ?
>
>
> Best,
> Karl






Reply | Threaded
Open this post in threaded view
|

Re: Injecting objects into Workspace bindings

Jakob Reschke-2
In reply to this post by Karl Ramberg
2016-03-17 17:55 GMT+01:00 Chris Muller <[hidden email]>:
> All Jakob had to do was "do it" on:
>
>   myXml := '<SomeElement>.... all kinds of XML ... </SomeElement>'
>
> He now has access to myXml.  Then replace all the text in the
> workspace with that from the other workspace.  Done.

If the markup had not been "vast" (12 MB) and possibly full of single
quotes, that would have been my way to go, too. I could have attempted
a global search and replace for these, though... but then again even
scrolling around felt sluggish with that much text in the Workspace. I
could have done that :%s/'/''/g in a proper text editor, but instead I
went crazy and grabbed the String from the TextMorph and wished to
move it out of that Object Explorer... Many ways to accomplish the
same thing, and a lot of them would probably have been more efficient
than asking for that feature I had in mind, granted.

In the end, or rather minutes after starting this thread, I solved my
text transfer problem by copying the XML and doing `xmlString :=
Clipboard clipboardText string`...

> I guess I see Workspaces for learning and discovery for newbies.
> Short, simple, explorations of syntax and class library.
>
> Attempting to do work as complex as parsing a large XML is going to
> present further challenges above and beyond accessing an object.  If
> someone feels the need to "link workspaces" they really should stop
> and consider just making a class.  In fact, I think linked workspaces
> would lead a newbie down the wrong path..

I was not going to write the parsing in the workspace, but I wanted to
conduct my experimenting from there, just like Karl said. And in the
beginning, I needed the XML as a String object, to put it into the
StAXParser, try out the parser API in the workspace and, eventually,
put the parser into my reading object for which I have written a
proper class, of course. :-)

Hence, I do not really feel the need for linked workspaces, but I
would like to move objects around the tools occasionally. That's why I
was delighted to be introduced to that dropped references feature. I
agree with the others that it would be convenient if the
TransferMorphs were unpacked automatically. IMHO, the usual assignment
semantics would suffice, no actual binding/referring to an instance
variable required. If I wanted to be up to date with the object's
state I would transfer that object itself and not an instance
variable.

Reply | Threaded
Open this post in threaded view
|

Re: Injecting objects into Workspace bindings

Jakob Reschke-2
In reply to this post by Chris Muller-3
2016-03-17 17:28 GMT+01:00 karl ramberg <[hidden email]>:
>
> How about another copy command, like 'copy as reference' and then you could
> paste it in another Workspace ?
>

I think I would have liked "paste as string literal" ;-) But using the
clipboard for things other than text might be worthwhile, as an
alternative to drag&drop from an Inspector. Then "Paste as reference"
in workspaces -- or something similar in slot view/edit panes in the
debugger, to overwrite the selected value with the previously copied
object -- would be the actual innovation. Albeit the Clipboard class
looks like it only stores text at the moment... but the "outside"
clipboards have supported other data types for ages.

Reply | Threaded
Open this post in threaded view
|

Re: Injecting objects into Workspace bindings

Bert Freudenberg

On 18.03.2016, at 00:41, Jakob Reschke <[hidden email]> wrote:

2016-03-17 17:28 GMT+01:00 karl ramberg <[hidden email]>:

How about another copy command, like 'copy as reference' and then you could
paste it in another Workspace ?


I think I would have liked "paste as string literal" ;-) But using the
clipboard for things other than text might be worthwhile, as an
alternative to drag&drop from an Inspector. Then "Paste as reference"
in workspaces -- or something similar in slot view/edit panes in the
debugger, to overwrite the selected value with the previously copied
object -- would be the actual innovation.

I'd like being able to paste object references, yes.

Albeit the Clipboard class
looks like it only stores text at the moment... but the "outside"
clipboards have supported other data types for ages.

We do have ExtendedClipboardInterface which allows you to copy and paste other data types, like images, rich text etc.

Oh. Do we still not have that in trunk? Ugh.

I just copied this out of Etoys (get halo, press cmd-c) and pasted into this email:



- Bert -






smime.p7s (5K) Download Attachment
12