Brutyn Nick hotmail
2006-Feb-02 14:23 UTC
[fxruby-users] Option Menu problem (list to long)
Hey, 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+. This is the code: # Second row FXLabel.new(matrix, "Client") # Popup menu clientPane = FXPopup.new(self) #Connect to webservice (FetchClients) @clients = @driver.FetchClients(@@twa, @user.id) for client in @clients FXOption.new(clientPane, client.name , nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT).connect(SEL_COMMAND) { getGeotagsByClient() } end # Option menu @clientMenu = FXOptionMenu.new(matrix, clientPane, (FRAME_RAISED|FRAME_THICK| JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y))Thanks in advanceNick. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20060202/c4d0e4b5/attachment.htm
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 -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 818 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20060202/81421b4e/attachment.bin
Brutyn Nick hotmail
2006-Feb-02 14:39 UTC
[fxruby-users] Option Menu problem (list to long)
Hey, thanks do u ahve some sample code with FXListBox so can replace the loop. Thanks ----- 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/5c646abf/attachment.htm
Brutyn Nick hotmail
2006-Feb-02 14:58 UTC
[fxruby-users] Option Menu problem (list to long)
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
On Thu, 2 Feb 2006 15:58:24 +0100, "Brutyn Nick hotmail" <brutyn_nick at hotmail.com> wrote :> How can i know when the client list is select, when it is select thegeotag list must be filled. Here is what you should do to figure out the answer to this question. First, take a look at the API documentation for the FXListBox class. You can do this by visiting the FXRuby home page (at http://www.fxruby.org/) and clicking on the "API Reference Docs" links that appears on the left sidebar. Next, navigate to the documentation page for the FXListBox class. Read about the FXListBox class, paying close attention to the section labelled "Events". It will tell you which kinds of messages an FXListBox sends to its target, and what kind of data it sends along with that message. Using that information, you should be able to determine which client the user has selected from the client list.
On Thu, 2 Feb 2006 16:28:13 +0100, "Brutyn Nick hotmail" <brutyn_nick at hotmail.com> wrote :> ..but i cant seem to get the method getGeotagsByClient() activated > > Must the target be another listbox? > > and if i try > @clientListBox = FXListBox.new(matrix, getGeotagsByClient(), > 0,(FRAME_RAISED|FRAME_THICK| > JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y)) > > He says the method doesnt exist.Who is "he"? And why are you passing the return value of "getGeotagsByClient()" as the second argument of FXListBox.new? That should probably be nil: @clientListBox = FXListBox.new(matrix, nil, 0, ...) Since FXListBox sends SEL_COMMAND when one its items is selected, you need to catch that message: @clientListBox.connect(SEL_COMMAND) do |sender, sel, data| # put message handling code here end and since the documentation told you that the message data is an integer indicating the selected item''s index: @clientListBox.connect(SEL_COMMAND) do |sender, sel, data| puts "item #{data} was selected" end Hope this helps, Lyle
Brutyn Nick hotmail
2006-Feb-02 15:48 UTC
[fxruby-users] Option Menu problem (list to long)
Hey, thanks that worked great. i tried @clientListBox = FXListBox.new(matrix, nil, 0,(FRAME_RAISED|FRAME_THICK| JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y)).connect (...) that didnt work. U R the best. Nick ----- Original Message ----- From: <lyle at knology.net> To: "Brutyn Nick hotmail" <brutyn_nick at hotmail.com> Cc: <fxruby-users at rubyforge.org> Sent: Thursday, February 02, 2006 4:34 PM Subject: Re: [fxruby-users] Option Menu problem (list to long)> > On Thu, 2 Feb 2006 16:28:13 +0100, "Brutyn Nick hotmail" > <brutyn_nick at hotmail.com> wrote : > >> ..but i cant seem to get the method getGeotagsByClient() activated >> >> Must the target be another listbox? >> >> and if i try >> @clientListBox = FXListBox.new(matrix, getGeotagsByClient(), >> 0,(FRAME_RAISED|FRAME_THICK| >> JUSTIFY_HZ_APART|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_CENTER_Y)) >> >> He says the method doesnt exist. > > Who is "he"? And why are you passing the return value of > "getGeotagsByClient()" as the second argument of FXListBox.new? That > should > probably be nil: > > @clientListBox = FXListBox.new(matrix, nil, 0, ...) > > Since FXListBox sends SEL_COMMAND when one its items is selected, you need > to catch that message: > > @clientListBox.connect(SEL_COMMAND) do |sender, sel, data| > # put message handling code here > end > > and since the documentation told you that the message data is an integer > indicating the selected item''s index: > > @clientListBox.connect(SEL_COMMAND) do |sender, sel, data| > puts "item #{data} was selected" > end > > Hope this helps, > > Lyle >