Morphic widgets

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

Morphic widgets

Vijay Mathew-2
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

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morphic widgets

Edgar J. De Cleene



El 10/18/08 8:02 AM, "Vijay Mathew" <[hidden email]> 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@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@334 corner: 735@654) color: Color
paleYellow) setBorderWidth: 2 borderColor: Color black)
    addAllMorphs: (Array
    with: ((StringMorph newBounds: (341@384 corner: 401@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@320;color: Color paleYellow.
myWidget addMorph: ( StringMorph new; contents:'My widget').
(myWidget submorphs at:1) position: myWidget topLeft + (10@20).
myWidget openInWorld "here is at 0@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



 




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners