Setting of Images in Blackberry - image

May I know how to set background images to a Button in Blackberry?

Try following links:
User Defined Buttons - Create a Custom Button From an Image
Tutorial: Creating a custom button
Blackberry Custom Button Field
You can get your customized button by extending ButtonField or Field. In case of ButtonField you have to override default paint(...), paintBackground(...), drawFocus(...), applyTheme(...) etc.
paint(...) - can draw image or other geometric figures instead of text
paintBackground(...) - define how should your button's background look
drawFocus(...) - define how the button looks when it got focus
applyTheme(...) - do nothing if you want to remove default styling
If you extend Field, you will get more option for customization.

Look at the article, ButtonField with Image as a BackGround. It will helps you.

Check out the code here which explains to create custom-image-buttonfield-in-blackberry

Related

Multiple controls on Xamarin button?

I would like complex button, which has several text elements and which should change their state and color depending on button state.
Unfortunately, I see that Xamarin button has only predefined image and text parameters.
How to have multiple controls inside a button in Xamarin?
Visual state manager(Only XF 3.0+) have three states: normal, disabled, focused which is named "CommonStates", or you can create custom states.Maybe it could help:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual-state-manager
I think you must read more in content view, where you can add labels into stacklayout or grid with your own api bindable property, then use it wherever you want in your code:
https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.contentview

how to create custom pop up in Xamarin forms

I am newbie to Xamarin.Forms and stuck with a situation where I want to Create up a popup box with my control details.
How can I open and create custom dialog box / popup using Xamarin.Forms?
Any example code will be appreciated?
Thanks in advance!
What I have used is a StackLayout(or any layout) within a grid (or even an absolute layout ) this main grid will have 2 children. The IsVisible property of the popup layout will be set to false and when it is needed then the IsVisible property will be set to true and it will appear, something like this:
Grid mainGrid = new Grid{};
mainGrid.Children.Add(mainLayout,0,0);
mainGrid.Children.Add(popUpLayout,0,0);
Content = mainGrid;
if what you want is different then a custom renderer will be the way. Here are some helpful links:
http://blog.ostebaronen.dk/2013/02/using-dialogs-in-mono-for-android.html
https://forums.xamarin.com/discussion/30456/xamarin-forms-control-into-a-native-custom-dialog-android
There are different kind of things to achieve this, but I will say play with the layouts because it will work for all 3 platforms.
The Frame will be useful also:
https://developer.xamarin.com/api/type/Xamarin.Forms.Frame/

How do I add a title to a button which has a custom image?

I made a button with IB then added custom images for different states but my title never appears on my button. How can I fix it? In fact, I just want to add my text over the image.
You can set your button images as background images in interface builder, then the text will appear.
It will not appear because the image is on top of it, you can either:
1) Use backgroundImage instead of image
2) Create an image with the text already on it
3) Create a button with a transparent part where the text will go
4) Have your image and your text in the button, but say one on the left and one on the right, you can do this with this properties: titleEdgeInsets and imageEdgeInsets
5) Add the label and uiimage as subviews of uilabel.
start with a regular button type in the title and switch it to a custom button, if you want the background to be changed import and use the command yourButton.backgroundColor = [UIColor grayColor];
Try to change the Button type to "Custom" and then add the image as Background Image. Now u will be able to see the desired look.

Cocoa: Accessibility (VoiceOver) for buttons with image only

I use NSButton with empty title and image on it, and it cannot be accessed with VoiceOver.
But when I'm setting title (VoiceOver seems to use title), NSButton tries to show it.
I think there should be an easy way to not display title, or to set button text, used by VoiceOver, however quick search didn't give any results yet.
P.S. I'm creating button programmatically.
you must assign the accessibilityLabel to the image object directly, It works this way.
Solved issue - added subclass for NSButtonCell, which does nothing in drawTitle: method and returns NSZeroRect. Seems to work ok.

Changing images of toolbar buttons dynamicaly

I have a tool bar with buttons whose image is set to a particular image.When the user clicks a button in the main view, i want to change the image of one of the toolbar buttons to another image.I tried many methods.Everything ran without errors, but none showed any change in toolbar.Any suggestions?
There is a tutorial for this:
How-to-change-a-uibarbuttonitem-in-the-iphone-toolbar
This is a great tutorial because it goes over changing the images based on state as well.

Resources