$PBExportHeader$w_publ_base.srw
forward
global type w_publ_base from window
end type
type cb_func from uo_imflatbutton within w_publ_base
end type
type cb_exit from uo_imflatbutton within w_publ_base
end type
end forward

global type w_publ_base from window
integer x = 713
integer y = 388
integer width = 2007
integer height = 1144
boolean titlebar = true
string title = "BASE"
boolean controlmenu = true
boolean minbox = true
windowtype windowtype = popup!
long backcolor = 134217739
event ue_before_open ( )
event ue_retr ( )
event ue_filter ( )
event ue_sentdataout ( )
event ue_sort ( )
cb_func cb_func
cb_exit cb_exit
end type
global w_publ_base w_publ_base

type prototypes
subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library 'user32.dll'
end prototypes

type variables
Boolean dw_edit_mode = FALSE
Boolean if_modify_mode = FALSE //修改模式
Boolean if_ue_retr = FALSE
Boolean if_ue_filter = FALSE
Boolean if_ue_sort = FALSE
Boolean if_ue_sentdataout = FALSE

Long printnum




end variables

forward prototypes
public function integer wf_movetocenter ()
end prototypes

public function integer wf_movetocenter ();//wf_movetocenter
//environment   exerun_env 
//GetEnvironment(exerun_env ) 
//this.Move ( (PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - this.Width)/2,&
//	(PixelsToUnits(exerun_env.screenheight, XPixelsToUnits!) - this.Height - 350 )/2) //
////this.Move ( (exerun_env.screenwidth*4.62 - this.Width)/2, (exerun_env.screenheight*3.87 - this.Height)/2)
//return 0

// 读取窗口位置信息

if (this.WindowType = Response!) then return 0

Environment env
GetEnvironment(env)

long xparm, yparm, widthparm, heightparm, ifMax
ifMax = ProfileInt(sys_fx_positon, this.ClassName(), 'ifmax', 0)
xparm = ProfileInt(sys_fx_positon, this.ClassName(), 'x', 0)
yparm = ProfileInt(sys_fx_positon, this.ClassName(), 'y', 0)
widthparm = ProfileInt(sys_fx_positon, this.ClassName(), 'width', 0)
heightparm = ProfileInt(sys_fx_positon, this.ClassName(), 'height', 0)
if (ifMax = 1) then
	this.WindowState = Maximized!
elseif (widthparm > 0 and heightparm > 0) then
	if (xparm <= 0) then xparm = 0
	if (yparm <= 0) then yparm = 0
	if (xparm + widthparm > PixelsToUnits(env.screenwidth, XPixelsToUnits!)) then xparm = (PixelsToUnits(env.screenwidth, XPixelsToUnits!) - widthparm) / 2
	if (yparm + heightparm > PixelsToUnits(env.screenheight, YPixelsToUnits!)) then yparm = (PixelsToUnits(env.screenheight, YPixelsToUnits!) - heightparm - 176) / 2
	this.Move(xparm, yparm)
	this.Width = widthparm
	this.Height = heightparm
else
	this.Move ( (PixelsToUnits(env.screenwidth, XPixelsToUnits!) - this.workspacewidth()) / 2,&
		(PixelsToUnits(env.screenheight, YPixelsToUnits!) - this.workspaceheight() - 176) / 2)
end if

return 0
end function

event open;this.triggerevent('ue_before_open')
wf_movetocenter()

//====================================================================
//菜单打开
//if_ue_retr=false
//if_ue_filter=false
//if_ue_sort=false
//if_ue_sentdataout=false
//====================================================================


end event

on w_publ_base.create
this.cb_func=create cb_func
this.cb_exit=create cb_exit
this.Control[]={this.cb_func,&
this.cb_exit}
end on

on w_publ_base.destroy
destroy(this.cb_func)
destroy(this.cb_exit)
end on

event close;// 记录浮动窗口信息
long xparm, yparm, widthparm, heightparm, ifMax
if (this.WindowState = Maximized!) then
	ifMax = 1
	SetProfileString (sys_fx_positon, this.ClassName(), 'ifmax', string(ifMax))
else
	ifMax = 0
	xparm = this.X
	yparm = this.Y
	widthparm = this.Width
	heightparm = this.Height
	
	SetProfileString (sys_fx_positon, this.ClassName(), 'ifmax', string(ifMax))
	SetProfileString (sys_fx_positon, this.ClassName(), 'x', string(xparm))
	SetProfileString (sys_fx_positon, this.ClassName(), 'y', string(yparm))
	SetProfileString (sys_fx_positon, this.ClassName(), 'width', string(widthparm))
	SetProfileString (sys_fx_positon, this.ClassName(), 'height', string(heightparm))
end if

end event

type cb_func from uo_imflatbutton within w_publ_base
event ue_retr ( )
event ue_filter ( )
event ue_sort ( )
event ue_sentdataout ( )
integer width = 311
integer height = 96
integer taborder = 20
string text = "功能"
end type

event ue_retr();parent.triggerevent('ue_retr')
end event

event ue_filter();parent.triggerevent('ue_filter')
end event

event ue_sort();parent.triggerevent('ue_sort')
end event

event ue_sentdataout();parent.triggerevent('ue_sentdataout')
end event

event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
string menustr

if if_ue_retr then
	menustr="Text=查询~tEvent=ue_retr"
end if

if if_ue_filter then
	if len(trim(menustr))=0 then
		menustr="Text=高级筛选~tEvent=ue_filter"
	else
		menustr=menustr + "|" + "Text=高级筛选~tEvent=ue_filter"
	end if
end if

if if_ue_sort then
	if len(trim(menustr))=0 then
		menustr="Text=排序~tEvent=ue_sort"
	else
		menustr=menustr + "|" + "Text=排序~tEvent=ue_sort"
	end if
end if

if menustr<>"" and if_ue_sentdataout then menustr=menustr + "|" + "Text=-"

if if_ue_sentdataout then
	if len(trim(menustr))=0 then
		menustr="Text=数据发送~tEvent=ue_sentdataout"
	else
		menustr=menustr + "|" + "Text=数据发送~tEvent=ue_sentdataout"
	end if
end if
	
if len(trim(menustr))<>0 then
	dmPopupMenu = Create m_Dfc_Control_PopupMenu
	dmPopupMenu.mf_BuildMenu(This, menustr)
	dmPopupMenu.mf_PopMenu()
	Destroy dmPopupMenu
end if
end event

type cb_exit from uo_imflatbutton within w_publ_base
integer x = 315
integer width = 311
integer height = 96
integer taborder = 10
string text = "退出"
boolean cancel = true
string normalpicname = "exit.bmp"
end type

event clicked;call super::clicked;close(parent)
end event

