Hello,
I would like to have a context menu at a TextAreaItem. I was only able to create one at the complete form, that is still fine.
But I would like to add a specific text at the current curser position depending of the menu item selection. Is this possible?
Here is my code:
DynamicForm form = new DynamicForm();
form.setNumCols(1);
form.setColWidths("*");
form.setHeight("*");
emailTextArea = new TextAreaItem();
//create context menu
Menu m = new Menu();
MenuItem item = new MenuItem();
item.setIcon("debugt_obj.gif");
item.setTitle("New");
m.addItem(item);
form.setContextMenu(m);
//add text
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
public void onClick(MenuItemClickEvent event) {
String value = (String)emailTextArea.getValue();
//How can i receive the current curser position
String newValue = value + "FIX TEXT";
emailTextArea.setValue(newValue);
}
});
emailTextArea.setValue(text);
emailTextArea.setShowTitle(false);
emailTextArea.setRowSpan(2);
emailTextArea.setWidth("*");
emailTextArea.setHeight("*");
form.setFields(emailTextArea);
setPane(form);
Thanks