×

Discussion Board

Results 1 to 10 of 10

Thread: tabs in menus

  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    tabs in menus

    i try to show tabs when i select the option "tabs", but teh tabs show even i didn't select it.
    see this code:
    Code:
    import appuifw
    import e32
    from graphics import *
    
    # create the callback functions for the application menu and its submenus
    def submenu1():
        print ""
        round.set(u'submenu one was selected')
    	
    def submenu2():
        print ""
        round.set(u'submenu two was selected')
    	
    def submenu3():
        print ""
        round.set(u'submenu three was selected')
    	
    def submenu4():
        print ""
        round.set(u'submenu four was selected')
    
    def quit():
        app_lock.signal()
    	
    	
    # define application 1: text app
    app1 = appuifw.Text(u'Appliation o-n-e is on')
    
    # define application 2: text app
    app2 = appuifw.Text(u'Appliation t-w-o is on')
    
    # define application 3: text app
    app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')
    
    
    def exit_key_handler():
        app_lock.signal()
    
    # create a tab handler that switches the application based on what tab is selected
    def handle_tab(index):
        global lb
        if index == 0:
            appuifw.app.body = app1 # switch to application 1
        if index == 1:
            appuifw.app.body = app2 # switch to application 2
        if index == 2:
            appuifw.app.body = app3 # switch to application 3
    
    
    
    # create an Active Object
    app_lock = e32.Ao_lock()
    
    round = appuifw.Text()
    round.set(u'press options')
    appuifw.app.screen='normal'
    appuifw.app.body = round
    
    # create the application menu including submenus
    appuifw.app.menu = [(u"Menu1", ((u"submenu1", submenu1),
                                     (u"submenu2", submenu2))),
                        (u"Menu2", ((u"1", subitem1),
                                        (u"submenu3", subitem3))),
    									(u"tabs", handle_tab)]
    
    
    
    appuifw.app.exit_key_handler = exit_key_handler
    
    # create the tabs with its names in unicode as a list, include the tab handler
    appuifw.app.set_tabs([u"One", u"Two", u"Three"],handle_tab)
    
    # set the title of the script
    appuifw.app.title = u'Tabs'
    
    # set app.body to app1 (for start of script)
    appuifw.app.body = app1
    
    # create an active object
    app_lock = e32.Ao_lock()
    
    # start a scheduler
    app_lock.wait()
    i think i should to add "IF", but it dont really know how to do that.

    help please,
    yonatan

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: tabs in menus

    The code you proided gives errors (saying that subitem1 is not defined and as far as I can see neither is subitem3).

    Anyway, if you want to display the tabs only after selecting the "tabs" option from the menu, an easy way of doing it would be to set the tabs in a separate function and call that when "tabs" is selected. Here's what I mean:
    Code:
    import appuifw
    import e32
    from graphics import *
    
    # create the callback functions for the application menu and its submenus
    def submenu1():
        print ""
        round.set(u'submenu one was selected')
    	
    def submenu2():
        print ""
        round.set(u'submenu two was selected')
    	
    def submenu3():
        print ""
        round.set(u'submenu three was selected')
    	
    def submenu4():
        print ""
        round.set(u'submenu four was selected')
    
    def quit():
        app_lock.signal()
    	
    	
    # define application 1: text app
    app1 = appuifw.Text(u'Appliation o-n-e is on')
    
    # define application 2: text app
    app2 = appuifw.Text(u'Appliation t-w-o is on')
    
    # define application 3: text app
    app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')
    
    
    def exit_key_handler():
        app_lock.signal()
    
    def show_tabs():
        # create the tabs with its names in unicode as a list, include the tab handler
        appuifw.app.set_tabs([u"One", u"Two", u"Three"],handle_tab)
    
        # set the title of the script
        appuifw.app.title = u'Tabs'
    
        # set app.body to app1 (for start of script)
        appuifw.app.body = app1
    
    # create a tab handler that switches the application based on what tab is selected
    def handle_tab(index):
        global lb
        if index == 0:
            appuifw.app.body = app1 # switch to application 1
        if index == 1:
            appuifw.app.body = app2 # switch to application 2
        if index == 2:
            appuifw.app.body = app3 # switch to application 3
    
    
    
    # create an Active Object
    app_lock = e32.Ao_lock()
    
    round = appuifw.Text()
    round.set(u'press options')
    appuifw.app.screen='normal'
    appuifw.app.body = round
    
    # create the application menu including submenus
    appuifw.app.menu = [(u"Menu1", ((u"submenu1", submenu1),
                                    (u"submenu2", submenu2))),
                        (u"Menu2", ((u"1", submenu1),
                                    (u"submenu3", submenu3))),
    		    (u"tabs", show_tabs)]
    
    
    
    appuifw.app.exit_key_handler = exit_key_handler
    
    # create an active object
    app_lock = e32.Ao_lock()
    
    # start a scheduler
    app_lock.wait()

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    Re: tabs in menus

    Quote Originally Posted by bogdan.galiceanu View Post
    The code you proided gives errors (saying that subitem1 is not defined and as far as I can see neither is subitem3).

    Anyway, if you want to display the tabs only after selecting the "tabs" option from the menu, an easy way of doing it would be to set the tabs in a separate function and call that when "tabs" is selected. Here's what I mean:
    Code:
    import appuifw
    import e32
    from graphics import *
    
    # create the callback functions for the application menu and its submenus
    def submenu1():
        print ""
        round.set(u'submenu one was selected')
    	
    def submenu2():
        print ""
        round.set(u'submenu two was selected')
    	
    def submenu3():
        print ""
        round.set(u'submenu three was selected')
    	
    def submenu4():
        print ""
        round.set(u'submenu four was selected')
    
    def quit():
        app_lock.signal()
    	
    	
    # define application 1: text app
    app1 = appuifw.Text(u'Appliation o-n-e is on')
    
    # define application 2: text app
    app2 = appuifw.Text(u'Appliation t-w-o is on')
    
    # define application 3: text app
    app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')
    
    
    def exit_key_handler():
        app_lock.signal()
    
    def show_tabs():
        # create the tabs with its names in unicode as a list, include the tab handler
        appuifw.app.set_tabs([u"One", u"Two", u"Three"],handle_tab)
    
        # set the title of the script
        appuifw.app.title = u'Tabs'
    
        # set app.body to app1 (for start of script)
        appuifw.app.body = app1
    
    # create a tab handler that switches the application based on what tab is selected
    def handle_tab(index):
        global lb
        if index == 0:
            appuifw.app.body = app1 # switch to application 1
        if index == 1:
            appuifw.app.body = app2 # switch to application 2
        if index == 2:
            appuifw.app.body = app3 # switch to application 3
    
    
    
    # create an Active Object
    app_lock = e32.Ao_lock()
    
    round = appuifw.Text()
    round.set(u'press options')
    appuifw.app.screen='normal'
    appuifw.app.body = round
    
    # create the application menu including submenus
    appuifw.app.menu = [(u"Menu1", ((u"submenu1", submenu1),
                                    (u"submenu2", submenu2))),
                        (u"Menu2", ((u"1", submenu1),
                                    (u"submenu3", submenu3))),
    		    (u"tabs", show_tabs)]
    
    
    
    appuifw.app.exit_key_handler = exit_key_handler
    
    # create an active object
    app_lock = e32.Ao_lock()
    
    # start a scheduler
    app_lock.wait()
    Thank(i see that erorr, but is was 1:00AM and i should to slip )

    now, how can i do this thing:
    when i get into the "Tabs", the menu will be hidden(but instead of "Back" button will be show) until i will get out from the "Tabs".

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: tabs in menus

    Quote Originally Posted by XxXYonIXxX View Post
    Thank(i see that erorr, but is was 1:00AM and i should to slip )

    now, how can i do this thing:
    when i get into the "Tabs", the menu will be hidden(but instead of "Back" button will be show) until i will get out from the "Tabs".
    Please explain it again.

    Do you want the menu to not be available? If so, simply set it to an empty list:
    Code:
    appuifw.app.menu=[]
    Do you want the "Options" word to not be visible? I think that's possible with the appuifw2 extension.

  5. #5
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    Re: tabs in menus

    Quote Originally Posted by bogdan.galiceanu View Post
    Please explain it again.

    Do you want the menu to not be available? If so, simply set it to an empty list:
    Code:
    appuifw.app.menu=[]
    Do you want the "Options" word to not be visible? I think that's possible with the appuifw2 extension.
    Yea.
    the "menu" & "exit" will be not available when i in "Tabs"(instead of them, will be "Apply" & "Back").

  6. #6
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    Re: tabs in menus

    Now I use the GUI my application.
    So I want to know how I open the window options (Setting), which includes Tabs in it.

    See code:

    Code:
    import appuifw
    import e32
    from graphics import *
    import camera
    import key_codes
    import graphics
    
    
    im_1 =graphics.Image.open('e:\\python\\resources\\ui\\img_1.jpg')
    im_2 =graphics.Image.open('e:\\python\\resources\\ui\\img_2.jpg')
    im_3 =graphics.Image.open('e:\\python\\resources\\ui\\img_3.jpg')
    im_4 =graphics.Image.open('e:\\python\\resources\\ui\\img_4.jpg')
    photo = im_1
    
    def press_down():
        global photo 
        if photo == im_1:
            photo = im_3
        elif photo == im_2:
            photo = im_4
        canvas.blit(photo)
        
    def press_up():
        global photo
        if photo == im_3:
            photo = im_1
        elif photo == im_4:
            photo = im_2    
        canvas.blit(photo)
        
    def press_right():
        global photo 
        if photo == im_1:
            photo = im_2
        elif photo == im_3:
            photo = im_4  
        canvas.blit(photo)
        
    def press_left():
        global photo
        if photo == im_2:
            photo = im_1
        elif photo == im_4:
            photo = im_3   
        canvas.blit(photo)
        
    def press_select():
        global photo
        if photo == im_1:
            appuifw.note(u"Videos", "info")
        elif photo == im_2:
            appuifw.note(u"Libraries", "info")
        elif photo == im_3:
            appuifw.note(u"Music", "info")
        elif photo == im_4:
            appuifw.note(u"Pictures ", "info")
        canvas.blit(photo)
    
    def handle_redraw(rect):
        global photo
        canvas.blit(photo)
    
    # menu
    def about():
        appuifw.note(u"Vnixe Player Version 0.1 Alpha - Visit At www.vnixe.net ", "info")
    
    def quit():
        app_lock.signal()
    
    #submenu
    def update():
        print ""
        round.set(u'Chack for Update one was selected')
    	
    def credit():
        print ""
        round.set(u'Credits two was selected')
    	
    def feedback():
        round.set(u'Send Feedback three was selected')
    	
    def english():
        print ""
        round.set(u'Englise four was selected')
    	
    def language2():
        print ""
        round.set(u'language2 was selected')
    	
    def add_skin():
        print ""
        round.set(u'Add Skin was selected')
    
    def add_lang():
        print ""
        round.set(u'Add Lang was selected')
    
    def add_plug():
        print ""
        round.set(u'Add Plug-in was selected')
    
    
    def exit_key_handler():
        app_lock.signal()
    
    def show_tabs():
        # create the tabs with its names in unicode as a list, include the tab handler
        appuifw.app.set_tabs([u"General", u"Setting", u"Advance"],handle_tab)
    
        # set the title of the script
        appuifw.app.title = u'Setting'
    
        # set app.body to app1 (for start of script)
        appuifw.app.body = app1
    
    # create a tab handler that switches the application based on what tab is selected
    def handle_tab(index):
        global lb
        if index == 0:
            appuifw.app.body = app1 # switch to application 1
        if index == 1:
            appuifw.app.body = app2 # switch to application 2
        if index == 2:
            appuifw.app.body = app3 # switch to application 3
    
    
    canvas=appuifw.Canvas(redraw_callback=handle_redraw)
    appuifw.app.body=canvas
    canvas.bind(key_codes.EKeySelect, press_select)
    canvas.bind(key_codes.EKeyDownArrow, press_down)
    canvas.bind(key_codes.EKeyUpArrow, press_up)
    canvas.bind(key_codes.EKeyRightArrow, press_right)
    canvas.bind(key_codes.EKeyLeftArrow, press_left)
    
    canvas.blit(photo)
    
    # create the application menu including submenus
    appuifw.app.menu = [(u"Option", ((u"Chack for update", update),
                                     (u"Add Plug-in", add_plug),
    								 (u"Add Skin", add_skin),
    								 (u"Add  Language", add_lang),
    								 (u"Send Feedback", feedback),
                                    (u"Credits", credit))),
                        (u"Language", ((u"English", english),
                                    (u"language2", language2))),
    		    (u"Setting", show_tabs),
    		    (u"About", about)]
    
    			
    appuifw.app.exit_key_handler=quit
    appuifw.app.screen='full'
    appuifw.app.title = u"Venix Player"
    appuifw.app.exit_key_handler = quit
    app_lock = e32.Ao_lock()
    app_lock.wait()
    
    
    # define application 1: text app
    app1 = appuifw.Text(u'Appliation o-n-e is on')
    
    # define application 2: text app
    app2 = appuifw.Text(u'Appliation t-w-o is on')
    
    # define application 3: text app
    app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')
    Last edited by Scolpy; 2008-11-09 at 17:39.

  7. #7
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: tabs in menus

    Quote Originally Posted by XxXYonIXxX View Post
    Now I use the GUI my application.
    So I want to know how I open the window options (Setting), which includes Tabs in it.
    Hi XxXYonIXxX,

    I can't quite understand your question. Do you want to show a form/selection list containing application settings and use tabs at same time?


    BR,

    Rafael.

  8. #8
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    Re: tabs in menus

    Quote Originally Posted by Rafael T. View Post
    Hi XxXYonIXxX,

    I can't quite understand your question. Do you want to show a form/selection list containing application settings and use tabs at same time?


    BR,

    Rafael.
    When I entered the menu (in this case left button) and select the "Settings".
    Settings will open a separate window will be included Tabs(in this case, "General", "Settings & "Advance").

  9. #9
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: tabs in menus

    Quote Originally Posted by XxXYonIXxX View Post
    When I entered the menu (in this case left button) and select the "Settings".
    Settings will open a separate window will be included Tabs(in this case, "General", "Settings & "Advance").
    And the settings would be listboxes or forms?

    Anyway, just rename your variables. For example:

    Code:
    app1 = appuifw.Listbox(labels, handle_list)
    Labels will be the variables with your titles and handle_list the function for handling the options.

    Resuming: just use them as you would use normally


    BR,

    Rafael.
    Last edited by Rafael T.; 2008-11-08 at 18:58.

  10. #10
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    69

    Re: tabs in menus

    I would like in listboxes.
    But if you pay attention to the code.
    When I went into the settings, the screen just stuck (Because settings did not open in a new window).

    can you help me in creating code which will open the proper settings in separate window and not get the same window for disrupting the application?

    BR,
    yonatan
    Last edited by Scolpy; 2008-11-09 at 17:42.

Similar Threads

  1. help with tabs
    By jonmccune in forum Symbian User Interface
    Replies: 6
    Last Post: 2008-06-28, 17:23
  2. Navigation Tabs (or Tabs Pane) in J2ME/Series 60
    By shadisky in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-05-05, 19:48
  3. Navigation Tabs (or Tabs Pane) in J2ME/Series 60
    By shadisky in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-05, 19:43
  4. Can't navigate tabs after adding list!!!
    By advocatee in forum Symbian
    Replies: 7
    Last Post: 2003-07-11, 09:13
  5. Re Display of Tabs
    By jimdeal in forum Symbian
    Replies: 1
    Last Post: 2003-06-20, 20:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×