[fxruby-users] Option Menu problem (list to long)

Brutyn Nick hotmail brutyn_nick at hotmail.com
Thu Feb 2 09:58:24 EST 2006


How can i know when the client list is select, when it is select the geotag list must be filled.

   # Second row
   FXLabel.new(matrix, "Client")
   # ListBox
   @clientListBox = FXListBox.new(matrix,nil, 0,(FRAME_RAISED|FRAME_THICK|
   JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y))
   @clientListBox.numVisible = 15
   #Connect to webservice (FetchClients)
   @clients = @driver.FetchClients(@@twa, @user.id)
   #Creating a listBox with all the clients (when selecting a option getGeotagsByClient() will be executed)
   for client in @clients
    @clientListBox.appendItem(client.name) #<<<<< .connect doesnt work
   end
   
   # Third row
   FXLabel.new(matrix, "Geotag")
   # ListBox
   @geotagListBox = FXListBox.new(matrix, nil, 0,(FRAME_RAISED|FRAME_THICK|
   JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y))
   @geotagListBox.numVisible = 15
   #Connect to webservice (FetchGeotagsByClient)
   #First time the geotags of the first client will be loaded
   @geotags = @driver.FetchGeotagsByClient(@@twa, @user.id, @clients[0].id)
   #Creating a listBox with all the geotags
   for geotag in @geotags
    @geotagListBox.appendItem(geotag.address1 + ", " + geotag.address2 + ", " + geotag.floor)
   end
  
need to execute this method when client list is selected
  #Getting the geotags of the selected client
  def self.getGeotagsByClient()
   #Showing a wait cursor while getting the records through the webservices
   getApp().beginWaitCursor() do
    #Getting the selected client option menu number
    current_option = @clientMenu.getCurrentNo()
    #Getting the client object (id) from the array based on the optionmenu number (order array = order optionmenu)
    current_client_id = @clients[current_option].id
    # Popup menu
    pane = FXPopup.new(self, (FRAME_RAISED|FRAME_THICK|
      JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y))
    #Connect to webservice (FetchGeotagsByClient)
    @geotags = @driver.FetchGeotagsByClient(@@twa, @user.id, current_client_id)
    #test = ""
    #Creating a optionmenu with all the geotags
    for geotag in @geotags
     geotag_text = geotag.address1
     if !geotag.address2.empty? && geotag.address2  != ""
      geotag_text += ", " + geotag.address2 
     end
     if !geotag.floor.empty? && geotag.floor != ""
      geotag_text += ", " + geotag.floor 
     end
     FXOption.new(pane, geotag_text , nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
     #test += geotag.address1 + "\n " 
    end
    #Create the pane
    pane.create
    #@user_text.text = test
    #Add the pane to the menu
    @geotagMenu.menu = pane
   end
  end
  ----- Original Message ----- 
  From: Lyle Johnson 
  To: Brutyn Nick hotmail 
  Cc: fxruby-users at rubyforge.org 
  Sent: Thursday, February 02, 2006 3:36 PM
  Subject: Re: [fxruby-users] Option Menu problem (list to long)



  On Feb 2, 2006, at 8:23 AM, Brutyn Nick hotmail wrote:


    I have a option menu filled with client options.
    Some user have a lot of clients, so the menu list is ver long, it takes al space on screen and it cant scroll down :s:s, or use the arrows to go down.
    U dont see the rest of list.
     
    Does anyone has any slution for this?
    Or Use another object? Clients can easily go up to 200+.


  I think an FXListBox is probably a better solution than the FXOptionMenu in this case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20060202/6d780265/attachment-0001.htm


More information about the fxruby-users mailing list