(vw7.2.1nc)
a few examples from JoyOfSt(use the class examples: ColorExample, ComboBoxExample, ButtonExample. but itsn't defined, What sould I do to use these class examples ? |
Thank you, now it work from workspace
but don't from my class definition: ---------- button currentSelection :=ButtonExample. ---------- really the statement that works from worspace is: ButtonExample open but the statement currentSelection :=ButtonExample. is like ButtonExample were a instance right ? |
Some now how looks like aMessage ?
|text| text := 'ButtonExample' text aMessage open |
In reply to this post by Calamar
Calamar (sent by Nabble.com) escreveu:
> (vw7.2.1nc) > > a few examples from JoyOfSt(use the > class examples: > > ColorExample, ComboBoxExample, ButtonExample. > > but itsn't defined, What sould I > do to use these class examples ? > Open the parcel manager (F3 key would do in the launcher), search by directories and 'examples' you'll find: Button-Example Color-Example ComboBox-Example Load these parcels and you get access to them. The other way is open the Help System (F1 key does it in the launcher) and navigate to "Examples Catalogue". There you'll find the examples which you can start them via the link. Once the're started a single time they will be available for you during the session. You have the choice of saving them in your image if you want, of course. HTH -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
In reply to this post by Calamar
Calamar (sent by Nabble.com) escreveu:
> Thank you, now it work from workspace > but don't from my class definition: > ---------- > button > currentSelection :=ButtonExample. > ---------- > really the statement that works from worspace is: > > ButtonExample open > > but the statement currentSelection :=ButtonExample. > is like ButtonExample were a instance right ? > Did you finish the example with all the (action) buttons, including the Help, Quit and Run ones? -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
In reply to this post by Calamar
Calamar (sent by Nabble.com) escreveu:
> Some now how looks like aMessage ? > > |text| > text := 'ButtonExample' > text aMessage open > What are you writing about? -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
Sorry my english, I would like convert a string into a object, for example:
aNumber := 5. aObject := anyObject. text1 := 'aNumber'. text2 := 'aObject'. (text1 unkownMessage) <--- this return the object aNumber (text2 unknowMessage) <--- this return the object anyObject Thank in advance |
In reply to this post by Calamar
Calamar (sent by Nabble.com) wrote:
> Sorry my english, I would like convert a string into a object, for example: > > aNumber := 5. > aObject := anyObject. > > text1 := 'aNumber'. > text2 := 'aObject'. > > (text1 unkownMessage) <--- this return the object aNumber > (text2 unknowMessage) <--- this return the object anyObject > > > Thank in advance > -- > View this message in context: > http://www.nabble.com/missing+class+examples-t1687395.html#a4600656 Sent > from the VisualWorks forum at Nabble.com. You can do this with instance variables, look at #instVarIndexFor: (implemented by classes) and #instVarAt: (implemented on Object). So if we take for example a Point you could do |object varName result | object := 1@2. varName := 'y'. result := object instVarAt: (object class instVarIndexFor: varName). enjoy, Reinout ------- |
Reinout Heeck escreveu:
> Calamar (sent by Nabble.com) wrote: > >>Sorry my english, I would like convert a string into a object, for example: >> >>aNumber := 5. >>aObject := anyObject. >> >>text1 := 'aNumber'. >>text2 := 'aObject'. >> >>(text1 unkownMessage) <--- this return the object aNumber >>(text2 unknowMessage) <--- this return the object anyObject >> >> >>Thank in advance >>-- >>View this message in context: >>http://www.nabble.com/missing+class+examples-t1687395.html#a4600656 Sent >>from the VisualWorks forum at Nabble.com. > > > You can do this with instance variables, look at #instVarIndexFor: > (implemented by classes) and #instVarAt: (implemented on Object). > > > So if we take for example a Point you could do > > |object varName result | > > object := 1@2. > varName := 'y'. > > result := object instVarAt: (object class instVarIndexFor: varName). > > result:= object perform: varName asSymbol? -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ |
Cesar Rabak wrote:
> > Isn't easier to do instead: > > result:= object perform: varName asSymbol? Yes, but obviously that assumes that -the getter method is implemented and -actually accesses a variable by that name without performing additional logic. True most of the time but not always... R - |
Free forum by Nabble | Edit this page |