finding a class

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

finding a class

ccrosetti

Hi, I am familiar with Smalltalk and teaching myself the Lively Kernel. While browsing the TodoList via object editor I sea fragment of code like this

var item = this.get("TodoItemProto").copy();


How do I find the TodoItemProto class? Is there a way to select the class name from a method and jump to the class browser open in that target class?

Regards, Carlos

 

 

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: finding a class

ccrosetti
Thanks Lars, the programmatic method you explained  is very useful. However I was interested in a manual method to find a class. either in the System Code Browser or thru the world menu

On 05/12/2014 03:31 PM, Lars wrote:
Hello Carlos,
in oder to get to the TodoItemProto class, just ask the morph for its constructor. When printed, that gives you the class' name. If you want to know where the class is from, ask the constructor for it's source module:

var klass = this.get("TodoItemProto").constructor
var source = this.get("TodoItemProto").constructor.sourceModule

Methods defined using the lively class scheme have an attribute "declaredClass" which contains a string which should yield the class object upon evaluation.

Lars


On 12 May 2014 11:08, <[hidden email]> wrote:

Hi, I am familiar with Smalltalk and teaching myself the Lively Kernel. While browsing the TodoList via object editor I sea fragment of code like this

var item = this.get("TodoItemProto").copy();


How do I find the TodoItemProto class? Is there a way to select the class name from a method and jump to the class browser open in that target class?

Regards, Carlos

 

 

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel




_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: finding a class

timfelgentreff
In reply to this post by ccrosetti
The TodoItemProto in this example isn't a class. It's the name of a morph somewhere in the world. Finding it's class won't be useful.

From: [hidden email]
Sent: ‎13/‎05/‎2014 01:55
To: [hidden email]
Subject: Re: [lively-kernel] finding a class

Thanks Lars, the programmatic method you explained  is very useful. However I was interested in a manual method to find a class. either in the System Code Browser or thru the world menu

On 05/12/2014 03:31 PM, Lars wrote:
Hello Carlos,
in oder to get to the TodoItemProto class, just ask the morph for its constructor. When printed, that gives you the class' name. If you want to know where the class is from, ask the constructor for it's source module:

var klass = this.get("TodoItemProto").constructor
var source = this.get("TodoItemProto").constructor.sourceModule

Methods defined using the lively class scheme have an attribute "declaredClass" which contains a string which should yield the class object upon evaluation.

Lars


On 12 May 2014 11:08, <[hidden email]> wrote:

Hi, I am familiar with Smalltalk and teaching myself the Lively Kernel. While browsing the TodoList via object editor I sea fragment of code like this

var item = this.get("TodoItemProto").copy();


How do I find the TodoItemProto class? Is there a way to select the class name from a method and jump to the class browser open in that target class?

Regards, Carlos

 

 

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel




_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: finding a class

Robert Krahn-4
In reply to this post by ccrosetti
THe manual method for searching is to press CMD-Shift-F / Ctrl-Shift-F inside a text (searchign for selection) or outside. A code search window will pop up. The search will find what's loaded into the Lively runtime (classes, modules, methods, objects). By pressing the "search on server" checkbox you are switching to a completing string search that covers all code that the server has access to.

Best,
Robert


On Mon, May 12, 2014 at 4:55 PM, Carlos Crosetti <[hidden email]> wrote:
Thanks Lars, the programmatic method you explained  is very useful. However I was interested in a manual method to find a class. either in the System Code Browser or thru the world menu

On 05/12/2014 03:31 PM, Lars wrote:
Hello Carlos,
in oder to get to the TodoItemProto class, just ask the morph for its constructor. When printed, that gives you the class' name. If you want to know where the class is from, ask the constructor for it's source module:

var klass = this.get("TodoItemProto").constructor
var source = this.get("TodoItemProto").constructor.sourceModule

Methods defined using the lively class scheme have an attribute "declaredClass" which contains a string which should yield the class object upon evaluation.

Lars


On 12 May 2014 11:08, <[hidden email]> wrote:

Hi, I am familiar with Smalltalk and teaching myself the Lively Kernel. While browsing the TodoList via object editor I sea fragment of code like this

var item = this.get("TodoItemProto").copy();


How do I find the TodoItemProto class? Is there a way to select the class name from a method and jump to the class browser open in that target class?

Regards, Carlos

 

 

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel




_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel



_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: finding a class

Marko Röder
In reply to this post by timfelgentreff
As Tim said, TodoItemProto is not a class but a (prototypical) object that is cloned (.copy()) everytime you create a new TodoItem using the + button.

How can you find it? Usually [morph].show() will highlight the morph in the work showing red corners. If you do it for this example (this.get('TodoItemProto').show() in the Object Editor), you will see that it must be hidden behind the Progress Bar somewhere.

Digging further into it by inspecting the morphs and submorphs of the Todo Item Tool, you will find the TodoItemProto as a submorph of the TodoList container (not the window though). It is not visible so it will not be affected by the horizontal layout and you cannot see it.

How can you find that out programmatically? From the Object Editor, print or inspect this.get('TodoItemProto').owner. :-)

- Marko


On 13 May 2014, at 07:36, Tim Felgentreff <[hidden email]> wrote:

The TodoItemProto in this example isn't a class. It's the name of a morph somewhere in the world. Finding it's class won't be useful.

From: [hidden email]
Sent: ‎13/‎05/‎2014 01:55
To: [hidden email]
Subject: Re: [lively-kernel] finding a class

Thanks Lars, the programmatic method you explained  is very useful. However I was interested in a manual method to find a class. either in the System Code Browser or thru the world menu

On 05/12/2014 03:31 PM, Lars wrote:
Hello Carlos,
in oder to get to the TodoItemProto class, just ask the morph for its constructor. When printed, that gives you the class' name. If you want to know where the class is from, ask the constructor for it's source module:

var klass = this.get("TodoItemProto").constructor
var source = this.get("TodoItemProto").constructor.sourceModule

Methods defined using the lively class scheme have an attribute "declaredClass" which contains a string which should yield the class object upon evaluation.

Lars


On 12 May 2014 11:08, <[hidden email]> wrote:

Hi, I am familiar with Smalltalk and teaching myself the Lively Kernel. While browsing the TodoList via object editor I sea fragment of code like this

var item = this.get("TodoItemProto").copy();


How do I find the TodoItemProto class? Is there a way to select the class name from a method and jump to the class browser open in that target class?

Regards, Carlos

 
 

_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel



_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel


_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel