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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Trusted Contributor
lyon819
Posts: 243
Registered: ‎08-19-2010
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
Please use plain text.
Developer
BGmot
Posts: 956
Registered: ‎11-24-2011
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

 

Please use plain text.