You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by pavan vadavalli <pa...@gmail.com> on 2012/09/26 12:36:09 UTC

Context Menu with Multiple Selections

Hi,
I want to create a control like attached. Basically a context Menu with 
Multiple Items that can be selected and deselected.

when the following Menu Section is created (basically a lift from 
Context menu example from Kitchen Sink), i am able to have each Button 
as individual selectable items, but once the option is selected, the 
option doesn't switch off.
I tried to listen to the butttonPressListner and wanted to toggle 
selected State, but all through the listen events i always got Selected 
as true.

I see that something similar is done in the List box with  multiple
Need quick help, Please.


<Menu.Section xmlns:bxml="http://pivot.apache.org/bxml"
     xmlns="org.apache.pivot.wtk">
     <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup"/>
     </bxml:define>
     <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup1"/>
     </bxml:define>
      <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup2"/>
     </bxml:define>
<!-- $imageMenuGroup -->
     <Menu.Item  bxml:id="button1" buttonData="IMG_0725_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup" action="selectImageAction">
         <userData image="IMG_0725_2.jpg"/>
     </Menu.Item>
     <Menu.Item  bxml:id="button2" buttonData="IMG_0735_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup1" action="selectImageAction">
         <userData image="IMG_0735_2.jpg"/>
     </Menu.Item>
     <Menu.Item  bxml:id="button3" buttonData="IMG_0767_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup2" action="selectImageAction">
         <userData image="IMG_0767_2.jpg"/>
     </Menu.Item>
</Menu.Section>

Thanks and Regards,
Pavan

Re: Context Menu with Multiple Selections

Posted by pavan vadavalli <pa...@gmail.com>.
perfect...Worked like a charm!!
Thanks Roger...

On Tuesday, 2 October 2012 7:33:12 AM, Roger L. Whitcomb wrote:
> I don't think you need the ButtonGroup stuff in there at all.  When you
> put something in a button group, it is expecting that one of the group
> will always be selected, and since you only have one in each group, that
> one will always be selected!  Try it without the groups and see what you
> get.
>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: pavan vadavalli [mailto:pavan.vadavalli@gmail.com]
> Sent: Wednesday, September 26, 2012 3:36 AM
> To: user@pivot.apache.org
> Subject: Context Menu with Multiple Selections
>
> Hi,
> I want to create a control like attached. Basically a context Menu with
> Multiple Items that can be selected and deselected.
>
> when the following Menu Section is created (basically a lift from
> Context menu example from Kitchen Sink), i am able to have each Button
> as individual selectable items, but once the option is selected, the
> option doesn't switch off.
> I tried to listen to the butttonPressListner and wanted to toggle
> selected State, but all through the listen events i always got Selected
> as true.
>
> I see that something similar is done in the List box with  multiple Need
> quick help, Please.
>
>
> <Menu.Section xmlns:bxml="http://pivot.apache.org/bxml"
>       xmlns="org.apache.pivot.wtk">
>       <bxml:define>
>           <ButtonGroup bxml:id="imageMenuGroup"/>
>       </bxml:define>
>       <bxml:define>
>           <ButtonGroup bxml:id="imageMenuGroup1"/>
>       </bxml:define>
>        <bxml:define>
>           <ButtonGroup bxml:id="imageMenuGroup2"/>
>       </bxml:define>
> <!-- $imageMenuGroup -->
>       <Menu.Item  bxml:id="button1" buttonData="IMG_0725_2.jpg"
> toggleButton="true"
>           buttonGroup="$imageMenuGroup" action="selectImageAction">
>           <userData image="IMG_0725_2.jpg"/>
>       </Menu.Item>
>       <Menu.Item  bxml:id="button2" buttonData="IMG_0735_2.jpg"
> toggleButton="true"
>           buttonGroup="$imageMenuGroup1" action="selectImageAction">
>           <userData image="IMG_0735_2.jpg"/>
>       </Menu.Item>
>       <Menu.Item  bxml:id="button3" buttonData="IMG_0767_2.jpg"
> toggleButton="true"
>           buttonGroup="$imageMenuGroup2" action="selectImageAction">
>           <userData image="IMG_0767_2.jpg"/>
>       </Menu.Item>
> </Menu.Section>
>
> Thanks and Regards,
> Pavan

RE: Context Menu with Multiple Selections

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
I don't think you need the ButtonGroup stuff in there at all.  When you
put something in a button group, it is expecting that one of the group
will always be selected, and since you only have one in each group, that
one will always be selected!  Try it without the groups and see what you
get.

~Roger Whitcomb

-----Original Message-----
From: pavan vadavalli [mailto:pavan.vadavalli@gmail.com] 
Sent: Wednesday, September 26, 2012 3:36 AM
To: user@pivot.apache.org
Subject: Context Menu with Multiple Selections

Hi,
I want to create a control like attached. Basically a context Menu with
Multiple Items that can be selected and deselected.

when the following Menu Section is created (basically a lift from
Context menu example from Kitchen Sink), i am able to have each Button
as individual selectable items, but once the option is selected, the
option doesn't switch off.
I tried to listen to the butttonPressListner and wanted to toggle
selected State, but all through the listen events i always got Selected
as true.

I see that something similar is done in the List box with  multiple Need
quick help, Please.


<Menu.Section xmlns:bxml="http://pivot.apache.org/bxml"
     xmlns="org.apache.pivot.wtk">
     <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup"/>
     </bxml:define>
     <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup1"/>
     </bxml:define>
      <bxml:define>
         <ButtonGroup bxml:id="imageMenuGroup2"/>
     </bxml:define>
<!-- $imageMenuGroup -->
     <Menu.Item  bxml:id="button1" buttonData="IMG_0725_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup" action="selectImageAction">
         <userData image="IMG_0725_2.jpg"/>
     </Menu.Item>
     <Menu.Item  bxml:id="button2" buttonData="IMG_0735_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup1" action="selectImageAction">
         <userData image="IMG_0735_2.jpg"/>
     </Menu.Item>
     <Menu.Item  bxml:id="button3" buttonData="IMG_0767_2.jpg" 
toggleButton="true"
         buttonGroup="$imageMenuGroup2" action="selectImageAction">
         <userData image="IMG_0767_2.jpg"/>
     </Menu.Item>
</Menu.Section>

Thanks and Regards,
Pavan