Search code examples
dialogheightsmartgwt

SmartGWT Dialog setting Height for dynamix text


Here's the deal, im trying to create a popup window that uses a dynamic text, when the text is too large i would like to cap the height of the window and use a scrollbar instead to navigate through it but it does not seems to be working.

code:

final Dialog dialog = new Dialog();
dialog.setMessage(direttivaDescription);

dialog.setOverflow(Overflow.AUTO);

dialog.setWidth(600);

dialog.setHeight(50);


dialog.setIcon(someIcon);

dialog.setButtons(new Button("OK"));

dialog.addButtonClickHandler(new ButtonClickHandler() {

     public void onButtonClick(ButtonClickEvent event) {

     dialog.hide();

     }

});

dialog.draw();

If the text is too large the window height will be resized accordingly. The funny part is that setWidth method seems to be working just fine.


Solution

  • You need a container such as HLayout, VLayout, DynamicForm etc. where you can add the message in it then finally add the container in the Dialog.

    Sample code:

    VLayout vLayout=new VLayout();
    vLayout.addMember(new Label(message));
    vLayout.setOverflow(Overflow.AUTO);
    vLayout.setWidth100();
    
    ...
    dialog.addItem(vLayout);
    dialog.draw();
    

    snapshot:

    enter image description here