BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-06-2007, 09:54 AM   #1
sn0wshrew
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Verizon
Posts: 24
Default Scroll arrows in non-focused ListField in a MainScreen

Please Login to Remove!

I'm creating an application where I attempt to duplicate the UI layout of the built-in MemoPad app: a listfield and, in the status, a search bar. Both of them must appear to have the focus, and both of them must behave as though they have the focus, but the search bar handless keypress events while the listfield handles scroll and click events.

Unfortunately, I seem to have run into a paradox where if either one doesn't actually have focus, it cannot be made to behave correctly:
  • If the search bar (an AutoTextEditField) does not have focus, it does not composite text correctly on the BlackBerry Pearl. I tried forwarding keyChar events to it, but at this point the text is already composited (incorrectly) by the focused field.
  • If the ListField does not have focus, I can make it behave 99% correctly by sending moveFocus events from the AutoTextEditField there; but scroll arrows are never painted by its manager. The manager only draws scroll arrows if its contents have focus, it seems. I could override this behavior with a custom manager, but I don't really control it because I'm using a MainScreen. And no, I don't want to switch to a FullScreen, because the Mainscreen provides a HUGE amount of useful functionality that I'm already using - I would basically have to rewrite the MainScreen class from scratch.

Snippets of code follow, to give you an idea of what I'm doing. Any ideas for how to force the MainScreen's manager to show scroll arrows, or for how to force a non-focused AutoTextEditField to composite text correctly on the Pearl?

Code:
	// This is the constructor for the Screen that descends from MainScreen.
	public ListScreen() 
	{ 
		super();

		// Create the big list control.
		customList = new CustomListField();
		
		// Add the big list control and its search bar to the screen.
		add(customList);
		setStatus(customList.getSearchBar());
	}

	// This is the constructor for the custom list that descends from ObjectListField.
	CustomListField()
	{
		super(Field.NON_FOCUSABLE);
		final CustomListField list = this;

		// Search bar must be FOCUSABLE to do input autocompletion for the Pearl.
		this.searchBar = new AutoTextEditField("Search: ", "", 20, Field.EDITABLE | TextField.NO_NEWLINE)
		{
			// Send all scroll events to the list.
			protected int moveFocus(int amount, int status, int time)
			{
				list.moveFocus(amount, status, time);
				return 0;
			}
		};
	}
Offline  
Old 11-06-2007, 12:19 PM   #2
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

Try this:

public ListScreen()
{
super(Manager.VERTICAL_SCROLLBAR);
Offline  
Old 11-06-2007, 01:38 PM   #3
sn0wshrew
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Verizon
Posts: 24
Default

Thanks for the suggestion, bemshaswing! However, I'm afraid it doesn't work. The manager already is willing to show scroll bars, but only if the list has focus; and adding this style doesn't make it show scroll arrows when focus is in the search bar.
Offline  
Old 11-07-2007, 04:25 AM   #4
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

hmmm - interesting problem, i looked at the memopad app and it's a bit of a challenge to figure it out - the input field always seem to be in focus even when scrolling the list.

it looks to me like one solution would be to have the search/find inputfield always have focus and trackwheel roll being overridden to change the selected index on the list field (and of course returning true to keep focus on the inputfield)
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 11-07-2007, 09:04 AM   #5
sn0wshrew
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Verizon
Posts: 24
Default

Hi jfisher, that's exactly what I'm trying to do! Like I said, that works for 99% of the scroll functionality. The only thing that's missing is getting the MainScreen's manager to show its scroll arrows when it doesn't have focus. This is clearly working in the MemoPad app, I just don't know how - any ideas?
Offline  
Old 11-07-2007, 09:25 AM   #6
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

gotcha, haha, absolutely none then! sneaky rim developers are doing something strange:- and probably simple if you know how.

another guess would be the input field never has focus and they're creating their own custom inputfield - the listfield loses focus the moment you hit a key anyway - the caret might be a redherring and is drawn using methods overridden in an extended inputfield class. (i did something similar here but never implemented the caret: Wikipedia Application for BlackBerry - but there's more info in the javadoc about creating your own fields)

or can you live without having the arrows on screen?
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!

Last edited by jfisher; 11-07-2007 at 09:27 AM..
Offline  
Old 11-07-2007, 10:11 AM   #7
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

Here's another idea, though I have to admit, I can't get it to work.

According to the api, if within your screen you ovveride the isDownArrowShown method, it *should* implement as you want. I however have yet to see this work properly, I won't necessarily call it a bug, but I know that this method is called by the framework but the screen doesn't respond to it. Maybe I'm doing something wrong

example:

protected boolean isDownArrowShown() {

return true;

}
Offline  
Old 11-07-2007, 10:39 AM   #8
sn0wshrew
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8830
PIN: N/A
Carrier: Verizon
Posts: 24
Default

I do think that MemoPad isn't using a custom text field that somehow composits input even without having focus - its behavior seems perfectly normal for a focused text field. I do think that they are simulating the list having focus even though it doesn't.

bemshaswing, overriding the screen's isUpArrowShown() method is a great idea - but I too could not get it to work. I think because it's the manager that would make this decision, rather than the screen. I even tried creating a custom manager and putting it inside the MainScreen's getMainManager(), and putting the list inside the custom manager, but I was not able to find any configuration of this which would actually show scroll arrows and still have the correct drawing and scroll behaviors.

Quote:
can you live without having the arrows on screen?
Until a few minutes ago the answer was "no", because it's a pretty bad user experience not to know whether they are at the top of the list.

However... I just had an idea for a workaround that may be adequate. If I scroll up/down a little farther than necessary, giving a "peek" of the next row above/below, that should be enough to indicate to the user whether they're at the top of the list yet. I'll let you guys know how that goes - thanks again for the suggestions!!
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Johnson Controls Metasys MS-VMA 1610-0 Variable Air Volume Controller / WARRANTY picture

Johnson Controls Metasys MS-VMA 1610-0 Variable Air Volume Controller / WARRANTY

$200.00



Metasys AS-VAV111-1 Variable Air Volume Digital Controller 24Vac picture

Metasys AS-VAV111-1 Variable Air Volume Digital Controller 24Vac

$139.00



Johnson Controls MS-NCE 2560-0 Metasys Network Control Engine picture

Johnson Controls MS-NCE 2560-0 Metasys Network Control Engine

$150.00



Johnson Controls NAE Metasys MS-NAE5510-2 Ver 5.2 Unit Untested  - with battery picture

Johnson Controls NAE Metasys MS-NAE5510-2 Ver 5.2 Unit Untested - with battery

$198.00



JC METASYS XP9102 picture

JC METASYS XP9102

$200.00



MS-VMA1620-0 JOHNSON CONTROLS METASYS  Control W Manual Override  NEW Open BOX picture

MS-VMA1620-0 JOHNSON CONTROLS METASYS Control W Manual Override NEW Open BOX

$250.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.