Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

How to detect button click or press on the screen of playbook?

[ Edited ]

How to detect button click or press on the screen of playbook?

 

Problem: Tried to add a button. After button is pressed, the button function will work.

              But, cannot find button press or link reference, which can like button function with button.

 

The code is at below.

dialog_create_alert(&main_dialog);
dialog_set_title_text(main_dialog, "Data Logger");
dialog_set_size(main_dialog, DIALOG_SIZE_FULL);
dialog_set_group_id(main_dialog, get_window_group_id());
dialog_set_cancel_required(main_dialog, true);
dialog_add_button(main_dialog, "Start", true, 0, true);

 

For example, In java,

 

private ButtonField startButton;

startButton = new CustomButton(60, 200, "Start");
startButton.setChangeListener(this);
vetcenter.add(startButton);

 

//I could not find a any related code at below in Native SDK or C programming code.

 

public void fieldChanged(Field field, int context) {
if(field == startButton){
butstart();

}

 

How do I link button with button-press function.?

 

Hopefully, the probelm is clearly addressed.

 

Thank your attention,

 

-Fight with BB10
Highlighted
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to detect button click or press on the screen of playbook?

Not sure I understand your question but take a look at very nice  Dialog example at github https://github.com/blackberry/NDK-Samples/tree/master/DialogSample