def scrollbar_value_changed(nc, scbPtr, sid, addData): scbRed = mg.findWndObject(scbPtr, 100) scbGreen = mg.findWndObject(scbPtr, 101) scbBlue = mg.findWndObject(scbPtr, 102) rect = mg.findWndObject(scbPtr, 300) label = mg.findWndObject(scbPtr, 301) red = scbRed.CurPos green = scbGreen.CurPos blue = scbBlue.CurPos text = "(%d,%d,%d)" % (red, green, blue) mg.log(text) rect.FillColor = 0xff000000 | red | (green << 8) | (blue << 16) label.Text = text
def check_button_status_changed(nc, ckbtnPtr, btid, addData): mg.log("check button status nc=%d,checkbutton ptr: %d,id=%d" % (nc, ckbtnPtr, btid)) ckbtn = mg.wrap(ckbtnPtr) label = mg.findWndObject(ckbtnPtr, 200) if label: label.Text = ckbtn.Text + "State Is:" + str(ckbtn.CheckState) else: mg.log("cannot get the sub window 200")
def on_init_list_data(nc, btnPtr, bid, addData): listview = mg.findWndObject(btnPtr, 100) listview_remove_all(listview) i = 0 for d in list_data1[0]: listview.addColumn(i, 100, d) i = i + 1 i = 0 for d in list_data1[1:]: listview.addItem(i, 0, 0, 25, 0, d)
def on_init_tree_data(nc, btnPtr, bid, addData): listview = mg.findWndObject(btnPtr, 100) listview_remove_all(listview) i = 1 listview.addColumn(0, 20, "") for d in list_data1[0]: listview.addColumn(i, 100, d) classes = ["Grade1", "Grade2", "Grade3", "Grade4"] i = 0 for d in classes: hitem = listview.addItem(i, 0, 0, 25, 0, ["", classes[i]]) j = 0 for s in list_data1[1:]: listview.addItem(j, 0, hitem, 25, 0, s)
def on_spinner_changed(nc, spPtr, bid, addData): sp = mg.wrap(spPtr) progbar = mg.findWndObject(spPtr, 100) progbar.CurPos = sp.CurPos
def on_button_pb_decrease(nc, btnPtr, bid, addData): pb = mg.findWndObject(btnPtr, 100) pb.increase(-5)
def on_combobox_sel_changed(nc, cbPtr, cbid, addData): cb = mg.wrap(cbPtr) sel = cb.getCurSel() label = mg.findWndObject(cbPtr, 150) label.Text = "CurrentSelect(%d):%s" % (sel, cb.getItem(sel))
def on_color_changed(nc, cbtPtr, cid, addData): cbt = mg.wrap(cbtPtr) rect = mg.findWndObject(cbtPtr, 101) rect.FillColor = cbt.CurColor
def on_radio_button_changed(nc, bgPtr, rid, sel_id): rect = mg.findWndObject(bgPtr, 300) colors = [0xff0000ff, 0xff00ff00, 0xffff0000] rect.FillColor = colors[sel_id - 100]
def month_calendar_changed(nc, mcPtr, cid, addData): mc = mg.wrap(mcPtr) label = mg.findWndObject(mcPtr, 101) label.Text = "Calendar:%d/%d/%d" % (mc.Year, mc.Month, mc.Day)