You Are Here:

Community: Developer Discussion Boards

#1 Old Adding items in context menus - 2007-05-21, 09:27

Join Date: May 2007
Posts: 2
frankiboy
Offline
Registered User
Hi,

I've been looking around for a way to add items to context menus.

As an example: When you have highlighted a phone number and press options, you get a menu where you can select to use the phone number (edit or copy), or you can start a voice or video call.

The same happens when you select options when a picture is highlighted.

What I would like to do is to add an item to the context menu for phone numbers. When I have highlighted a phone number and press options, I want to be able to start a python script with the phone number as input parameter.

Is this possible? How?

Thanks!
Frank
Reply With Quote

#2 Old Re: Adding items in context menus - 2007-05-21, 10:30

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi frankiboy and welcome to the forum

To achieve what you want, have a look at appuifw.app.menu in the PyS60 doc for the menu.

Here is how you use it; item1, subitem1 and subitem2 are functions:

Code:
appuifw.app.menu = [(u"Item 1", item1),
                    (u"Submenu 1",
                        ((u"Subitem 1", subitem1),
                         (u"Subitem 2", subitem2)))]
Now if you combine that with a Listbox, you do what you want:
Code:
# listbox entries
entries =[ u'Number0', u'Number1', u'Number2']

# callback when select is pressed: sends the id of the current selected item 
# in the listbox.
def lbox_observe( aId ):
    # do something with it
    pass

def start_script():
    # get the index of the current selected item 
    index = lb.current()

    # get the number at the index
    number = entries[index]

    # do something with the number

# create a listbox
lb = appuifw.Listbox(entries, lbox_observe)

# set the menu
appuifw.app.menu = [(u"Start script", start_script)]

#...
Here are some links you might need:
Happy Pythoning!

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#3 Old Re: Adding items in context menus - 2007-05-22, 10:17

Join Date: May 2007
Posts: 2
frankiboy
Offline
Registered User
Thanks!

I guess what I want can be done like this, but I was expecting that I could register a program for a given data type. Just like you can do in MS windows (Assigning programs to file types, so you can select "open with.." in explorer).

This way Python will start on request, instead of lurking in the background..

Frank
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Items to Custom ListBox at runtime nickyc Symbian User Interface 0 2007-05-01 15:15
Adding items to menu gives "Program closed" mozgido General Symbian C++ 2 2007-03-06 18:59
Adding Menu Button Items in 9300 Maribou General Messaging 2 2007-02-22 10:05
adding context-sensitive menus to popup choice-groups Larry101 Mobile Java General 2 2006-10-02 12:28
Adding items to CAknSingleHeadingStyleListBox Shabs Symbian User Interface 6 2004-09-09 10:46

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ