Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] How to change the font of a button ?

From: patrick:philipot:laposte at: 29-Jun 12:02

How to change the font of a button ? Inspired by Denis-Jo's "change text of button", I have tried to change the font of a button with very poor results. To start simple, I have only tried to change the font/size. === My first attempt was ... f: layout [button "A" [face/font/size: 18] button "B"] view center-face f Unfortunately, not only "A" got the new size of 18, but "B", and all the buttons created since. I guess I have changed the system font used for all the buttons. === I thought "I need to create a new font"... +++ "make font" failed me !
>> my-font: make font [size: 18]
** Script Error: font has no value ** Near: my-font: make font [size: 18] I was puzzled because I read something like that in an old VID documentation REBOL/View User's Guide, Version 0.9.9 (Beta 4.1), 1-June-2000 : view make face size: 100x50 edge: make edge [size: none] pane: make face size: 100x50 text: "Hello World!" font: make font color: 255.255.255 shadow: 1x1 ] edge: make edge [size: none] ] ] +++ "system/standard/face/font" failed me too I figured I needed some system font for model. After wandering a little bit in the available documentation, I found system/standard/face/font which seemed perfect for the job.
>> help system/standard/face/font
SYSTEM/STANDARD/FACE/FONT is an object of value: name string! "arial" style none! none size integer! 12 color tuple! 0.0.0 offset pair! 2x2 space pair! 0x0 align word! center valign word! center shadow none! none I though I was going to be a VID guru ... my-font: make system/standard/face/font [size: 18] f: layout [button "A" [face/font: my-font] button "B"] view center-face f ... but testing proves me wrong. ** Script Error: Invalid path value: colors ** Where: wake-event ** Near: if all [face/font face/font/colors] [ face/font/color: pick face/font/colors not action show face face/font/color: first face/font/colors ] My analyse of this is that this particular font miss something needed by the feel of the button. I have tried to add a colors block. my-font: make system/standard/face/font [size: 18 colors: [0.0.0 255.255.255]] It seems better till ... the next crash? ===However it was quite fun I have lost two hours would be a negative judgment. In fact it was quite a fun. Almost like a chess match. Each time I think I'm gonna win, Rebol is smarter than be. I will be a newbie forever, so be it! However, to move forward, I would like to have some remarks and explanations from THE list. Regards Patrick