BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-26-2008, 09:41 AM   #1 (permalink)
New Member
 
Join Date: Sep 2007
Model: 7100
PIN: N/A
Carrier: GT
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Focus State

Please Login to Remove!

Hi,

How can I change focus state of field at anytime?
Is any function like Field.setEditable()

Thanks.
Offline  
Old 03-26-2008, 10:30 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

how about Field.setFocus()?
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 03-26-2008, 10:38 AM   #3 (permalink)
New Member
 
Join Date: Sep 2007
Model: 7100
PIN: N/A
Carrier: GT
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Field.setFocus() cant solve my problem. Some case my field must be non_Focusable, and some case focusable.

For example;

Code:
startDate  = new DateField("Start Date",System.currentTimeMillis(),dateFormat,Field.READONLY|Field.NON_FOCUSABLE);

finishDate = new DateField("End Date",System.currentTimeMillis(),dateFormat,Field.READONLY|Field.NON_FOCUSABLE);
.
.
    	startDate.setEditable(selectedindex==3);
        finishDate.setEditable(selectedindex==3);

I want to fields focusable when it's editable
Offline  
Old 09-09-2008, 04:05 AM   #4 (permalink)
New Member
 
Join Date: Jan 2008
Model: 7290
PIN: N/A
Carrier: School Project
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

It seems like I'm not the only one that encountered such problem. The solution I finally came up was overriding "isFocusable" method

Here's the note from the API Documentation

Handling focus issues
If you want your field to receive the focus, then you must override isFocusable to return true.

so just do..

private void isFocusable(){
return false;
}


If you don't want your field to be focusable, you just return false.



Some people might want to make the field looks like "disabled" like what we usually do in C#, disabling textbox, label, etc so it's gray color.


What I did is overriding the paint method to make like the below code

protected void paint(Graphics graphics) {
if (!this._isFocusable)
graphics.setGlobalAlpha(50);
}

make it looks like it's disabled.....
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

^^FAIRCHILD SEMICONDUCTOR P/N BD13710STU - NEW (CC)
$175.0
^^FAIRCHILD SEMICONDUCTOR P/N BD13710STU - NEW (CC) pictureNATIONAL SEMICONDUCTOR CD4503BMJ/883C IC QTY: 10 (U8.2B4)(U9.1B2)
$79.91
NATIONAL SEMICONDUCTOR CD4503BMJ/883C IC QTY: 10 (U8.2B4)(U9.1B2) picture3 PCS OF NATIONAL SEMICONDUCTOR NSM3900 NSM3914 LED Bar Graph Array with Driver
$85.62
3 PCS OF NATIONAL SEMICONDUCTOR  NSM3900 NSM3914 LED Bar Graph Array with Driver pictureNew Bussmann FWP-10B Semiconductor Fuse 10 Amps 700 Volts
$29.99
New Bussmann FWP-10B Semiconductor Fuse 10 Amps 700 Volts picture20 PCS LAS6351 Semiconductor
$345.0
20 PCS LAS6351 Semiconductor picture






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