[Newbies] Morphic widgets

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Wed Oct 22 09:51:42 UTC 2008




El 10/18/08 8:02 AM, "Vijay Mathew" <vijay.the.schemer at gmail.com> escribió:

> Hi,
> 
> I would like to know how I can design this simple credentials form in Squeak.
> There will be a text field, one password field and two buttons. Is there a
> Morphic widgets library? Do I have to implement my own widgets?
> 
> Thanks,
> 
> -- Vijay


Short answer is no.
Look in World menu for item new morph...
>From alphabetical list select BorderedMorph.
Via halo , select it and bring debug menu.
In debug menu select inspect.
In lower panel (code panel) type self extent and then print it.
Should answer 50 at 40, meaning your morph have 50 pixels width and 40 pixels
height.
For change this, do self width: 480;height: 320;color: color: Color
paleYellow.

Now go again to World menu for item new morph..

Repeat again debug menu select inspect.
In lower panel (code panel) type self contents: 'My Widget'.
Via Halo select the StringMorph , via red menu icon select "embed into
BorderedMorph"

You wish know the code version of this ?
Select your widget and via halo, debug, inspector evaluate self
constructorString

In my case I have

'(((BorderedMorph newBounds: (255 at 334 corner: 735 at 654) color: Color
paleYellow) setBorderWidth: 2 borderColor: Color black)
    addAllMorphs: (Array
    with: ((StringMorph newBounds: (341 at 384 corner: 401 at 396) color: Color
black) contents: ''My Widget'')))'

Same procedure could be applied for buttons, etc.

Once you build the widget, could made your own class from it.
Or when you learn which messages the widget could understand via morph
protocol item, you start to made more efficient code

| myWidget|
myWidget := BorderedMorph  new.
myWidget extent: 480 at 320;color: Color paleYellow.
myWidget addMorph: ( StringMorph new; contents:'My widget').
(myWidget submorphs at:1) position: myWidget topLeft + (10 at 20).
myWidget openInWorld "here is at 0 at 0)

myWidget openInHand "here you put in any place"

Enjoy and I could be reached in Skype as edgardec from 18 to 21 GMT for all
here

Edgar



 






More information about the Beginners mailing list