I have a listbox ,which have two values value1 and value 2 ..
Now my listbox values got change programatically (I dont change the values Manually)
I want to get a prompt prompt whenever a value get changes / index get changed, inside my listbox
ListBox listBox = new LisBox();
if i use
listBox.addClickHandler
or
listBox.addChangeListener
or
listBox.addChangeEvent
They all only shows me a prompt when i manually change my listbox selected Index.But how will i get a prompt when my listbox selectedIndex changed programatically
Thanks
I am assuming that you are using
setSelectedIndex
The javadoc says explicitly states that it will not send an event. You could overwrite setSelectedIndex and send your own event. A good explaination of doing so can be found here.
Related
my SAPUI5 app has an input field where the valid values must be obtained through a value help:
<Input showValueHelp="true" valueHelpOnly="true"
valueHelpRequest="onValueHelpRequest"
value="{myModel>/myField}"
The value help is realized with a SelectDialog, where the only options are
choose one or
cancel
The problem is now the following flow:
User opens value help dialog to choose one item and presses Confirm
Input field now displays chosen value
User wants to clear the input, because it's optional
Unfortunately,
sap.m.Input doesn't provide a clear button
sap.m.SelectDialog doesn't provide the possibility to add a custom button like Clear
The input is layed out in a SimpleForm with 2 columns, labels and input fields, so it would be hard to add a clear button
The Gateway entity set which feeds the value help dialog list doesn't have a totally empty line
I don't like the workaround to switch the SelectDialog to multiSelect just for the purpose that the user can choose "one or none". I also think it would be hard to explain to the user "if you want to remove the value, hold the control key and click on the previously selected item again".
Any ideas out there how to easily implement a clear button or something similar?
valueHelpOnly="false"
// with this user can either fill by F4 (assisted input) or by typing input..
and if you want to clear you can add a button and set the value to null
oInput.setValue("");
This should be easy but I can't seem to find anything to solve. I have a Form in Excel using VBA. The Excel sheet has four columns populated with data and the Form displays those fields.
The user then selects a value in a combobox, uses a command button to submit the responses and the values from the combobox are written to the Excel sheet.
The user then uses a command button to advance one row down in the spreadsheet and load the four values from a new row. This all works great.
The issue I am trying to solve is that the combobox remains selected to the value in the prior selection. I'd like to reset the combobox so nothing is selected and the user has to make a selection again for the next row.
Below is the code I am using to load the combobox and to set a variable for what the user selected. Can't seem to get the combobox back to it's default state after the user has submitted the form.
Private Sub cbDesAccWanted_Change()
Select Case cbDesAccWanted.Text
Case "Yes"
desacc = "Yes"
Case "No"
desacc = "No"
End Select
cbDesAccWanted.Text = desacc
End Sub
Private Sub cbDesAccWanted_DropButtonClick()
cbDesAccWanted.List = Array("Yes", "No")
End Sub
There are two ways to reset the combobox. Take your pick:
1
cbDesAccWanted.Value = Null
2
cbDesAccWanted.ListIndex = -1
the line
cbDesAccWanted.Text = desacc
is totally unnecessary.
Using cbDesAccWanted_DropButtonClick is not the right place to populate the list of values. This list should be set up when the form is first shown to the user.
(unelss the values it shows chnages in which case change it when the row changes or something, not when the user clicks on it)
So when theuser clicks the down arrow to move to thenext record include the following line
Me.cbDesAccWanted.text = Me.cbDesAccWanted.List(1)
Note (1) access teh 2nd item in the list which is No.
So this reset it to the default value of No.
Ok.
I have a popup-menu that has an option, add own material, and when this is chosen, a pushbutton is enabled that say SAVE. I alose have a bunch of edit-boxes.
What I want to do is to make a callback so whenever I click the SAVE, the data from one of the textboxes will possible to select in the popupmenu. when this is selected, I want to set the other edit-boxes to contain the same data that they did when I clicked the save button.
Thanks in advance
I'm not quite sure to fully understand what you want, but you can use the handle of the popup menu to get the string/string array in contains at the time you press the pushbutton. Then you can put those inside the textboxes using their handles as well.
For instance:
MyStrings = get(handlesToYourPopupMenu,'String');
or
MyStringsArray = cellstr(get(handlesToYourPopupMenu,'String'));
which contains the content of the popup menu as a cell array.
and
set(handlesToYourEditBox,'String',MyString);
Is that what you mean? If not please ask :)
EDIT:
To add the new data to the existing content of your text box, use concatenation. Since the content is in a cell array, you can do the following:
NewString = [OldString {CurrentString}];
where CurrentString is obtained with
get(hanlesToYourEditBox,'String');
Therefore to update the content of the popup menu you could write this:
set(handlesToPopUpMenu,'String',[MyStringsArray {get(hanlesToYourEditBox,'String')}]):
can somebody please tell me why my pop-up menu list get disappear when I set a string which actually belongs to one of the item in the list? I want this string to be appear as default when GUI gets open, however, want other items to be in the pop-up menu.
For example, pop-up list contains:
Set_1
Set_2
Set_3
Set_4 etc..
And, in the function OpeningFcn, I am settting:
set(handles.popupmenu1, 'String', 'Set_1');
This makes 'Set_1' to appear when I open GUI. However, it makes other items (Set_2, Set_3 etc) disappear from the GUI. Thanks.
The String property of a popupmenu uicontrol sets the entire text that is displayed in the menu.
To select a particular option, set the Value property to the index of the item to be selected. In this case, since Set_1 is the first item, set the Value property to 1.
I have a situation here: I have a form field with trigger xtype, what I want to happen on my trigger function is to open a window with a list or grid of data in it. I want to get the value of those data and assign it as the value of my form field with trigger. Can anyone help me solve this problem. Thank you very much.
You have multiple solutions for this.
You can make use Saki's simple message bus to do the communication between extjs components.
You can create an custom event for your trigger field. When user selects a record in your window, fire the event with the selected record.
Inside your onTriggerClick :
Display your window with grid / view for user selection
Inside your Window (on some submit button):
onSubmitClick: function(){
// Get the selected record & fire event
var selected = grid.getSelectionModel().getSelected();
triggerFieldObject.fireEvent('recordSelect',selected);
}
Inside your event processing (Will be on TriggerField):
onRecordSelect: function(record) {
// Now you have access to the selected record.. process it,
// Set the trigger field value etc
this.setValue('Your Value for Trigger Field');
}
Note: This is a skeleton code and not a complete solution. You will need to add your code according to your requirements.