BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-19-2009, 05:01 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default onClick method for a Dialog?

Please Login to Remove!

hi, i need to have such a thing - a dialog with added three editFields where i can put text and a 'ok' button. and after i click 'ok' my method will be called. Earlier i did it like this:
Code:
 BasicEditField _name = new BasicEditField("Name: ", "");
 BasidEditField _surname = new BasicEditField("Surname: ", "");
 BasicEditField _password = new PasswordEditField("Password: ", "");
	 
UiEngine _ui = Ui.getUiEngine();
Screen _screen = new Dialog(Dialog.D_OK, "Please enter:", Dialog.D_OK,
Bitmap.getPredefinedBitmap(Bitmap.TRUE_BLACK),
	Manager.VERTICAL_SCROLL);
	
//add editFields	
_screen.add(_name);
_screen.add(_surname);
_screen.add(_password);
but i do not know how to do, that after i click 'ok' my method will be called...
Offline  
Old 05-19-2009, 07:26 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok, i've solved it. here is the code:
Code:
UiApplication.getUiApplication().invokeLater(new Runnable(){
			public void run(){

				
   final Dialog d = new Dialog("Enter:",
   new String [] {"Ok"},
   new int [] { Dialog.OK },
              Dialog.OK,
              Bitmap.getPredefinedBitmap(Bitmap.QUESTION));

  BasicEditField _user = new BasicEditField("User: ", "");
				   
   A _a = new A();
				   
   d.setDialogClosedListener(_a);
   d.add(_user);
   d.show();
				
					
	}});
where A is:
Code:
static final class A implements DialogClosedListener{
	
	private Klasy _klasy = new Klasy();
	
	public void dialogClosed(Dialog _dialog, int _choice){
                 myMethod();		
	}
}
kind regards
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





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