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

Web and WebWorks Development

Reply
Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: onSwipeDown Menu

What do you mean by style, a CSS style? That, as far as I know, is not possible although Adam may be able to clarify that.

 

Or do you mean different styles of buttons because you can do a mix of different kinds of buttons in the menu, it generates each button based on what you passed it.

 

Basic info:

// swipemenu.addButton(title, callback, alignRight, imagePath) 

For a button that has just an image and no text 

swipemenu.addButton("",doButton,false,"images/icon_options.png");

 And so on. If that doesn't work then it is probably a syntax error or you found a bug.

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: onSwipeDown Menu

Everything works fine, definitely not a bug.

 

I didn't explain myself properly the first time, let me try again. In your code, you've added the CSS using javascript. The buttons in the menubar don't have an ID, they are all <li> elements. So each will have the same style since there really isn't a way to differentiate one from the other. I'd like to have 4 buttons that have a border and then a 5th that does not. That's what I am trying to acheive.

 

I'll play around with it a bit to see if I can find a way.

 

THX

Developer
Posts: 116
Registered: ‎03-08-2011
My Device: Not Specified

Re: onSwipeDown Menu

Easier than I thought. Added a 5th parameter to the addbutton function on the index page:

 

//params (title, callback, alignRight, imagePath, id)
swipemenu.addButton("", swipemenu.close, true, "images/close-button.png", "closeBTN");

 and then updated the swipemenu.js to accept the new param:

 

addButton : function(title, onSelect, alignRight, iconPath, id) {
	var link, fontHeight, img, br, spn, style;
			
	fontHeight = parseInt(height / 2.5, 10);

	link = document.createElement("li");
	if(id){
               link.setAttribute('id',id);				
	}
.
.
.

The addbutton example above will create the DOM element <li id="closeBTN"> that I can style using CSS.

 

Thanks again Rory and Adam for the swipe menu!

Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: onSwipeDown Menu

Beat me to getting the answer Smiley Happy You did exactly what I was going to recommend.

Glad you sorted it out.
--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: onSwipeDown Menu

Hey that's not a bad idea!  Hadn't gotten that far ahead, but I can see many good use cases for customizing the menu further.

 

Why don't I add this as a feature enhancement, and we get integrate this into a future version of the sample?

 

https://github.com/blackberry/WebWorks-Samples/issues/22

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: onSwipeDown Menu

I really appreciate the .js! 
Although one thing - am I wrong, or does it not work if you have an <embed> element in your app? 

-----------------------------------------------------------------------------------------



Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: onSwipeDown Menu

I'm not sure.  I wouldn't have imagined so.

 

If you think its a bug, can you file an issue here:

 

https://github.com/blackberry/WebWorks-Samples/issues

 

Maybe provide a snippet of HTML / sample code that can reproduce the problem?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.