[fxruby-users] setting the font in FXText

Thomas, Jason M (Software) jmthomas at ball.com
Fri Aug 24 11:37:52 EDT 2007

I have subclassed a FXDialogBox and put a FXText in it for displaying a
hex dump in my application. I want to change the font to a courier type
font since it's a hex dump. When do the following it works as expected:
# A little dialog box to use in our tests
class FXTextDialog < FXDialogBox
  def initialize(owner)
    # Invoke base class initialize function first
    super(owner, "Temp", DECOR_TITLE|DECOR_BORDER, 0, 0, 200, 200)
    button = FXHorizontalFrame.new(self,
    contents = FXHorizontalFrame.new(self,
    @fxtext = FXText.new(contents, nil, 0,
    @fxtext.font = FXFont.new(getApp(), "courier", 8)
    # Ok button
    ok = FXButton.new(button, "OK", nil, self, ID_CANCEL,

However, when I add the following method to FXTextDialog and call it I
get a Seg Fault!:
  def set_font()
    @fxtext.font = FXFont.new(getApp(), "courier", 8)
Usage in my application:
  def onTableHex(sender, sel, ptr)
    @dialog = FXTextDialog.new(self)
How do I set my font once I have already created the dialog box or is
this possible?


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

More information about the fxruby-users mailing list