Hi kozura,
That is almost exactly what i am doing:
public class Mypage {
Listbox list;
public Mypage() {
//generates panels..
setListBoxValues();
//generate restof panels, buttons etc.
}
public setListBoxValues() {
AsyncCallback<List<String>> lboxCall = new
AsyncCallback<List<String>>() {
public void onSuccess(List<String> result) {
for (String item : result) {lbox.addItem(item);}
}
public void onFailure(Exception ex) {}
};
service.getValues(lboxCall);
}
This setup worked great on windows..but on linux i sometimes get the
entire GUI shown and sometimes only the panel with scrollbars without
any other GUI -buttons,lists etc. So I am kinda lost on why it is
happening.. Sometimes I have to hit the refresh button on the gwt
window to make the entire gui to show, but sometimes that doesn't do
the trick the first time but i had to do it several times to get
everything to show up... is this a bug?
On Oct 13, 12:28 pm, kozura <[EMAIL PROTECTED]> wrote:
> Shaselai,
> There should be no "racing" condition, the only thing I can guess is
> that you're trying to use the result from the server call in your code
> to initialize the page. The data from a server RPC call is highly
> unlikely to be available a that time. The correct method is for the
> asynchronous callback to fill in the previously created listbox, which
> ensures that there is no race. For example:
>
> public class MyPage extends Composite {
> ListBox lbox;
>
> public MyPage() {
> lbox = new ListBox();
> //add listbox to page
> rpcservice.getListBoxItems(args, lboxCb);
> ...
> }
>
> AsyncCallback<List<String>> lboxCb = new
> AsyncCallback<List<String>>() {
> public void onSuccess(List<String> result) {
> lbox.clear();
> for (String item : result) {lbox.addItem(item);}
> }
> public void onFailure(Exception ex) {}
> };
>
> }
>
> Remember, GWT builds everything dynamically, so there is no real
> "refresh" concept like you mention.
>
> jk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---