Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
Accepted Solution

How to force Button to remain pressed

[ Edited ]

I cant find property to make button pressed all the time. I want to use buttons as a toggle, when I press it I want it to stay pressed until I tell it to depress.

 

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: How to force Button to remain pressed

Probably you would be better off using ToggleButton or ImageToggleButton...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__togglebutton.html

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__imagetogglebutton.html


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook

Re: How to force Button to remain pressed

I thought of ImageToggleButton but its extra work. I wish I could just do button.state = ButtonState.Pressed or something like that

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: How to force Button to remain pressed

A little extra work maybe, but if you've read my posts on here before you'll see I always advise against changing the way standard controls behave, usually quickly followed up by one of the BlackBerry advisers backing that up.

 

So a little extra work for you but for the user no surprises. :smileyhappy:


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
simon_hain
Posts: 16,201
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to force Button to remain pressed

my guess is posting and replying to the question here was already more time invested than using the control designed for this behavior.
I agree with BBSJdev, it is best to follow the platform design guidelines unless you have very good reason not to.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: How to force Button to remain pressed

I am here to back up BBSJDev :smileyhappy:

 

Toggle buttons are probably the right choice for you here. Normal buttons don't stay pressed on our platform.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Developer
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook

Re: How to force Button to remain pressed

[ Edited ]

I am working on a scenario where I want user to compare two fields and indicate his desire to select one in a most easy way.

 

togglesample.png

 

 

Natural way is to present two fields one next to another (above another in this case) and have the user tap on one. Since the action does not confirm right away I want the button to remain pressed indicating user selection until user confirm the action via Actionitem.

 

Thats why having button stick to selected state would be helpful. 

 

ToggleButton does not work well in this case.

 

I will look into creating custom image naps for IageToggleButton but as I said its more work.

 

Thanks everyone though - as always helpful pointint to the right direction.

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.