Hello I''m looking for a way to add menu items to a task bar icon menu. I have created a popup menu. And I want to add to a task bar icon menu items for example projects but it must be after user log in. 1. User log in 2. getting list of projects 3. adding menu items into task bar menu with project I attch a file with source code which I already written Thenks for reply''s Attachments: http://www.ruby-forum.com/attachment/1303/taskbariconmenu -- Posted via http://www.ruby-forum.com/.
Anton Komarov wrote:> I''m looking for a way to add menu items to a task bar icon menu. > I have created a popup menu. > And I want to add to a task bar icon menu items for example projects but > it must be after user log in. > 1. User log in > 2. getting list of projects > 3. adding menu items into task bar menu with project > I attch a file with source code which I already written >This came up recently on the mailing list: http://rubyforge.org/pipermail/wxruby-users/2007-December/003506.html Basically, just have your create_popup_menu method check whether the login has taken place, and show the appropriate menu items. The method''s called anew each time the menu is shown. alex
Yes I was read this message before write my post. I''m quite new in Ruby and not understand this code :( actually I understand what this code doing but I don''t understand how I can use this code in my project. Thanks for reply -- Posted via http://www.ruby-forum.com/.
Anton Komarov wrote:> Yes I was read this message before write my post. > I''m quite new in Ruby and not understand this code :( > actually I understand what this code doing but I don''t understand how I > can use this code in my projectHave you actually tried working at it? As the previous emails said, create_popup_menu is called EVERY time the user clicks on the taskbar icon. So if the contents of that menu should change depending on the program''s state (eg if the user is logged in), test for that state in create_popup_menu and the correct menu will be shown. From your example, what you could change is move the "if @user.login?" test into create_popup_menu. If the user is logged in, show the extra project menu items, if not, don''t. hth alex