func onURLChanged(webView, param, url uintptr) int { openUrl := web.XWeb_GetStringW(url) xcgui.XRichEdit_SetText(xcgui.HELE(hEditUrl), openUrl) fmt.Println("正在访问: ", openUrl) return 0 }
func main() { hWindow := xcgui.XWnd_Create(0, 0, 300, 200, "炫彩界面库窗口", 0, xcgui.XC_WINDOW_STYLE_DEFAULT) xcgui.CloseBtn(hWindow) hComboBox := xcgui.XComboBox_Create(20, 40, 120, 20, xcgui.HXCGUI(hWindow)) xcgui.XComboBox_SetItemTemplateXML(hComboBox, "../xml-template/ComboBox_ListBox_Item.xml") xcgui.XRichEdit_SetText(hComboBox, "123") hAdapter := xcgui.XAdapterTable_Create() xcgui.XComboBox_BindApapter(hComboBox, hAdapter) xcgui.XAdapterTable_AddColumn(hAdapter, "name") for i := 0; i < 20; i++ { xcgui.XAdapterTable_AddItemText(hAdapter, "name-"+fmt.Sprint(i)+"-0") } xcgui.XWnd_ShowWindow(hWindow, xcgui.SW_SHOW) xcgui.XRunXCGUI() xcgui.XExitXCGUI() }
func OnListBoxSelect(iItem int, pbHandled *bool) int { xcgui.XRichEdit_DeleteAll(hRichEidt) array := make([]uint16, 256) count := xcgui.XListBox_GetSelectAll(hListBox, &array[0], 256) hAdapter := xcgui.XListBox_GetAdapter(hListBox) var szItemList string name := make([]uint16, 256) for i := 0; i < count*2; i += 2 { ok := xcgui.XAdapterTable_GetItemText(hAdapter, int(array[i]), 0, &name[0], 256) if ok { szItemList += xcgui.UTF16PtrToString(&name[0]) szItemList += "\n" } } xcgui.XRichEdit_SetText(hRichEidt, szItemList) return 0 }