Johann Hibschman | 8 Feb 14:51
Picon

Centering text in morphic

How can I center text in morphic? I have a RectangleMorph subclass
representing a "tile." I'd like to display a centered string label
within the morph.

My current approach is to just override #drawOn: with:

    TileMorph>>drawOn: aCanvas
        super drawOn: aCanvas.
        aCanvas drawString: 'hi' on: self innerBounds

However, that just always puts the text in the upper-left corner.
(Code is from memory, so I may have got something wrong.)

By "center", I want the baseline-to-max-ascent for the font to be
centered vertically (not the actual height of whatever characters I
have), while the actual width is centered vertically.

Would it be better to use a StringMorph for placing text like this?
I'm afraid I don't yet understand what layout options I'd need to use
to make it work.

Thanks,
- Johann
Ylem | 31 Jan 22:10
Picon

Re: Problem with cmd-c

Hello everyone, I have a problem with Squeak, my iBook G4, does not allow me
to copy and paste, just run cmd-c, Squeak crashes immediately. I apologize
but I do not speak English well, thank you all for your work.

--
View this message in context: http://forum.world.st/Problem-with-cmd-c-tp4337254p4345896.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
MJK | 26 Jan 12:02
Picon
Picon
Favicon
Gravatar

Modifying tooltips in Squeak

Hello,

I'm trying to learn Smalltalk and to understand the Squeak environment. I've
done a couple of small applications and I've been learning basics of the
language itself and the environment but now I'd like to learn something more
concrete about Squeak. I thought that I would try to make some improvements
and customizations for myself and learn that way.

The first project: to modify those quite comic-like balloon tooltips. But
I'm not sure where to start. I have been poking around with BalloonMorph and
managed to change the border width and the tooltip color, but I'm not sure
if that is the right place to modify the appearance of the tooltips. I also
don't understand where the tooltip gets those polygon coordinates that shape
the balloon.

Could anyone give me some pointers, how to get started with the tooltip
customization?

Thanks,

Matti Kärki

--
View this message in context: http://forum.world.st/Modifying-tooltips-in-Squeak-tp4330039p4330039.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Steve Thomas | 19 Jan 02:17

Alba Lucia will be back this Friday

Just got your message.


Stephen
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
dsl101 | 17 Jan 22:34
Picon
Favicon

managing changesets and merging / conflicts

Not sure if I'm doing this right, but here's a hypothetical example to
explain my train of thought, and illustrate where I get stuck. If it
matters, its a Squeak 4.2 image I'm playing with:

I have a based image with classes written by other people that implement
something.

I now edit the methods (for example, the layoutEverything method) to change
the UI - e.g. put buttons in a different order on a toolbar. I save this as
a changeset called 'ToolbarButtons'.

Now I go back to the base image and edit the same method to, for example,
position the toolbar differently in the application. I save this as a
changeset called 'ToolbarPosition'.

So now, in theory (or at least in my mind) I can create 4 things - base
image, base with buttons reordered, base with toolbar repositioned, and base
with buttons reordered and toolbar repositioned.

Of course the problem is that the changesets don't know about each other,
and so we end up with a conflict. Despite the warning in SBE that the
Conflicts button isn't for this, it does seem to show up the diffs if I file
in first one changeset and the look at conflicts from the other. But then I
can't seem to do anything with them - at least not individually.

I can't see immediately how Monticello would help here either, as the
methods are not my new methods, they are still part of the original package,
and I still want to be able to get updates from the original repo - just
apply my changes as and when.

All I'm really missing is a way to handle the diffs in the changesets
smoothly - like being able to step through each one and merge both sets of
changes when producing the 'base + reordering + repositioning' image. Is
that possible without just doing it all by hand?

Thanks,

Dave

--
View this message in context: http://forum.world.st/managing-changesets-and-merging-conflicts-tp4304820p4304820.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Ben Coman | 8 Jan 06:21

class method #initializeClass vs. #initialize

I have come across a class method initializeClass with a comment "Do not 
rename to #initialize."
Is that a generic concern ?

This particular case is from BaseUnit >> initializeClass from 
http://www.squeaksource.com/Units.html

cheers, Ben
SonGuko | 31 Dec 14:39
Picon

Re: Create own Morph

hey,
so i answer myself for others:

step 1: drag your image in squeak
step 2: explore the created morph
step 3: go to the bitmap part of the morph and highlight it
step 4: print: self compressToByteArray
step 5: to create a new morph with the picture: ColorForm extent: (insert
your imagesize) depth: (insert your depth of the image) bits: (Bitmap
decompressFromByteArray:   #(insert your compressedToByteArray)) asMorph
step 6: profit :)

--
View this message in context: http://forum.world.st/Create-own-Morph-tp4088419p4248489.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
Ben Coman | 7 Jan 06:15

Testing = and == in workspace

I was trying to confirm the operation of = and == in the workspace by 
executing the following code..

x :=  'xxx'.
y :=  'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.

I was confused that I was getting anOrderedCollection(true true true true)

It was not until I changed to the following code...

x := String newFrom: 'xxx'.
y := String newFrom: 'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.

that I got the expected anOrderedCollection(true false true true)

I was curious what was going on in the first case.

cheers, Ben
Lawson English | 6 Jan 07:18
Picon

OpenGL integerated wtih Squeak IDE

This is a very poor attempt to do what Matt Fulmer did with OpenCobalt: 
integrate overlapping Morphic windows with OpenGL.

The only advantage is that it doesn't require OpenCobalt.

https://www.youtube.com/watch?v=Ctm-Q39nd-k

The entire World is being rendered onto an OpenGL texture which is 
updated with every tick. With the proper scaling , the destop could be 
repositioned along the z access at any point within the fustrum and 
still keep the default mouse handling. Add mouse handling from OpenGL 
itself, and you can have 2D widgets projected onto 3D objects, not to 
mention  3D widgets fully integrated with the Squeak desktop.

Time to revive/revitalize Balloon3D, perhaps? Whatever happened to 3D 
Morphic?

There's obviously a great deal of room for optimization, and of course, 
the sky is the limit for what could be done in terms of lighting, 
materials, etc.

Using more modern APIs of OpenGL (I'm using immediate mode! (!) and only 
stuff from the first 6 NeHe tutorials) one could have an awful lot of 
interesting stuff going on.

Lawson
Jan Teske | 5 Jan 14:15
Picon

Is there an easy way to implement an animation loop?

Hi there,

I try to implement a blocking animation so that the process waits for 
the animation to be terminated before going ahead. This animation should 
lower the extent of a Morph in 20 iterations so that it looks like it 
would shrink.

I tried to accomplish that in a '1 to: 20 do:' loop but the Morph is not 
updated during the iterations. I tried 'morph changed' but that doesn't 
work either. It does work, however, if I fork the animation loop. But 
than I have an extra process an need Semaphores to wait for its 
execution. That's not as simple as it could be.

Is there any better way than fork and Semaphore? Maybe some force redraw 
method I have overlooked?

Thanks in advance!
Garret Raziel | 4 Jan 21:01
Picon
Gravatar

Class of method

Hi,
I have read that method of object is object itself. So my question is, how can I send message to that object? Is there for example possibilty to send message to the method to decompile itself and show its code? What is method subclass of?

Jan

_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Gmane