hello,
I am using SWT technology for my project,there is mail facility, i want attachment of multiple files.first link is created, but other links have to be generated dynamically as we do in gmail,and there should be a listener for every link.here is the code..
final Link attachLink = attachFileLink(linkCanvas);
attachLink.setText("<a>"+CommandIds.ATTACH_FILE+"</a>");
attachLink.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String path = null;
if(event.text.trim().equals(CommandIds.ATTACH_FILE))
{
path = fileSelector(parent.getShell());
if(path != null && !path.equals("")) {
Button checkBox = new Button (linkCanvas , SWT.CHECK);
attachLink.setText(path);
checkBox.setSelection(true);
if(sNo < 5) {
anotherLink[sNo] = attachFileLink(linkCanvas);
anotherLink[sNo].setText("<a>"+CommandIds.ATTACH_ANOTHER_FILE+"</a>");
}
linkCanvas.pack();
linkCanvas.redraw();
}
}
}
});
final Listener attachLinkListsner = new Listener() {
public void handleEvent(Event event) {
String path = null;
if(event.text.trim().equals(CommandIds.ATTACH_ANOTHER_FILE)) {
path = fileSelector(parent.getShell());
if(path != null && !path.equals("")) {
anotherLink[sNo].setText(path);
checkBox[sNo] = new Button(linkCanvas , SWT.CHECK);
checkBox[sNo].setSelection(true);
sNo++;
if(sNo < 5){
anotherLink[sNo] = attachFileLink(linkCanvas);
anotherLink[sNo].setText("<a>"+CommandIds.ATTACH_ANOTHER_FILE+"</a>");
}
linkCanvas.pack();
linkCanvas.redraw();
}
}
}
};
but how to add listener to anotherLink, beacause it will be created after clicking on the first link.If there is any other way to attach muliple files to a mail, then please let me know. i have searched on google a lot, but i din't find out the right one.
Thanx..:)