$PBExportHeader$w_menugroup.srw forward global type w_menugroup from w_publ_base_v2 end type end forward global type w_menugroup from w_publ_base_v2 integer width = 3867 integer height = 2840 string title = "菜单" boolean resizable = false windowstate windowstate = normal! end type global w_menugroup w_menugroup type variables uo_button ins_button_top[] uo_button ins_button_arr[] int ins_groupindex_arr[] groupbox ins_groupbox_arr[] GraphicObject ins_pgoobject Int ins_topindex String ins_itemkey = "menugroup_top_" groupbox gb_history windowobject ins_movable_controls[] Int ins_movable_initY[] end variables forward prototypes public subroutine wf_handleevent (string arg_event) public subroutine wf_settop (windowobject arg_control) public function uo_button wf_createbtn (string arg_eventtag) public subroutine wf_canceltop (uo_button arg_control) public subroutine wf_updown (long arg_long) end prototypes public subroutine wf_handleevent (string arg_event);ins_pgoobject.postevent(arg_event) close(this) end subroutine public subroutine wf_settop (windowobject arg_control);String ls_tag ls_tag = arg_control.tag wf_canceltop(arg_control) uo_button arr_newtop[] uo_button luo_tmpbtn luo_tmpbtn = wf_createbtn(ls_tag) luo_tmpbtn.ins_istop = true ins_topindex++ This.OpenUserObject(luo_tmpbtn, "topbutton_" + String(ins_topindex), 700,0) arr_newtop[1] = luo_tmpbtn Int li_i FOR li_i = 1 TO UpperBound(ins_button_top) arr_newtop[UpperBound(arr_newtop)+1] = ins_button_top[li_i] NEXT ins_button_top = arr_newtop this.postevent(resize!) end subroutine public function uo_button wf_createbtn (string arg_eventtag);u_Dfc_Base_Func duFunc String ls_label, ls_event, ls_msgid, ls_picname ls_label = duFunc.uf_GetKeyValue(arg_eventtag, "Text") ls_event = duFunc.uf_GetKeyValue(arg_eventtag, "Event") ls_msgid = duFunc.uf_GetKeyValue(arg_eventtag, "MsgID") ls_picname = duFunc.uf_GetKeyValue(arg_eventtag, "ICON") uo_button tmp_button tmp_button = CREATE uo_button tmp_button.Tag = arg_eventtag tmp_button.label = ls_label tmp_button.ins_parentwindow = this tmp_button.menuevent = ls_event tmp_button.ins_msgid = ls_msgid tmp_button.picname = ls_picname tmp_button.width = 716 RETURN tmp_button end function public subroutine wf_canceltop (uo_button arg_control);IF UpperBound(ins_button_top) <= 0 THEN RETURN uo_button arr_newtop[], luo_tmpbtn Int li_i, li_remove_i FOR li_i = 1 TO UpperBound(ins_button_top) luo_tmpbtn = ins_button_top[li_i] IF luo_tmpbtn.tag = arg_control.tag THEN li_remove_i = li_i ELSE arr_newtop[UpperBound(arr_newtop)+1] = luo_tmpbtn END IF NEXT IF li_remove_i > 0 THEN This.closeuserobject(ins_button_top[li_remove_i]) ins_button_top = arr_newtop this.postevent(resize!) END IF end subroutine public subroutine wf_updown (long arg_long);if arg_long < 0 then arg_long = 0 if arg_long > vsb_1.MaxPosition then arg_long = vsb_1.MaxPosition Int li_i FOR li_i = 1 TO UpperBound(ins_movable_controls) IF ins_movable_controls[li_i].classname() = "uo_button" THEN uo_button tmp_btn tmp_btn = ins_movable_controls[li_i] tmp_btn.Y = ins_movable_initY[li_i] - arg_long * 100 ELSEIF ins_movable_controls[li_i].classname() = "groupbox" THEN groupbox tmp_gb tmp_gb = ins_movable_controls[li_i] tmp_gb.Y = ins_movable_initY[li_i] - arg_long * 100 END IF NEXT end subroutine on w_menugroup.create call super::create end on on w_menugroup.destroy call super::destroy end on event open;call super::open;uo_menugroup luo_open luo_open = Message.powerobjectparm ins_pgoobject = luo_open.ins_pgoobject ins_itemkey = "menugroup_top_" + luo_open.ins_menukey IF luo_open.ins_menutitle <> "" THEN This.title = luo_open.ins_menutitle END IF u_Dfc_Base_Func duFunc String dsList[] Integer i duFunc.uf_Split(luo_open.ins_psmenulist, "|", dsList) String ls_label uo_button tmp_button groupbox tmp_group For i = 1 To UpperBound(dsList) ls_label = duFunc.uf_GetKeyValue(dsList[i], "Text") IF ls_label = "-" THEN ins_groupindex_arr[UpperBound(ins_groupindex_arr)+1] = UpperBound(ins_button_arr) tmp_group = CREATE groupbox tmp_group.backcolor = 134217739 ins_groupbox_arr[UpperBound(ins_groupbox_arr)+1] = tmp_group This.OpenUserObject(tmp_group, "gb_" + String(UpperBound(ins_groupbox_arr)), 0,(UpperBound(ins_groupbox_arr)-1)*700) ELSE tmp_button = wf_createbtn(dsList[i]) ins_button_arr[UpperBound(ins_button_arr)+1] = tmp_button This.OpenUserObject(tmp_button, "menubutton_" + String(UpperBound(ins_button_arr)), (UpperBound(ins_button_arr)-1)*700,0) END IF Next ins_groupindex_arr[UpperBound(ins_groupindex_arr)+1] = UpperBound(ins_button_arr) tmp_group = CREATE groupbox tmp_group.backcolor = 134217739 ins_groupbox_arr[UpperBound(ins_groupbox_arr)+1] = tmp_group This.OpenUserObject(tmp_group, "gb_" + String(UpperBound(ins_groupbox_arr)), 0,(UpperBound(ins_groupbox_arr)-1)*700) // 置顶 gb_history = CREATE groupbox gb_history.backcolor = 134217739 gb_history.text = "置顶" gb_history.textsize = -9 gb_history.facename = "宋体" This.OpenUserObject(gb_history, "gb_history", 0,0) String ls_tophistory, hisList[] ls_tophistory = f_ProfileString (sys_empid,"w_menugroup",ins_itemkey,'') String ls_tmplabel, ls_tmpevent Int j IF ls_tophistory <> "" THEN duFunc.uf_Split(ls_tophistory, "|", hisList) For i = UpperBound(hisList) TO 1 STEP -1 ls_tmplabel = duFunc.uf_GetKeyValue(hisList[i], "Text") ls_tmpevent = duFunc.uf_GetKeyValue(hisList[i], "Event") FOR j = 1 TO UpperBound(ins_button_arr) tmp_button = ins_button_arr[j] IF tmp_button.label = ls_tmplabel AND tmp_button.menuevent = ls_tmpevent THEN wf_settop(tmp_button) EXIT END IF NEXT NEXT END IF this.postevent(resize!) end event event deactivate;call super::deactivate;close(this) end event event resize;call super::resize;windowobject arr_empty_controls[] Int arr_empty_Y[] ins_movable_controls = arr_empty_controls ins_movable_initY = arr_empty_Y IF UpperBound(ins_button_arr) <= 0 THEN RETURN Int li_group_i Int li_button_i, li_tmpx, li_tmpy, li_marginh, li_marginv, li_lineheight, li_itemwidth, li_groupY li_marginh = 24 li_marginv = 12 li_lineheight = ins_button_arr[1].height + li_marginv li_itemwidth = ins_button_arr[1].width + li_marginh //TODO:置顶 IF UpperBound(ins_button_top) <= 0 THEN //gb_history.visible = false gb_history.Y = -500 gb_history.height = 1 ELSE // gb_history.visible = true li_tmpx = li_marginh*2 li_tmpy = 60 Int li_top_i FOR li_top_i = 1 TO UpperBound(ins_button_top) IF li_tmpx = li_marginh THEN ELSEIF li_tmpx + li_itemwidth > this.workspacewidth() THEN li_tmpx = li_marginh*2 li_tmpy += li_lineheight ELSE END IF ins_button_top[li_top_i].X = li_tmpx ins_button_top[li_top_i].Y = li_tmpy ins_button_top[li_top_i].bringtotop = true li_tmpx += li_itemwidth ins_movable_controls[UpperBound(ins_movable_controls)+1] = ins_button_top[li_top_i] ins_movable_initY[UpperBound(ins_movable_initY)+1] = ins_button_top[li_top_i].Y NEXT gb_history.X = li_marginh gb_history.Y = 0 gb_history.height = li_tmpy + li_lineheight + 4 gb_history.width = this.workspacewidth() - li_marginh * 2 - vsb_1.width ins_movable_controls[UpperBound(ins_movable_controls)+1] = gb_history ins_movable_initY[UpperBound(ins_movable_initY)+1] = gb_history.Y li_tmpy += 24 END IF FOR li_group_i = 1 TO UpperBound(ins_groupindex_arr) IF li_tmpy = 0 THEN li_tmpx = li_marginh*2 li_tmpy = 0 li_groupY = 0 li_tmpy = 60 ELSE li_tmpx = li_marginh*2 li_tmpy += li_lineheight li_groupY = li_tmpy - 24 li_tmpy += 36 END IF DO WHILE li_button_i < ins_groupindex_arr[li_group_i] li_button_i++ IF li_tmpx = li_marginh THEN ELSEIF li_tmpx + li_itemwidth > this.workspacewidth() THEN li_tmpx = li_marginh*2 li_tmpy += li_lineheight ELSE END IF ins_button_arr[li_button_i].X = li_tmpx ins_button_arr[li_button_i].Y = li_tmpy li_tmpx += li_itemwidth ins_movable_controls[UpperBound(ins_movable_controls)+1] = ins_button_arr[li_button_i] ins_movable_initY[UpperBound(ins_movable_initY)+1] = ins_button_arr[li_button_i].Y LOOP ins_groupbox_arr[li_group_i].X = li_marginh ins_groupbox_arr[li_group_i].Y = li_groupY ins_groupbox_arr[li_group_i].height = li_tmpy + li_lineheight - li_groupY + 4 ins_groupbox_arr[li_group_i].width = this.workspacewidth() - li_marginh * 2 - vsb_1.width ins_movable_controls[UpperBound(ins_movable_controls)+1] = ins_groupbox_arr[li_group_i] ins_movable_initY[UpperBound(ins_movable_initY)+1] = ins_groupbox_arr[li_group_i].Y NEXT Long ll_dif ll_dif = Ceiling(dec(ins_groupbox_arr[UpperBound(ins_groupindex_arr)].Y+ins_groupbox_arr[UpperBound(ins_groupindex_arr)].height - this.workspaceheight()) / 100) IF ll_dif > 0 THEN vsb_1.maxposition = ll_dif vsb_1.x = this.workspacewidth() - vsb_1.width vsb_1.Y = 0 vsb_1.height = this.workspaceheight() - vsb_1.y vsb_1.Visible = true ELSE vsb_1.Visible = false END IF end event event close;call super::close;string ls_top_history IF UpperBound(ins_button_top) > 0 THEN Int li_i FOR li_i = 1 TO UpperBound(ins_button_top) IF ls_top_history <> "" THEN ls_top_history+= "|" ls_top_history+=ins_button_top[li_i].tag NEXT END IF f_SetProfileString(sys_empid,"w_menugroup",ins_itemkey, ls_top_history) end event type vsb_1 from w_publ_base_v2`vsb_1 within w_menugroup end type type cb_func from w_publ_base_v2`cb_func within w_menugroup boolean visible = false boolean enabled = false end type type cb_exit from w_publ_base_v2`cb_exit within w_menugroup boolean visible = false boolean enabled = false end type