Mantis - tweak
Viewing Issue Advanced Details
2518 Any minor always 01-17-06 14:31 01-17-06 14:59
bert  
 
normal  
new  
open  
none    
none  
0002518: Font in InputFields
Setting the font in CInputFields does not work reliably. If set to something else than the default font, clicking into the field resets the font. Same happens when setting a string value:

myFont := (TextStyle named: #BitstreamVeraSans) fontOfPointSize: 12.
p := CInputField open.
p font: myFont; waitTick.
f1 := p font.
p hand keyboardFocus: p; waitTick.
f2 := p font.
p font: myFont; waitTick.
f3 := p font.
p value: 'test'; waitTick.
f4 := p font.
p close.
{f1. f2. f3. f4} collect: [:ea | ea = myFont]

Notes
(0003524)
bert   
01-17-06 14:59   
Found a workaround - instead of using #font:, set the value to a one-character-space text:

    p value: (Text string: ' ' attribute: (TextFontReference toFont: myFont))

After that, setting the value to a string sees to preserve the font, even if the string is empty.