Hi everyone,
does anyone know the message you send to an InputField to change its font? I was using TexAttributes #setDefaultTo: but it doesn't seem to get everything. I have a few canvases that probably need it set directly. thanks, David
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
At
least if you’re on Windows, the font used in InputFields and for labels is the default
system widget font, set in WinXPLookPolicy class>>defaultSystemFontDescription.
If you want to change the font used in ALL InputFields, I guess you change that
method and send initialize to the class. If you want to change the font used in
ONE or SOME InputFields, select the InputField in the canvas tool and on the
Details page of the GUI Painter Tool, choose the Font you want. You can create
new FontDescriptions from Edit | Named Fonts | Define Named Fonts (press Add
New Named Font, click a font and size etc. on the right, then click Assign to
Named Font). You’ll need to choose a different page then go back to the Details
page to see the new Font in the list. You can File Out the definition of the new
font(s) to a Smalltalk code file, or Install them in your application. If
you want to set the font programmatically when opening (e.g. for a text widget
in postBuildWith:): w
:= aBuilder componentAt: #myTextBox. w
spec style: self style. w
widget textStyle: (TextAttributes styleNamed: self styleSymbol ifAbsent: []) If
you want to do it on the fly after the window has opened (again, this code is
for a text widget): ComposedTextView>>changeTextStyle:
textAttributes self
textStyle: textAttributes. self
displayContents wordWrap ifTrue: "keeps text wrapped" [self
displayContents setCompositionWidth: self wrappingBox width. self
displayContents composeAll]. self setScrollWidth; changePositionBy:
0@0; "updates vertical scrollbar thumb, scrolls so top of box is top of
line" resetSelections; positionToSelection; invalidate. As
this is clearly ugly – most of it is hacky code to make sure the display gets
updated properly after changing the font - I’d be delighted to hear if anyone
has a better solution! HTH, Steve From:
[hidden email] [mailto:[hidden email]] On Behalf Of david Hi everyone,
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |