ButtonField click event - blackberry

i am not implementing touch event. i am using FieldChangeListener the problem which i am facing is , if i am clicking outside the CustomButtonField then also the click event is generated how should i restrict only to the CustomButtonField.
Thanks alot

The listener will be invoked on all change events but you also get the field that changed (in the fieldChanged function), so why not use that to make sure it is your field that was "changed"?

Related

Vaadin flow grid prevent itemClickListener() to fire on click on buttons in ComponentColumns

With vaadin 23.1.x you can set a itemClickHandler when a user click on a item/row in the grid with myGrid.addItemClickListener(..)
This works fine.
But if you have a component column, with a button in it, then the ClickEvent of the Button is fired and also the itemClickListener of the grid row.
Is there a way to prevent the button click from also triggering the itemClickListener?
You must use this method to add the listener them you can
myGrid.getElement().addEventListener("item-click",
event -> ...)
.addEventData("event.stopPropagation()");
I'm not 100% sure if the even is item-click or just click.

TToolbar Button with dropdown menu greyed out

I'm having issues getting a TToolbar Button to appear "enable"
The button has an Action assigned to it - which is fire by the OnClick event
It is also setup with a Drop Down Menu, which has 2 options on it, both of which are enabled, and both of which fire off when clicked.
Despite all this the TToolbar Button steadfastly remains greyed out, but accepts the clicks.
Any suggestions?
You're doing things wrong. :-)
When using actions, you don't use the button's OnClick event - you put the code in the action's OnExecute event instead (because that's what's executing - the action - and not the button). When an action is assigned to the control, the control cannot be enabled until there's a handler for the TAction.OnExecute.
The reason for using actions is so you can put the code in a single place (events related to the action), and then every single control attached to that action uses that common code to perform the same functionality. Editing the code in that single location means all controls attached to that action see the same changes.
If there's nothing attached to the TAction.OnExecute event, the control has nothing to do if it was selected (clicked), and so there's no reason to enable it in the first place.
In case someone else comes across this, I just had this problem (using Delphi 10.2 Tokyo).
For some reason, the "EnableDropdown" property on the TToolButton caused the button to to be greyed out when set to true. Setting this property to false seems to have resolved the problem for me (the dropdown menu remains functional anyway).

Child field event handling issue in custom HorizontalFieldManager

I am trying to create a customized list field where, I have more then 2 clickable buttons in each row. For that i have customized the HorizontalFieldManager and created own manager to align the field elements. Now UI is perfectly fine.
But, I am struggling to handle the events work for both.
Step-1 I have used fieldChangedListener for buttons added in row. It is working fine
public void fieldChanged(Field field, int context) {}
step-2 have used navigation click to handle event on the parent manager.
protected boolean navigationClick(int status, int time) {
Field field = getFieldWithFocus();
Dialog.alert("shops field clicked");
return super.navigationClick(status, time);
}
Now, even the navigationClick event works. But as the button is the child field added to VFM. When i click on the button both the VFM and button event comes together.
How could i restrict only to the button while it is clicked on the ButtonField.
If I understood your question correctly, you want the navigationClick() to be called only for the child field (clickable button) without being called for the manager. Sorry to disappoint you, but you can't.The navigation click event will always be called first for the manager and only than the manager will propagate the event to the child field. The same hold for keys events, touch events, focus events and etc...
Describe what you are trying to achieve, add a code snippet and I am sure we will find a solution.

How to set trackball click listener for EditField

I want to set an listener for EditField so that whenever user clicks on the EditField (Not a touch screen) it redirects to a page and i perform some operations on it. Thank you
Actually, we cant set trackball listener for editfield. If you want it i think there is a method. Use navigationClick() method along with trackwheel events. But there are no trackball events.

Delphi: ToolButton & Action - funny

I have a tool button and an assigned to it action. But the action doesn't have an on click event, there is no code for a click. Therefor the button is disabled, how to change it to be enabled?
Thanks!
When an action has no OnExecute handler, the action is always disabled. If you want to assign an action to an object, and have that object be enabled, then you need to provide an OnExecute handler.
The question sounds a little odd though. Why would you have a button which, when pressed, does nothing? Do you perhaps, have an OnClick handler that is defined in the button rather than the action? If so then you should simply move that handler into the action and all will be well.
Update
Ulrich helpfully points out that the DisableIfNoHandler of TAction can be used to change the behaviour described above. Since this has public visibility and is not published, you have to make the change in code which is why I think I forgot about it.

Resources