×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    2

    Problem with refreshing window.menu

    Hello all,

    I am playing around with widgets and trying then on the Emulator. The problem I have is when trying to refresh the MenuItems of the window.menu object

    Is this a bug of the emulator or am I doing something wrong?

    An example code is here:

    Code:
    var optionsMenu = window.menu;
    optionsMenu.showSoftkeys();
    var m1 = new MenuItem('A', 101);
    var m2 = new MenuItem('B', 102);
    m1.onSelect = menuEventHandler;
    m2.onSelect = menuEventHandler;
    optionsMenu.append(m1);
    optionsMenu.append(m2);
    
    function menuEventHandler(id){
      var optionsMenu = window.menu;
    	switch (id){
               case 101:
                     alert('101');
                     optionsMenu.remove(m1);
                     break;
               case 102:
                     alert('102');
                     optionsMenu.remove(m2);
                     break;
            }
    }
    Where m1 and m2 are global variables

    I get the menu at the startup but when pressing the options 'A' or 'B', nothing happens in the menu but the alert windows are shown...

    Any idea? Bug? Wrong coding? Is this working on a real device?

    Thanks a lot in advance

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    2

    Re: Problem with refreshing window.menu

    Ok,

    I found the "answer" to my own question.

    The menus don't seem to refresh when updated from the handler; but they do when refreshed from a function from outside the handler (a simple call to these functions from the handler works).

    So, the code I pasted last day doestn work, it had to do like this:

    Code:
    function menuEventHandler(id){
    	switch (id){
               case 101:
                     alert('101');
                     
                     break;
               case 102:
                     alert('102');
                     removeMenu(m2);
                     break;
            }
    }
    
    function removeMenu(menuID){
           optionsMenu.remove(menuID);
    }


    Strange to me, but that is what I found

    Regards

Similar Threads

  1. SIP - Registration refreshing problem
    By tamassimon in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-05-08, 09:32
  2. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36

Posting Permissions

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