×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    50

    LWUIT: Getting clicks in ContainerList

    I have an app using LWUIT for Series 40. This app uses ContainerList. The cells of the ContainerList contain various buttons that need to be clickable. However, it seems that the ContainerList is interception all clicks. How can I get clicks on individual components in a ContainerList?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,567

    Re: LWUIT: Getting clicks in ContainerList

    I guess Shai's comment in #4 of http://developer.nokia.com/Community...stCellRenderer is what you could follow, and modify LWUIT code (perhaps inheriting from ContainerList may be enough)

  3. #3
    Registered User
    Join Date
    Dec 2012
    Location
    India
    Posts
    264

    Re: LWUIT: Getting clicks in ContainerList

    I am not sure if this is applicable to a container list as well, but, in general , a list is stateless.

    Check this : http://lwuit.blogspot.in/2011/05/cli...-renderer.html

  4. #4
    Registered User
    Join Date
    Sep 2013
    Posts
    50

    Re: LWUIT: Getting clicks in ContainerList

    Quote Originally Posted by wizard_hu_ View Post
    I guess Shai's comment in #4 of http://developer.nokia.com/Community...stCellRenderer is what you could follow, and modify LWUIT code (perhaps inheriting from ContainerList may be enough)
    Can anyone tell me exactly what I need to change? I can subclass ContainerList, but I don't see how I can intercept these clicks.

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: LWUIT: Getting clicks in ContainerList

    You should check out what wizard wrote on #2 where he mention what i wrote on that other thread
    this is your answer....

  6. #6
    Registered User
    Join Date
    Sep 2013
    Posts
    50

    Re: LWUIT: Getting clicks in ContainerList

    Quote Originally Posted by shai.i View Post
    You should check out what wizard wrote on #2 where he mention what i wrote on that other thread
    this is your answer....
    Thanks for responding. I'm really looking for help on how to "make some corrections to the actual lwuit code to pass the pointer methods call to the inner components of your cell renderer."

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: LWUIT: Getting clicks in ContainerList

    Well for me i have a local copy of the LWUIT source and i have modified the ContainerList inner class Entry
    so that it contians the following code
    Code:
     public void longPointerPress(int x, int y) {
            	super.longPointerPress(x, y);
            	pointerReleasedImpl(x, y, true);
            }
            
            /**
             * @inheritDoc
             */
            public void pointerReleased(int x, int y) {
            	super.pointerReleased(x, y);
            	pointerReleasedImpl(x, y, false);
            }
            
            public void pointerReleasedImpl(int x, int y, boolean longPress) {
                super.pointerReleased(x, y);
                if (!isDragActivated()) {
                    // fire the action event into the selected component 
                    Component cmp = renderer.getCellRendererComponent(ContainerList.this, model, model.getItemAt(offset), offset, hasFocus()); 
                     if(cmp instanceof Container) { 
                    	 int absX = getAbsoluteX();
                    	 int absY = getAbsoluteY();
                    	 int newX = x - absX + cmp.getX();
                    	 int newY = y - absY + cmp.getY();
                    	 Component selectionCmp = ((Container) cmp).getComponentAt(newX, newY);
                    	 if(selectionCmp != null) {
                    		 newX = x - absX;
                    		 newY = y - absY;
                    		 if(longPress){
                    			 selectionCmp.longPointerPress(newX, newY);
                    		 }else{
                    			 selectionCmp.pointerPressed(newX, newY);
                    			 selectionCmp.pointerReleased(newX, newY);
                    		 }
                    	 }
                    } 
                    dispatcher.fireActionEvent(new ActionEvent(ContainerList.this, x, y));
                }
            }
    I actually have been meaning to try and get it to contribute/commited to the lwuit_for_s40 project but since the projects home is now moving and more i'm not sure where is the latest version is hosted and who to ask for it to be commited.
    If anyone want to help follow up on this then please let me know ( i have more code fixes for bugs and etc but time is stressed for me to chase it)

Similar Threads

  1. ContainerList Cell Selection
    By james.harpe in forum Mobile Java UI and User Experience
    Replies: 2
    Last Post: 2013-10-23, 14:47
  2. ContainerList: How to detect/skip initial calls to getCellRendererComponent
    By james.harpe in forum Mobile Java UI and User Experience
    Replies: 10
    Last Post: 2013-10-16, 22:17
  3. ContainerList problems
    By james.harpe in forum Mobile Java UI and User Experience
    Replies: 13
    Last Post: 2013-10-10, 16:05
  4. ContainerList click listener
    By james.harpe in forum Mobile Java UI and User Experience
    Replies: 1
    Last Post: 2013-10-01, 19:26
  5. Key Clicks
    By smb101 in forum Mobile Java General
    Replies: 1
    Last Post: 2006-04-23, 23:14

Posting Permissions

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