Domanda

I write RSSReader in Smalltalk so I have two Model classes: RSSModel (title, entries) and EntryModel (title, image, content, date)

I have list of EntryView (inherits from UI.View) now I have RSSView and my displayOn method is going to display entries vertically with gap between each:

    | dy iView gap |
        gap := 5.
        dy := 0.
        1 to: model entries size
            do: 
                [:i |
                iView := EntryView model: (model entries at: i).
                iView displayOn: aGC at: 0 @ dy.
                dy := dy + 89 + gap]

and the result is:

result

I am not sure if I do it right way so If you have better solution for display RSSView please tell me.

Questions:

  1. How to get height of entry? Now I write dy:=dy+89+gap where 89 is hardcoded height of entry.
  2. How to enable scrollbars to scroll entries in window?
È stato utile?

Soluzione

How to get the height of the entry? Use:

"entry bounds height"

How to enable scrollbars?

To answer this, I'll first point out that the way you're getting the EntryView's displayed isn't really the best way. You want to create a custom control like I explained in your other question How to create a window in smalltalk. You can use a CompositeView for the view and add each of the EntryViews into the composite using add:at:.

Once you have that, you can go to the Details tab in the UIPainter property editor of the view and turn on Vertical scroll bars.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top