public override void onActivate() { base.onActivate(); xLabel l = xLabel.createSingleLabel("This is Help screen", null, getW()); addControl(l); xButton bt = xButton.createStandardButton(1000, this, "back to Home screen", 250); bt.setPosition(150, 0); // bt.setSize(-1, bt.getH()*2); Font f = new Font(new FontFamily("Arial"), 13.0f); bt.setFont(f); bt.setTextColor(Color.Red.ToArgb()); addControl(bt); //====================================try list view======= xContainer c = new xContainer(); c.setSize(235, 200); c.setPosition(0, 40); addControl(c); /* * String[] columns = {"CODE", "PRICE", "+/-"}; * float[] ws = { 50, 100, 80}; * // create table * xListView lv = xListView.createListView(this, columns, ws, null); * for (int i = 0; i < 4; i++) * { * columns[0] = "CODE" + i; * columns[1] = "" + (100 * (5-i)); * columns[2] = "" + (i * i); * // create row * xListViewItem item = xListViewItem.createListViewItem(this, 3);//, columns); * for (int j = 0; j < 3; j++) * { * item.setTextForCell(j, columns[j]); * } * * lv.addRow(item); * item.setTextColor(1, 0xffff0000); * } * * lv.setSize(230, 100); * lv.setPosition(100, 100); * * c.addControl(lv); */ }
public TablePriceboard(xIEventListener listener, GainLossManager gainlosses, int w, int rowH) : base(listener) { setBackgroundColor(C.COLOR_BLACK); int cnt = gainlosses.getTotal(); int y = 0; Font f = Context.getInstance().getFontText(); xLabel l = xLabel.createSingleLabel("Lãi lỗ"); l.setBackgroundColor(C.COLOR_ORANGE); l.setSize(w, (int)f.GetHeight() + 4); l.setPosition(0, 0); l.setTextColor(C.COLOR_GREEN); y = l.getBottom() + 1; addControl(l); for (int i = 0; i <= cnt; i++) { int idx = i - 1; int rH = rowH; if (idx == -1) { rH = 20; } RowGainloss r = new RowGainloss(listener, i, w, rH); if (idx >= 0) { stGainloss g = (stGainloss)gainlosses.getGainLossAt(idx); r.setData(g); } r.setParent(this); r.setPosition(0, y); addControl(r); vRows.addElement(r); y += rH + 1; } // thong ke { GainLossSumary sumary = new GainLossSumary(w); sumary.setPosition(0, y); addControl(sumary); y += sumary.getH(); } // Help { xFillBackground bottom = xFillBackground.createFill(w, 1, C.COLOR_GRAY_LIGHT); bottom.setPosition(0, y); addControl(bottom); y += 1; l = xLabel.createSingleLabel("Click phím phải chuột để thêm/xóa mã hoặc nhóm"); l.setTextColor(C.COLOR_WHITE); l.setPosition(l.getW() - 4, y + 3); addControl(l); y += l.getH() + 4; } xFillBackground fillBottom = xFillBackground.createFill(w, 2, C.COLOR_GRAY_LIGHT); fillBottom.setPosition(0, y); addControl(fillBottom); invalidate(); }
protected xContainer createChartRangeControls(int sel, xContainer c) { Share share = mContext.getSelectedShare(); int currentRange = 0; if (share != null) { currentRange = share.getCursorScope(); } c.removeAllControls(); // 5 days, 1 month, 3 month, 6 month, 1 year, 2 year String[] ss = { "5d", "1m", "3m", "6m", "1y", "2y", "-", null }; int[] scopes = { Share.SCOPE_1WEEKS, Share.SCOPE_1MONTH, Share.SCOPE_3MONTHS, Share.SCOPE_6MONTHS, Share.SCOPE_1YEAR, Share.SCOPE_2YEAR, Share.SCOPE_ALL }; int i = 0; int w = 10; int h = 20; int x = 0; // update sel if (currentRange > 0) { for (i = 0; i < scopes.Length; i++) { if (currentRange >= scopes[i]) { sel = i; } else { break; } } } if (currentRange > Share.SCOPE_2YEAR) { sel = scopes.Length - 1; } //========================== i = 0; while (ss[i] != null) { xLabel l = xLabel.createSingleLabel(ss[i], mContext.getFontSmallest(), 25); l.setPosition(x, 0); l.setAlign(xGraphics.HCENTER); l.enableClick(C.ID_CHART_RANGE + i, this); c.addControl(l); if (i == sel) { l.setBackgroundColor(C.COLOR_GRAY_DARK); l.setTextColor(C.COLOR_WHITE); } else { l.setBackgroundColor(C.COLOR_GRAY_LIGHT); l.setTextColor(C.COLOR_BLACK); } x = l.getRight() + 1; h = l.getH(); i++; } w = x; c.setSize(w, h); c.setOpaque(0.7f); return(c); }
/* * protected xBaseControl createShareGroupDroplist(int id, String title, xVector groups) * { * xContainer c = new xContainer(); * xLabel l = xLabel.createSingleLabel(title, mContext.getFontTextB(), 150); * l.setTextColor(C.COLOR_BLUE); * l.setSize(l.getW(), 16); * int w = 150; * l.setPosition(0, 0); * c.addControl(l); * * ComboBox cb = new ComboBox(); * c.addControl(cb); * cb.Size = new Size(w, cb.Size.Height); * cb.Left = 0; * cb.Top = l.getBottom(); * cb.DropDownStyle = ComboBoxStyle.DropDownList; * * stShareGroup current = mContext.getCurrentShareGroup(); * * for (int i = 0; i < groups.size(); i++) * { * stShareGroup favor = (stShareGroup)groups.elementAt(i); * cb.Items.Add(favor.getName()); * * if (current != null && favor.getName().CompareTo(current.getName()) == 0) * { * cb.SelectedIndex = i; * mContext.setCurrentShareGroup(favor); * } * } * * cb.Tag = (Int32)id; * cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged); * * c.setSize(w, 40); * * return c; * } */ protected xBaseControl createShareGroupList(bool editable, int id, String title, xVector groups, int w, int h) { xContainer c = new xContainer(); c.setSize(w, h); Font f = Context.getInstance().getFontText(); xLabel l = xLabel.createSingleLabel(title, f, w); l.setBackgroundColor(C.COLOR_ORANGE); l.setTextColor(C.COLOR_WHITE); c.addControl(l); int titleH = l.getH(); xContainer c1 = new xContainer(); if (editable) { c1.setSize(w, h - 30 - titleH); } else { c1.setSize(w, h - 6 - titleH); } c1.setPosition(0, l.getH()); c.addControl(c1); stShareGroup current = mContext.getCurrentShareGroup(); string[] ss = { title }; float[] cols = { 100.0f }; xListView list = xListView.createListView(this, ss, cols, w, c1.getH(), Context.getInstance().getImageList(C.IMG_BLANK_ROW_ICON, 1, 21)); list.hideHeader(); list.setID(id); ((ListView)list.getControl()).HideSelection = false; ((ListView)list.getControl()).Scrollable = true; list.setBackgroundColor(C.COLOR_GRAY_DARK); int y = 0; for (int i = 0; i < groups.size(); i++) { stShareGroup favor = (stShareGroup)groups.elementAt(i); xListViewItem item = xListViewItem.createListViewItem(this, new string[] { favor.getName() }); uint color = C.COLOR_WHITE; //if (favor.getGroupType() == stShareGroup.ID_GROUP_MARKET_OVERVIEW) //{ //color = C.COLOR_ORANGE; //} if (favor.getGroupType() == stShareGroup.ID_GROUP_GAINLOSS) { color = C.COLOR_ORANGE; } item.getItem().SubItems[0].Font = mContext.getFontText2(); item.getItem().SubItems[0].ForeColor = Color.FromArgb((int)color); item.setData(favor); list.addRow(item); } c1.addControl(list); //==================== if (editable) { xButton bt; bt = xButton.createStandardButton(C.ID_ADD_GROUP, this, "Thêm nhóm", w / 2 - 2); bt.setPosition(1, c1.getBottom() + 3); c.addControl(bt); bt = xButton.createStandardButton(C.ID_REMOVE_GROUP, this, "Xóa nhóm", w / 2 - 2); bt.setPosition(w / 2 + 1, c1.getBottom() + 3); c.addControl(bt); } return(c); }