ok, I still cant seem to get this to work. Here is my layout:
Form (FrmMain) -> Tabs -> Container (PnlCurrentActivity). I set pull to
refresh on PnlCurrentActivity, but the refresh event never fires
FrmMain:
public class FrmMain extends com.codename1.ui.Form {
protected PnlCurrentActivity pnlCurrentActivity = new PnlCurrentActivity();
public FrmMain() {
this(com.codename1.ui.util.Resources.getGlobalResources());
}
public FrmMain(com.codename1.ui.util.Resources resourceObjectInstance) {
initGuiBuilderComponents(resourceObjectInstance);
initManualComponents();
}
//-- DON'T EDIT BELOW THIS LINE!!!
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initGuiBuilderComponents(com.codename1.ui.util.Resources
resourceObjectInstance) {
setLayout(new com.codename1.ui.layouts.BorderLayout());
setTitle("Dashboard");
setName("FrmMain");
}// </editor-fold>
//-- DON'T EDIT ABOVE THIS LINE!!!
protected void initManualComponents() {
Tabs t = new Tabs();
t.addTab("Current Activity", pnlCurrentActivity);
t.addTab("Follow Up", new Label("Test");
t.setScrollableY(true);
this.add(BorderLayout.CENTER, t);
}
}
PnlCurrentActivity:
public class PnlCurrentActivity extends com.codename1.ui.Container {
protected PnlCurrentActivity me = null;
public PnlCurrentActivity() {
this(com.codename1.ui.util.Resources.getGlobalResources());
}
public PnlCurrentActivity(com.codename1.ui.util.Resources
resourceObjectInstance) {
initManualComponents();
}
protected void initManualComponents() {
this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
this.addPullToRefresh(new Runnable() {
@Override
public void run() {
System.out.println("Pnl Refresh");
}
});
me = this;
refresh();
}
public void refresh() {
InfiniteProgressWithMessage prog = new InfiniteProgressWithMessage();
prog.showInifiniteBlocking();
prog.message.setText("Retrieving Current Activity");
loadCurrentActivity(prog);
}
protected void loadCurrentActivity(InfiniteProgressWithMessage prog) {
ConnectionRequest r = new ConnectionRequest() {
Vector<dbCurrentActivity> vData = new Vector<dbCurrentActivity>();
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void readResponse(InputStream input) throws IOException {
ArrayList<Map<String, Object>> alCurrentActivity = (ArrayList)new
JSONParser().parseJSON(new InputStreamReader(input)).get("activity");
for (Map<String,Object>entry : alCurrentActivity) {
vData.add(new dbCurrentActivity(entry));
}
}
@Override
protected void postResponse() {
for (dbCurrentActivity act : vData) {
MultiButton mb = new MultiButton(act.getClient());
mb.setHorizontalLayout(true);
me.add(mb);
}
//display it
prog.dlg.dispose();
}
};
r.setUrl(GLOBALS.BASEURL + "/getCurrentActivity");
r.setPost(true);
NetworkManager.getInstance().addToQueueAndWait(r);
}
}
On Tuesday, July 5, 2016 at 10:38:37 PM UTC-7, Shai Almog wrote:
>
> You can't have the Tabs component itself scrollable. It won't look good.
> You want to have the containers added to the tabs as the
> scrollable/refreshable elements.
>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/5358da3a-d771-4f66-bdbe-bc31e7a4aef4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.