[fxruby-users] dialog.execute vs dialog.show

Harold Worby H.Worby at kinsey.com
Sun Mar 20 21:58:56 EST 2005


In the 'filetext' routine below I'm passing an FStreelistItem and attempting
to display the item.data on top of the TreeList.

Any idea why using dlg.execute vs. dlg.show would place the TextField at a
radically different screen position?
dlg.show does as I would expect, placing the field at the top of the main
window.
dlg.execute places the field over the tree where I but the x coordinate is
way to the left.
I have no idea where dlg.execute is picking up the y coordinate.

Also:
How can I determine the width of the FXVerticalFrame the FXTreeList is being
displayed in?
How can I pickup the screen position of a FXTreeListItem?
I tried to use FXEvent.win_y in the trees event code to get the coordinate
of the event (close enough) but get a runtime error:
'undefined method `win_y' for Fox::FXEvent:Class (NoMethodError)'

Lastly in this code I try to set the FXTextField target to be it's parent
dialog window and send a FXDialogBox::ID_CANCEL when it is ckicked to close
the dialog. Why doesn't this work?

###############
 def filetext(item,y)
    x=getApp()::mainWindow.x
    y=getApp()::mainWindow.y
    w=getApp()::mainWindow.width
    #w=@group1.maxChildWidth()
    h=22
    MsgOut([x,y,w,h])
    #dlg = FXDialogBox.new(getApp(),"File
Info",DECOR_BORDER,x,y,w,h,2,2,2,2,0,0)
    dlg = FXDialogBox.new(@group1,"File
Info",DECOR_BORDER,x,y,w,h,2,2,2,2,0,0)
    #initialize(p, ncols, tgt=nil, sel=0, opts=TEXTFIELD_READONLY, x=0, y=0,
w=0, h=0, pl=DEFAULT_PAD, pr=DEFAULT_PAD, pt=DEFAULT_PAD, pb=DEFAULT_PAD) #
:yields: theTextField
    textbox=FXTextField.new(dlg, 200, dlg,FXDialogBox::ID_CANCEL,
TEXTFIELD_READONLY,2,2,w-4,h-4,0,0,0,0)
    #(,10,10,w,h,DEFAULT_PAD,DEFAULT_PAD,DEFAULT_PAD,DEFAULT_PAD)
    textbox.text=item.data.to_s
    dlg.create
    #dlg.execute
    dlg.show
  end
################
# The FXTreeList definition
################
  def filelist
    $tree= FXTreeList.new(@group1, 0, nil, 0,
      LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LIN
ES|
      TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)
    $tree.connect(SEL_CLICKED  ) do |sender, selector, ptr|
      y=FXEvent.win_y
      y=50+getApp().mainWindow.y
      MsgOut(["Y="+y.to_s])
      if ptr.numChildren == 0
        itemselect(sender, selector, ptr,y)
      end




More information about the fxruby-users mailing list