Hi I am still new to the GWT toolkit; but I am trying to convert an
old web application into a RIA, using gwt.

One problem I have run into is, that The application includes a form,
where I have an autocomplete function on
some textbox'es and a textarea.

For the autocomplete, I use a PopupPanel with an ListBox with the
suggestions (that I pickup via JSON, from a perl cgi script on the
server). I got everything working OK, except that the first time, the
suggestionbox need to pop up, it pops up at the botton of the page,
and have a width of 100%, not the size of the listbox. All the next
times used the PopupPanel pops in the correct position, and with the
correct width. If testing with the Google Chrome Browser (linux), it
does work correct, also the first tile, but not on Firefox (linux),
and not on IE6 (Windows XP).

When looking at the div for the panel, the parameters: left: 410px;
top: 267px; position: absolute; are there when it is working; but not
the first time shown.

I have tried in every way I could think of, to change the sequence of
statements, with no effect, any suggestions on how I can solve this
problem?

The code looks like this:

the variable definitions:

        protected PopupPanel choicesPopup = new PopupPanel(true);
        protected ListBox choices = new ListBox();
        protected boolean popupAdded = false;
        protected boolean visible = false;
        protected int posy = -1;

and in the constructor, I have:

                choices.setWidth("250px");
                choicesPopup.add(choices);
                choicesPopup.addStyleName("AutoCompleteChoices");
                popupAdded = false;
                visible = false;
                posy = -1;


and in the JSON callback code, I have:

                                                        if 
(response.getStatusCode() == 200) {

                                                                
setChoice(JSONParser.parse(response.getText())
                                                                                
.isArray(), choiseText);
                                                                if (numChoices 
> 0) {
                                                                        // 
choicesPopup.show();
                                                                        
choicesPopup.setVisible(true);
                                                                        if 
(numChoices == 1) {
                                                                                
choicesPopup.hide();
                                                                                
choices.setSelectedIndex(0);
                                                                                
complete();
                                                                        } else {
                                                                                
choices.setSelectedIndex(0);
                                                                                
if (numChoices > 10) {
                                                                                
        choices.setVisibleItemCount(10);
                                                                                
} else {
                                                                                
        choices.setVisibleItemCount(numChoices);
                                                                                
}
                                                                                
int nposy = getAbsoluteTop()
                                                                                
        + getOffsetHeight();
                                                                                
if (posy < 0 || nposy > posy) {
                                                                                
        posy = nposy;
                                                                                
}
                                                                                
choicesPopup.setPopupPosition(
                                                                                
                getAbsoluteLeft(), posy);
                                                                                
if (!popupAdded) {
                                                                                
        RootPanel.get().add(choicesPopup);
                                                                                
        popupAdded = true;
                                                                                
}
                                                                                
choicesPopup.show();
choicesPopup.setVisible(true);
                                                                                
visible = true;
                                                                        }
                                                                } else {
                                                                        
choicesPopup.hide();
                                                                        visible 
= false;
                                                                }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to