# Fxruby - need help

**URL:** <https://www.ruby-forum.com/t/fxruby-need-help/47823>\
**Category:** Ruby\
**Created:** [November 14, 2005, 6:00am UTC](https://www.ruby-forum.com/t/fxruby-need-help/47823 "2005-11-14T06:00:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![faker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/eb9ed0/32.png) [@faker](https://www.ruby-forum.com/u/faker)\
**Post date:** [November 14, 2005, 6:00am UTC](https://www.ruby-forum.com/t/fxruby-need-help/47823/1 "2005-11-14T06:00:14Z")

</div>

I am just starting to use fxruby, so this might be a dumb question.  
I am having trouble with hiding and showing buttons and text field.  
It seems that when I show a button or text field that was hidden, the  
button  
is placed randomly, usually under the other objects, and the text  
doesn’t  
show up at all. When I resize the window by grabbing the corner, they  
both  
snap to the correct locations. I have tried forceRefresh, recalc,  
repaint,  
and a few others, but nothing seems to help. I have included a very  
short  
example of the problem below.

#/usr/bin/env ruby  
require ‘fox14’  
include Fox  
class PlotterWindow \< FXMainWindow  
def initialize(app)  
# Invoke base class initialize first  
super(app, “Plotter”, nil, nil, DECOR\_ALL, 0, 0, 300, 300)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

# INITIALIZE

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

```
FXToolTip.new(self.getApp())
statusbar = FXStatusBar.new(self,
  LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)

```

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

# LAYOUT

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

```
showButton = FXButton.new(self,
  "Show\tShow the BLAH Button\tMake BLAH button visable",
  nil, nil, 0,
  LAYOUT_SIDE_TOP|FRAME_RAISED|FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,40,

```

40, 70, 30)  
hideButton = FXButton.new(self,  
“Hide\tHide the BLAH Button\tMake BLAH button hidden”,  
nil, nil, 0,  
LAYOUT\_SIDE\_TOP|FRAME\_RAISED|FRAME\_THICK|LAYOUT\_FIX\_WIDTH|LAYOUT\_FIX\_HEIGHT,40,  
40, 70, 30)  
blahButton = FXButton.new(self,  
“BLAH!!\tBLAH BUTTON\tThe BLAH button has no action”,  
nil, nil, 0,  
LAYOUT\_SIDE\_TOP|FRAME\_RAISED|FRAME\_THICK|LAYOUT\_FIX\_WIDTH|LAYOUT\_FIX\_HEIGHT,40,  
40, 70, 30)  
blahButton.hide  
myTextField = FXTextField.new(self, 20, NIL, 0,  
LAYOUT\_SIDE\_BOTTOM|FRAME\_SUNKEN|FRAME\_THICK|TEXTFIELD\_READONLY)  
myTextField.setText(“blah blah blah!”)  
myTextField.hide

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

# ACTIOINS

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

```
showButton.connect(SEL_COMMAND) {
  print "SHOW!\n"
  STDOUT.flush
  blahButton.show
  myTextField.show
  1
}
hideButton.connect(SEL_COMMAND) {
  print "HIDE!\n"
  STDOUT.flush
  blahButton.hide
  myTextField.hide
  1
}

```

end  
def create  
super  
show(PLACEMENT\_SCREEN)  
end  
end

if **FILE** == $0

# Construct an application

application = FXApp.new(“Button”, “FoxTest”)

# Construct the main window

PlotterWindow.new(application)

# Create the application

application.create

# Run it

application.run  
end
