Hi Lyle,

Thanks very much for your response.

> the FXTopWindow "acts like an FXPacker window."
> I think that in your case it appears that it's using a
> vertical layout because the default  layout hints for an
> FXButton are LAYOUT_SIDE_TOP and LAYOUT_SIDE_LEFT;

Great explanation!  One minor detail:  given those two hints,  how is it
determined that the 2nd button goes *below* the first. Is it because it
selects the left-most position it can find in the remaining space,  and then
the top-most position consistent with that in the remaining space.  BTW, I
had read the http://www.fox-toolkit.com/layout.html page,  but didn't
understand it as well as I do now with the benefit of your explanation.

> Actually, the height of the window *is* appropriate when
> I run it here on my Mac (i.e. under X11). I will have to see
> if I can reproduce your problem under Windows and
> try to go from there.

Kaspar Schiess gave me some guidance which helped me understand my error.
In my initial mod. to Hal Fulton's code,  I directed a button to target self
for an FxApp::ID_QUIT event, and self is a object of a classs deriving from
FXMainWindow, which apparently doesn't handle that event,  nor does its
super class FXTopWindow.

Furthermore, it appears the FOX differs from MS Windows messaging in that
messages unhandled by a MainWindow object will be passeed to the app.
object.

The code below includes the correction suggested Kaspar's guidance by
targeting getApp() for FxApp::ID_QUIT.

> No, I'm pretty sure the width of the window is dictated by the
> width of  the widest button.

That appears to be true, now that I correct the error which messed things
up.

Again,  I thank you for taking the time to offer your expert advice.

Regards,

Richard

P.S.  I post to the RubyUsers listserver indirectly through the
comp.lang.ruby newsgroup supported by the news.md.comcast.giganews.com
news-server.  This NG mirrors the RubyUsers list.  However,  when I posted
the question  to which your post responds,  I never saw my post listed on
the NG.  I'm now of the opinion that the NG doesn't allows posts with
attachments.  For the benefit of other users on this NG,  I've included the
modified and now corrected code below,  which includes a reference to the
original code from Hal Fulton.

========= Testing Buttons.rb =================

# Original code:
http://www.informit.com/content/images/0672320835/downloads/trw-src.zip,
p336l6-10

require "fox"
require "fox/responder"

include Fox

class TwoButtonUpdateWindow < FXMainWindow  # which derives from TopWindow.
                                                # The TopWindow operates
like an FXPacker window.
  include Responder

  # Message identifiers for this class
  ID_TOGGLE_BUTTON = FXMainWindow::ID_LAST

  def initialize(app)
    # Invoke base class initialize first
    super(app, "Update Example", nil, nil,
          DECOR_TITLE | DECOR_CLOSE)    # RLM: Original decorations

    # Define the message map for the class
    FXMAPFUNC(SEL_COMMAND, ID_TOGGLE_BUTTON,
              "onCommand")
    FXMAPFUNC(SEL_UPDATE,  ID_TOGGLE_BUTTON,
              "onUpdate")

    # First button
    @button_one = FXButton.new(self, "Enable Button 2",
                               nil, self,
                               ID_TOGGLE_BUTTON)
    @button_one_enabled = true

    # Second button
    @button_two = FXButton.new(self, "Enable Button 1",
                               nil, self,
                               ID_TOGGLE_BUTTON)

    # Initialize the first two buttons
    @button_two.disable
    @button_two_enabled = false

    # Quit button -- RLM: added 5.12.2004
    # Erroneously had "self" instead of "getApp()" below,
    # which I corrected after guidance from Kaspar Schiess
    @button_quit = FXButton.new(self, "Quit",
                               nil, getApp(), FXApp::ID_QUIT)
  end

  def onCommand(sender, sel, ptr)
    # Update the application state
    @button_one_enabled = !@button_one_enabled
    @button_two_enabled = !@button_two_enabled
  end

  def onUpdate(sender, sel, ptr)
    # Update the buttons based on the application state
    @button_one_enabled ?
      @button_one.enable : @button_one.disable
    @button_two_enabled ?
      @button_two.enable : @button_two.disable
  end

end

def run
  application = FXApp.new("UpdateExample",
                          "Sample programs")
  application.init(ARGV)
  main = TwoButtonUpdateWindow.new(application)
  application.create
  main.show(PLACEMENT_SCREEN)
  application.run
end

run




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.705 / Virus Database: 461 - Release Date: 6/13/2004