[fxruby-users] FX GUI objects won't display

Harold Worby H.Worby at Kinsey.Com
Wed Mar 16 10:44:18 EST 2005


I'm trying to replace the contents of a FXTreeList and can't get it to
display.
If I call fillList from the instillation method, the list is displayed
correctly, but calling it later will not display.

Also I've have a dialog displayed by Msg_Box(). On the first call, it
displays correctly but on subsequent calls it never displays.


To call fillList I use:
    filelistproc = proc { filelist }
    FXButton.new(mat, "File List", nil, nil, 0,
		FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X) do
|filelistbutton|
	      filelistbutton.connect(SEL_COMMAND,filelistproc)
    end

This will destroy the old list, but not display the new list. I can,
however, crawl the tree with:
    @group1.children.each {|c|
      print "Group1 Child ",c.to_s,"\n"
        c.show
        c.each {|d|
          print "  D ",d.class,"->",d.to_s,"\n"
          d.each {|e|
            print "   E ",e.class," ",e.to_s,"\n"
            #print "   E ",e.class,"\n"
          }
          #d.children.each{|dc|
          #  print "  D child ", dc.to_s,"\n"}
        }
    }
and see that the new tree exists and is populated.

Skipping the .removeChild leaves the old treelist displayed in 1/2 of
the
window, and add a new FXtreeList to the child list, but the second list
does
not display.

What do i need for do to get the tree list to display when it's
replaced?


Harold Worby


###################### fillList
  def fillList
   @group1.children.each {|c|
     print "Remove Child ",c.to_s,"\n"
     @group1.removeChild(c)
   }
    $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)
    topmost = $tree.addItemLast(nil, $dbname, folder_open,
folder_closed)
    s=File.mtime($dbname).to_s + " : " + File.size($dbname).to_s + "
Bytes "
    topmost = $tree.addItemLast(topmost, s + " Bytes", doc,doc)
    sql = "select * from archive order by name;"
    #print sql,"\n"
    rows = $db.query( sql )
    lastname=""
    branch=topmost
    rows.each { |row|
      if row[0]  != lastname
        branch = $tree.addItemLast(topmost, row[0].to_s, folder_open,
folder_closed)
        item = $tree.addItemLast(branch, row[1].to_s, doc, iundo)
        item.data=rows
      else
        branch0 = $tree.addItemLast(branch, row[0].to_s, folder_open,
folder_closed)
        item = $tree.addItemLast(branch0, row[1].to_s, doc, iredo)
        item.data=rows
      end
      lastname= row[0]
      print "add item ",item.text,"\n"
    }
    rows.close
   end
###################################### Msg_Box
  def Msg_Box(sentences)
    w = 350
    h = 250
    centerX = self.x + (self.width/2)
    centerY = self.y + (self.height/2)
    originX = centerX-(w/2)
    originY = centerY-(h/2)
    dialog = FXDialogBox.new($application,"Message
Box",DECOR_ALL,originX,originY,w,h)
    outFrame =
FXVerticalFrame.new(dialog,LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0)
    topFrame =
FXHorizontalFrame.new(outFrame,LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,w,h)
    bottomFrame = FXHorizontalFrame.new(outFrame,LAYOUT_CENTER_X)
    list = FXList.new(topFrame,1,nil,0,LAYOUT_FILL_X|LAYOUT_FILL_Y)
    button=
FXButton.new(bottomFrame,"OK",nil,dialog,FXDialogBox::ID_ACCEPT)
    sentences.each { | s | list.appendItem(s) }
    dialog.show
  end



More information about the fxruby-users mailing list