smalltalk - 如何更改 Pharo 中文本字段的字体?

标签 smalltalk pharo squeak

在 Pharo 中,我无法更改特定字段的字体。我正在将 UITheme 用于我的 openModal 文件。下面是我的代码的引用:

openModal
|builder dialog content login|

builder := UITheme builder.
content := (builder newLabelGroup: {
        'Login' -> (login := (builder
                                        newTextEntryFor: contact 
                                        getText: #login
                                        setText: #login:
                                        help: 'Enter the login of the user')
                                    acceptOnCR: false;
                                    minWidth: 200).
        'Full name' -> ((builder
                        newTextEntryFor: contact 
                        getText: #fullName 
                        setText: #fullName: 
                        help: 'Enter the full name of the user.')
                    acceptOnCR: false;
                    minWidth: 200).
        'Password' -> ((builder
                        newTextEntryFor: contact 
                        getText: #password 
                        setText: #password: 
                        help: 'Enter the password of the user.')
                    acceptOnCR: false;
                    minWidth: 200)
}).

dialog := builder newPluggableDialogWindow:'Edit contact' for: content.
dialog rememberKeyboardFocus: login.
builder openModal: dialog.

我查找了类似 TextMorph 的软件包:http://files.pharo.org/doc/2.0/class/TextMorph.html#/method/font%253A ,但我找不到一种方法来实现它来修改对话框的一个字段的字体,特别是密码(将其更改为密码字体)。我该如何去做呢?

也欢迎使用现有软件包的解决方案。

最佳答案

您可以在构建器返回的小部件上设置字体, 类似于调用acceptOnCr或minWidth。 例如:

    login := (builder
    newTextEntryFor: 'contact'
    getText: #login
    setText: #login:
    help: 'Enter the login of the user')
    font: StandardFonts codeFont;
    acceptOnCR: false;
    minWidth: 200;
    font: StandardFont codeFont

或者对于密码输入字段,只需调用

beEncrypted

关于smalltalk - 如何更改 Pharo 中文本字段的字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34820533/

相关文章:

smalltalk - 是否可以在当前的 Pharo 2.0/3.0 版本中使用 ReferenceStream(或类似的东西)?

java - Smalltalk 和 Java 中的 OO 之间的主要区别是什么?

smalltalk - 如何查找 MessageNotUnderstood 消息链

smalltalk - 如何在 Squeak 中创建全局变量?

smalltalk - Squeak Smalltalk 阵列中的奇怪行为

code-generation - 如何为 Pharo 或 Squeak 中的类自动生成 getter/setter 代码?

settings - Pharo 中的彩色窗口主题?

smalltalk - 您如何在 Squeak 中构建 GUI 应用程序

smalltalk - Cog VM 和间接变量访问

smalltalk - 如何在不使用步骤的情况下为变形制作动画?