Variable row size list field in blackberry - blackberry

I have created an application that contains a list field(custom)
If a certain condition is satisfied I want rowheight to be 100, else it should be 50
How can I do that?
I tried setRowHeight(index,size); But it didn't work. Moreover it's undocumented to.

i did some manipulations in the drawListRow method of the custom list field and i could make a list field with variable row size
if(mycondition==true)
setRowHeight(50);
else
setRowHeight(100);
also in drawrow method i wrote
layout(width, 100);
and it worked for me....
but i m still testing it to check whether it works on all devices and in all conditions
and may be some body else help me to make it better!!!!!

Related

What values can be used in the tags of the method [DJIRemoteController setCustomButtonTags:withCompletion] in objective-C?

I'm trying to configure the C1 and C2 buttons in a custom DJI app. I found that I can call the method setCustomButtonTags:withCompletion, which is part of the DJIRemoteController class.
I tried to fill the DJIRCCustomButtonTags object to provide it as a parameter of the method, but I don't know which values are valid for c1buttontag and c2buttontag. Does anyone knows something about using the setCustomButtonTags method?
Valid values are in range [0, 255] (documentation).
You can set you own values, but it doesn't make the buttons do anything. Instead you could read the values after they are set by DJI's own application, add button listeners, and do some stuff when button state changes.
As far as I know, the values used by DJI's application are not documented anywhere. So you'd have to find out their meaning one by one. And then implement the functionality one by one...
Here is an example (for Android) for implementing button listeners: https://github.com/dji-sdk/Mobile-SDK-Android/issues/286

Any way to extract values from TDBGrid?

if(TPoints->Filter == String(Lat1) + String(" < Latitude AND ")+
String("Latitude< ")+ String(Lat2) + String(" AND ")+
String(Lon2) + String("< Longitude AND ")+
String("Longitude < ") + String(Lon2));
else{
ShowMessage("Invalid Boundries");
}
First time using data access and control components.
TPoints is a TADOTable, results are listed in a TDBGrid. If possible I need to do more than just showing the filtered results (filtering code above) from database. How to go to a specific row or maybe cell and play with it?
To move to a specific record, you have to set the RecNo property of TADOTable.
In a database, moving to a specific field of a record (AKA a cell) does not mean much, unless you want to edit the content of it. The Edit() method of TADOTable can put a record into edit mode, but I'm not sure how you can choose a cell programmatically. It also depends on your design. Normally, the user can start the edit mode by double-clicking on a cell, which takes care of everything automatically. But, if you want to change the data without the user typing it, a TADOQuery and SQL statement is a much better choice.
Be more specific about what you want to happen on the screen and the user's interaction. That way, we can help you better.
By the way, you don't extract data from the grid itself, you extract it from a DataSet (TADOQuery or TADOTable) that the grid is attached to.

How do I handle selecting a property in ABPeoplePickerNavigationController?

I am having some trouble with this.. I see that we are supposed to be using the property:
predicateForSelectionOfProperty
for determining which properties get 'selected', and I'm actually kind of bummed for there not being a
predicateForEnablingProperty
because I only want phone numbers, for my use case.
That said, nothing I use for predicateForSelectionOfProperty seems to do what I want. What I want is, when I select a contact's phone number, it should call the delegate callback.. but instead, right now, it is calling them!
Maybe I'm just completely missing something, because I would actually rather just have a list of my contacts, with phone numbers, and only show the phone numbers.. maybe I'm not even heading in the right direction with this.
Thanks for any help you can offer!
If you don't want it to call the number, you should:
specify the peoplePickerDelegate; and
implement peoplePickerNavigationController:didSelectPerson:property:identifier:
don't specify a predicateForSelectionOfProperty (or if you do, make sure it returns true, e.g. NSPredicate(value: true))
Obviously, if you don't even want it to show you unrelated information about contacts, specify the displayedProperties array, e.g.
controller.displayedProperties = [NSNumber(int: kABPersonPhoneProperty)]
Alternatively, if you wanted to customize this UI further, you could just use the AddressBook.framework to extract the phone numbers from the address book and present whatever UI you want.

Select Multiple, get selected values and non-selected values

I have a select multiple on my page. The user can add elements to the list and remove them selecting one or more.
When I get the select's value through params.selectName, I receive only the selected ones. I
understand that this is the default behavior, but I need all of them, not only selected elements.
I don't really want to select all elements each time I send data to server. Does anyone have a better solution? Thanks.
The approach taken by the <g:checkBox> tag is to create a hidden field with the same name as the checkbox but with an underscore prepended. You could use a similar trick here, i.e. whenever you add a new <option> to the <select> you also add a hidden field named (say) selectName_options with the same value. Then in the controller you can take the difference between params.list('selectName') and params.list('selectName_options') to get the un-selected options from the list.
This is a bit of a complex solution to what should be a simple problem, but in my current project we just had the same problem and solved it as #cdeszaq describes.
Assuming an object of class Foo with a collection (bars) of Bar items, where each Bar has a String name and outputs it as its toString() representation, we do this in the FooController:
def removedItems = fooInstance.bars.findAll {
!params.bars.collect { it.key }.contains(it.name)
}
if(removedItems){
removedItems.each {
fooInstance.removeFromBars(it)
}
}

Is it possible to get label of any text field inside any interceptor?

I have made a custom interceptor to display the error messages in my own format. It is successful to an extent.
But i would like to know can we get label of any textfield directly from invocation object?
Thanks in advance
If your field labels are localized, then yes, you can get the label text. Otherwise, no, since they would just be a string literal in the JSP.
Assuming you have a localized property:
field.firstName = First Name
You can get that from your interceptor using:
LocalizedTextUtil.findDefaultText(
"field.firstName",
invocation.getInvocationContext().getLocale()
);
However, if you provide more details on what you are trying to do, we may be able to offer better solutions.

Resources