[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hello, world!
Amazing that this worked exactly as advertised!
We have to stick in our contrib area!
The way we draw shadows is incorrect;y designed in Self 4.0...that
should be easy to override for cases eactly like this,
and it isn't.
Ass to the other problem (#1, clicking on the hidden part of a submorph)
simply add a slot
allowSubmorphsToGetEvent: evt = (globalBaseBounds includes: evt cursorPoint)
and you're done!
Thanks, very nice!
--Randy
> From Michael.Huebner@PrakInf.TU-Ilmenau.DE Tue Nov 7 10:40 PST 1995
> Date: Tue, 7 Nov 1995 17:39:59 --100
> From: Michael.Huebner@PrakInf.TU-Ilmenau.DE (Huebner)
> To: SELF-INTEREST@SELF.sunlabs.com
> Subject: Re: Hello, world!
> X-Sun-Charset: US-ASCII
> Content-Type: text
> Content-Length: 8789
>
>
> Here is my module 'scroll' for a simple scrollMorph (in globals>ui2>...>Basic>).
> Put it in a file and say '_RunScript' to the filename in Self (Is there a better
> way to fileIn a module?)
> It is a very raw hack to look what happens, no quality at all.
> You have to get a copy of the sliderMorph (0.0 .. 100.0) and set the target of it
> to your copy of the scrollMorph.
> The selector that is to be sent from the sliderMorph to your scrollMorph has to be
> set by hand in your sliderMorph to 'scrollY:'. Don't forget the colon at the end!
>
> To bring another morph into your scrollMorph place the morph in the position
> where it should be when the slider is up and use the 'Embed in Morph Below' feature.
> A good scrollee for the test is the green 'Welcome to Self 4.0' morph.
>
>
> The problems that occur are
> 1) when you click on the region with the hidden part of the embedded morph
> the scrollMorph is selected
> (this happens only after you selected the scrollMorph at most once)
> 2) when moving the scrollMorph, the shadowing of the embedded morph is not clipped
> on the boundaries of the scrollMorph
>
> This behavior is not easy to change.
>
> Michael
>
> ----------------- cut here --------------------------------------------------------
>
> '$Revision:$'
> '
> Copyright 1992, 1993, 1994, 1995 Sun Microsystems, Inc. and Stanford University.
> See the LICENSE file for license information.
> '
>
>
> '-- Module body'
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> scroll = bootstrap define: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () ToBe: bootstrap addSlotsTo: (
> bootstrap remove: 'comment' From:
> bootstrap remove: 'directory' From:
> bootstrap remove: 'fileInTimeString' From:
> bootstrap remove: 'postFileIn' From:
> bootstrap remove: 'revision' From:
> bootstrap remove: 'subpartNames' From:
> globals modules init copy ) From: bootstrap setObjectAnnotationOf: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( |
> {} = 'ModuleInfo: Creator: globals modules scroll.
>
> CopyDowns:
> globals modules init. copy
> SlotsToOmit: comment directory fileInTimeString postFileIn revision subpartNames.
>
> \x7fIsComplete: '.
> | ) .
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> comment <- ''.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> directory <- 'applications'.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: InitializeToExpression: (_CurrentTimeString)\x7fVisibility: public'
>
> fileInTimeString <- _CurrentTimeString.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> postFileIn = ( |
> |
> transporter moduleDictionary resetFillingSemaphore.
> snapshotAction addSchedulerInitialMessage:
> message copy receiver: transporter moduleDictionary
> Selector: 'resetFillingSemaphore'.
> resend.postFileIn).
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> revision <- '$Revision:$'.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'scroll' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> subpartNames <- ''.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> () From: ( | {
> 'Category: ui2\x7fCategory: System\x7fCategory: Morphs\x7fCategory: Basic\x7fModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> scrollMorph = bootstrap define: bootstrap stub -> 'globals' -> 'scrollMorph' -> () ToBe: bootstrap addSlotsTo: (
> bootstrap remove: 'parent' From:
> bootstrap remove: 'prototype' From:
> globals morph copyRemoveAllMorphs ) From: bootstrap setObjectAnnotationOf: bootstrap stub -> 'globals' -> 'scrollMorph' -> () From: ( |
> {} = 'ModuleInfo: Creator: globals scrollMorph.
>
> CopyDowns:
> globals morph. copyRemoveAllMorphs
> SlotsToOmit: parent prototype.
>
> \x7fIsComplete: '.
> | ) .
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> () From: ( | {
> 'Category: ui2\x7fCategory: System\x7fCategory: Morphs\x7fCategory: Basic\x7fModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> scrollMorph = bootstrap setObjectAnnotationOf: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( |
> {} = 'ModuleInfo: Creator: traits scrollMorph.
> '.
> | ) .
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'scrollMorph' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> parent* = bootstrap stub -> 'traits' -> 'scrollMorph' -> ().
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'scrollMorph' -> () From: ( | {
> 'Category: filing out\x7fModuleInfo: Module: scroll InitialContents: FollowSlot\x7fVisibility: public'
>
> prototype = ( |
> | scrollMorph).
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'scrollMorph' -> () From: ( | {
> 'Category: clipping\x7fModuleInfo: Module: scroll InitialContents: InitializeToExpression: (0)'
>
> x_off <- 0.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'scrollMorph' -> () From: ( | {
> 'Category: clipping\x7fModuleInfo: Module: scroll InitialContents: InitializeToExpression: (0)'
>
> y_off <- 0.
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'Category: contents handling\x7fModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> contents = ( |
> |
> 0 = morphCount
> ifTrue: [^morph].
> ^firstMorph).
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> drawOn: aCanvas = ( |
> |
> baseDrawOn: aCanvas.
> 0 = morphCount
> ifFalse: [aCanvas withClip: baseBounds Do:
> [|c| c: (aCanvas copyOffset: position + (x_off @ y_off)).
> morphsReverseDo: [| :m | m drawOn: c]]].
> self).
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'Category: contents handling\x7fModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> noStickOuts = bootstrap stub -> 'globals' -> 'true' -> ().
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'Category: contents handling\x7fModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> noStickOuts: arg = ( |
> | self).
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'ModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> parent* = bootstrap stub -> 'traits' -> 'morph' -> ().
> } | )
>
> bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'scrollMorph' -> () From: ( | {
> 'Category: scrolling\x7fModuleInfo: Module: scroll InitialContents: FollowSlot'
>
> scrollY: value = ( |
> origExtent.
> clipExtent.
> spaceToScroll.
> new_y_off <- 0.
> |
> "called when using the scrollbar, value in [0.0, 100.0]"
> origExtent: contents height.
> clipExtent: baseBounds height.
> spaceToScroll: origExtent - clipExtent.
> spaceToScroll > 0 ifTrue: [
> new_y_off: (((value/ 100) - 1) * spaceToScroll) asInteger].
> y_off = new_y_off ifFalse: [ y_off: new_y_off. changed ]).
> } | )
>
>
>
> '-- Side effects'
>
> globals modules scroll postFileIn
>
>