I'm working on a SmartGWT application and using SC Dialog to pop up messages to users, where they can click on 'OK' and 'Cancel' buttons. Now, we want to customize the value of these buttons ('OK', 'Cancel' etc.) so we can pass localized values. For reasons that are too complicated to list here, we cannot use SmartGWT's own localized values. Thanks in advance.
Announcement
Collapse
No announcement yet.
X
-
As API supports to pass string for message as well as for title, I am able to localized those. But I am not able to localized the buttons "OK", "yes", "No".
Here is my code
SC.ask(ResourceUtil.getResource(ResourceUtil.ADMIN_CONSOLE_GWT_RESOURCES, "question"),ResourceUtil.getResource(ResourceUtil.ADMIN_CONSOLE_GWT_RESOURCES, "askDiscardChanges"),
new BooleanCallback() {
public void execute(Boolean value) {
if (value) {
selectServerStatus();
}
}
});
Thank you for your help.
Comment
-
You could do something like
Dialog.addClassProperties({OK_BUTTON_TITLE:...,YES_BUTTON_TITLE:..}); this will overwrite the defaults with your localized selection. It will do so for ALL calls from then on though, not just for the specific ask() or confirm() your doing at that time, but sounds like that is what you want?
Comment
-
Use a dialog
You could use a dialog instead, where you could customize the buttons' titles:
Code:Dialog dialog = new Dialog(); dialog.setTitle("Customized Title"); dialog.setMessage("Customized Message"); dialog.setIcon("[SKIN]ask.png"); Button buttonOK = new Button("customized OK"); buttonOK.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // on ok button click action } }); Button buttonCancel = new Button("customized Cancel"); buttonCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // on cancel button click action } }); dialog.setButtons(buttonOK, buttonCancel); dialog.draw();
Comment
Comment