Auto complete a dropdown menu in a cq5 dialog based on input from a previous dialog field - aem

My custom CQ5 component has a dialog which consists of 2 drop down menus. I would like to automatically set a default value to second menu depending on whatever is the value selected from the previous drop down.
How can I achieve this?

you can register handlers for different events triggered by the widgets. You can use the "selectionchanged" event to register a function that will read the new content from the dropdown and then use the setValue() method in the second dropdown to put whatever you want there.
To obtain the second dropdown from the first you can use the nextSibling() method.
The widget documentation will help you a lot. look for "selection"

Related

How to change the Form according to the item selected in the drop Down menu in Flutter

I have created I method which is showing a dialog and I called it with timer.run() method in order to show the dialog at the start of the screen automatically in which i have created a form (the code snippet is attached in the photos) and the form contains drop-down menu with two items(check and bank) now i want to make the UI as dynamic whenever the user selects the Bank option in the drop-down menu a new drop-down menu is displayed to him otherwise an empty container will be displayed to him.
Solutions I tried
created i variable which holds true if the item selected is bank otherwise false and used it as a condition to either show the 2nd drop-down or not.
Make the variable global but it also didn't worked.
created a function which i called with the variable to return either drop-down or empty container but it also didn't worked.
Created the bank selected variable in other class and access it with provider package but it also didn't worked for me.
The source code is also available at Github-Repo
Thanks all someone at linkedin helped me with the solution. which is
We have to wrap the AlertDialog with StatefulBuilder and have to call setState when option is selected then it will work.

C++ Builder 6 Different Popup menu on Items and Subitems of a TreeView and No Popup on empty area

I want to have different popup menu on Items and SubItems and NO Popup menu on empty area of a TTreeView is that possible ?
I want something like the pictures bellow
There are two ways you can do that.
Create 2 separate TPopupMenu objects with the desired menu items, do not assign either one of them to the TreeView's PopupMenu property, and then use the TreeView's OnContextMenu event to call the Popup() method of whichever TPopupMenu you need based on which node the user is clicking on.
Create 1 TPopupMenu object and put both menu items in it, and assign it to the TreeView's PopupMenu property, then use the TPopupMenu.OnPopup event to show/hide the menu items based on which node the user is clicking on.
In either case, you can use the TTreeView.GetNodeAt() method to determine which node is located at the coordinates of a mouse click, if any.

GWT ListBox getSelectedIndex() not working as intended when hovered over list items

I have a GWT ListBox. My validation code inquires whether the ListBox's selected index is -1 (my ListBox's default state). If I do not touch the ListBox, the getSelectedIndex() returns -1, as expected. If I hover over the ListBox items but do not click on one (i.e. click outside), getSelectedIndex() returns a non-(-1) index. I want it to return -1 unless I click on a ListBox item and the ListBox updates itself to reflect that selection.
What should I do?
You won't be able to use the native <select> element for this in a nice way since the browsers determine what the selected element is, not GWT. In other words, this is just how <select> works.
You'll have to either create your own select widget (which might be preferred for styling reasons anyway) or get creative and kludge up something next to the existing widgets. You could add a click handler to the ListBox and "manually" set the selected index to -1, but you'll have to figure out if the user cancels his operation and restore the selection afterwards. You'll have to suppress selection events from your custom code because you probably don't want the rest of your app to react to your new -1 hack. Ugh! Probably easiest to handle this in a different way.

Display Additional Form on Update - RadGrid

I'm using a RadGrid for changing record status's. Users have the ability to select a status from a dropdown and update that record with that status. Depending on the status chosen, when the user clicks update I want to popup an additional form so the user can fill out more data required for the update. I'm not sure the best way to go about implementing this. Any suggestions are appreciated.
One way is to use the RadWindow like a modal and pop it up to the user via client-side JavaScript. We use RadWindows in our applications and it works. Or, the RadWindow supports a Nested Grid or View that you can have as a record's child; so you can have the master record, click on the arrow on the left and expand the record to view a nested grid of data, or a custom view (via the NestedViewTemplate property). You can also have the form in a DIV, hide it, then show it via JavaScript too.
Those are two ways.
HTH.

Programatically change icon for a eclipse RCP command

I have a menu drop down action in the coolbar. It has 3 sub items that form a radio group. I would like to change the icon shown in the coolbar when the user selects one of these options.
I've googled and seen that I should look at:
org.eclipse.ui.commands.ICommandService.refreshElements(String, Map)
and
org.eclipse.ui.commands.IElementUpdater
Its probably the right thing to look at exception its not enough information. One or two small code snippets will be excellent.
Thanks in advance.
Ok basically if you don't want to use a "custom" control the what to do it is to have your handler (handler that is linked to the specific command) implement IElementUpdater. When every the toolbar item gets shown or clicked on (i.e if the user selects on the the radio buttons) the method: updateElement(UIElement element, Map parameters) gets called.
The element has a setIcon() method and this is what i used to change the icon of the menu drop down action.
Every update to the Coolbar points to the specialization of the WorkbenchWindowControlContribution class.
This bug 186800 has some code example in it which can be of interest.