Smalltalk 发送消息displayProgress时尝试查找Progressbar变形

Smalltalk 发送消息displayProgress时尝试查找Progressbar变形,smalltalk,pharo,morphic,Smalltalk,Pharo,Morphic,我在PharoLauncher中提供了一个进度条,这样用户就可以通过该代码获得图像下载进度的信息 PharoLauncher>>displayProgress:during: (in category 'template action') ----- displayProgress: label during: workBlock | nextUpdateTime | nextUpdateTime := 0. ^UIManager default displ

我在PharoLauncher中提供了一个进度条,这样用户就可以通过该代码获得图像下载进度的信息

PharoLauncher>>displayProgress:during: (in category 'template action') -----

displayProgress: label during: workBlock
    | nextUpdateTime |
    nextUpdateTime := 0.
    ^UIManager default displayProgress: label 
        from: 0.0 to: 1.0 during:[:bar|
            [workBlock value] on: HTTPProgress do:[:ex|
                (ex total == nil or: [ex amount == nil]) ifFalse:[
                    (nextUpdateTime < Time millisecondClockValue 
                        or:[ex total = ex amount]) ifTrue:[
                            bar current: ex amount asFloat / ex total asFloat.
                            nextUpdateTime := Time millisecondClockValue + 100.
                    ].
                ].
                ex resume.
            ]
        ]

问题是,正如我所预料的那样,当我去上职业课时,找不到变形。那么我如何找到变形,以及如何定位和缩放包含所有子变形的变形

在Pharo dev邮件列表中的Thierry Goubier和freenode中Pharo的Tinchodis的帮助下,我找到了一个解决方案

创建了三个公告器,这三个公告与SystemProgressMorp的类JobStart、JobEnd、JobChange类和触发器类方法startJb:endJob:和updateJob:相关联。SystemProgressMorp只能有一个实例,为了捕获该实例,我们使用uniqueInstance类方法

为了重新定位和调整进度条的大小,我使用了以下级联消息

(SystemProgressMorph uniqueInstance) minWidth: 600; 
                                     minHeight: 50; 
                                     layoutInset: 30@20; 
                                     position: 150@200.
layoutInset在SystemProgressBarMorph中为进度条添加了更多空间。最好是重置这些值,这样我们就不会影响其他pharo应用程序使用的进度条,但因为PharoLauncher包含在一个独立的映像中,这是不必要的

(SystemProgressMorph uniqueInstance) minWidth: 600; 
                                     minHeight: 50; 
                                     layoutInset: 30@20; 
                                     position: 150@200.