Esempio n. 1
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 500, 400, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hListBox = xcgui.XListBox_Create(20, 40, 300, 310, xcgui.HXCGUI(hWindow))
	xcgui.XListBox_SetItemTemplateXML(hListBox, "../xml-template/ListBox_Item.xml")
	xcgui.XSView_SetLineSize(hListBox, 20, 20)

	hAdapter := xcgui.XAdapterTable_Create()
	xcgui.XListBox_BindAdapter(hListBox, hAdapter)
	xcgui.XAdapterTable_AddColumn(hAdapter, "name")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name2")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name3")

	for i := 0; i < 20; i++ {
		index := xcgui.XAdapterTable_AddItemTextEx(hAdapter, "name", "item-"+fmt.Sprint(i))
		if index != xcgui.XC_ID_ERROR {
			xcgui.XAdapterTable_SetItemTextEx(hAdapter, index, "name2", "item-1-"+fmt.Sprint(i))
			xcgui.XAdapterTable_SetItemTextEx(hAdapter, index, "name3", "item-2-"+fmt.Sprint(i))
		}
	}

	hButton1 := xcgui.XBtn_Create(330, 40, 150, 18, "插入", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton1, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickAdd))

	hButton2 := xcgui.XBtn_Create(330, 60, 150, 18, "删除", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton2, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickDel))

	hButton3 := xcgui.XBtn_Create(330, 84, 150, 18, "删除 index=(1-3)", xcgui.HXCGUI(hWindow))
	xcgui.XEle_RegEventC(hButton3, xcgui.XE_BNCLICK, xcgui.CallBack(OnBtnClickDelEx))

	hRichEidt = xcgui.XRichEdit_Create(330, 106, 120, 200, xcgui.HXCGUI(hWindow))
	xcgui.XSView_ShowSBarV(hRichEidt, true)
	xcgui.XRichEdit_EnableMultiLine(hRichEidt, true)

	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_CREATE_END, xcgui.CallBack(OnTemplateCreate))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_DESTROY, xcgui.CallBack(OnTemplateDestroy))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_TEMP_ADJUST_COORDINATE, xcgui.CallBack(OnTemplateAdjustCoordinate))
	xcgui.XEle_RegEventC(hListBox, xcgui.XE_LISTBOX_SELECT, xcgui.CallBack(OnListBoxSelect))

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Esempio n. 2
0
func main() {
	hWindow := xcgui.XWnd_Create(0, 0, 550, 380, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.CloseBtn(hWindow)

	hList := xcgui.XList_Create(20, 40, 500, 300, xcgui.HXCGUI(hWindow))
	xcgui.XList_SetItemTemplateXML(hList, "../xml-template/List_Item.xml")
	xcgui.XSView_SetLineSize(hList, 20, 20)

	for i := 0; i < 3; i++ {
		xcgui.XList_AddColumn(hList, 100)
	}

	hAdapterHeader := xcgui.XAdapterMap_Create()
	xcgui.XList_BindAdapterHeader(hList, hAdapterHeader)

	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name", "aaa")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name2", "bbb")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name3", "ccc")
	xcgui.XAdapterMap_AddItemText(hAdapterHeader, "name4", "test")

	hAdapter := xcgui.XAdapterTable_Create()
	xcgui.XList_BindAdapter(hList, hAdapter)
	xcgui.XAdapterTable_AddColumn(hAdapter, "name")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name2")
	xcgui.XAdapterTable_AddColumn(hAdapter, "name3")

	xcgui.XList_SetColumnWidth(hList, 0, 150)
	xcgui.XList_SetColumnWidth(hList, 1, 150)
	xcgui.XList_SetColumnWidth(hList, 2, 150)

	for i := 0; i < 20; i++ {
		xcgui.XAdapterTable_AddItemText(hAdapter, "item-"+fmt.Sprint(i))

		xcgui.XAdapterTable_SetItemText(hAdapter, i, 1, "child-"+fmt.Sprint(i)+"-1")
		xcgui.XAdapterTable_SetItemText(hAdapter, i, 2, "child-"+fmt.Sprint(i)+"-2")
	}

	xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}