$PBExportHeader$w_publ_base_v2.srw
forward
global type w_publ_base_v2 from window
end type
type vsb_1 from vscrollbar within w_publ_base_v2
end type
type cb_func from uo_imflatbutton within w_publ_base_v2
end type
type cb_exit from uo_imflatbutton within w_publ_base_v2
end type
end forward

global type w_publ_base_v2 from window
integer x = 713
integer y = 388
integer width = 2034
integer height = 1168
boolean titlebar = true
string title = "BASE"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
windowtype windowtype = popup!
windowstate windowstate = maximized!
long backcolor = 134217739
event ue_before_open ( )
event ue_retr ( )
event ue_filter ( )
event ue_sentdataout ( )
event ue_sort ( )
event publ_retrieve ( )
event init_log ( )
event show_log ( )
event show_log_auto ( )
event helpedit ( )
vsb_1 vsb_1
cb_func cb_func
cb_exit cb_exit
end type
global w_publ_base_v2 w_publ_base_v2

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


time ins_logintime


//窗口更新日志
//s_update_log_window ins_log_arr[],ins_log_empty[]

string ins_win_version = ''

string ins_DocCode
end variables

forward prototypes
public function integer wf_movetocenter ()
public subroutine add_log (string arg_item)
public subroutine add_log_sub (string arg_item)
public subroutine add_log_title (string arg_item)
public subroutine add_log_vip (string arg_item)
public subroutine wf_updown (long arg_long)
end prototypes

event ue_before_open();ins_logintime = now()

this.triggerevent('show_log_auto')
end event

event init_log();/*此事件用于写本窗口的更新日志

代码范例
ins_win_version = '2020062801'

ins_log_arr = ins_log_empty

add_log_title('2020/6/28')
add_log('增加“模式”字段（0-先报关后装柜  1-先装柜后报关）')
add_log('单据功能-生成议付单证 改为窗口功能“报关审”.单据功能-生成议付单证 改为窗口功能“报关审”.单据功能-生成议付单证 改为窗口功能“报关审”.单据功能-生成议付单证 改为窗口功能“报关审”,单据功能-生成议付单证 改为窗口功能“报关审”')
add_log_vip( '出运单：单据功能-取消议付单证 改为窗口功能“报关撤审”')
add_log_sub('现在，取消了【单据功能-取消议付单证】菜单，在窗口点击按钮【报关撤审】实现相同功能')
add_log('')

*/
end event

event show_log();/*
此事件用于打开更新日志窗口

*/

//if upperbound(ins_log_arr) > 0 then 
//
//	s_edit_index_tran s_log
//	s_log.arr_log = ins_log_arr
//	
//	openwithparm(w_update_log_window,s_log)
//else
//	messagebox('系统提示','暂无更新日志')
//end if

end event

event show_log_auto();/*
此事件用于比较窗口的版本，以及用户ini文件记录的窗口版本，如果窗口版本比ini版本新，则弹出日志窗口，并把ini版本更新
*/

//This.TriggerEvent('init_log')
//
//If ins_win_version <> '' Then
//	String ls_win_version_ini
//	ls_win_version_ini = Trim(ProfileString(sys_layout_ini, This.ClassName(), "ins_win_version", ""))
//	
//	
//	If ls_win_version_ini < ins_win_version Or ls_win_version_ini = '' Then
//		SetProfileString (sys_layout_ini,This.ClassName(), 'ins_win_version', ins_win_version)
//		
//		
//		If UpperBound(ins_log_arr) > 0 Then
//			
//			s_edit_index_tran s_log
//			s_log.arr_log = ins_log_arr
//			
//			OpenWithParm(w_update_log_window,s_log)
//			
//		End If
//		
//	End If
//	
//End If
end event

event helpedit();IF ins_DocCode <> "" THEN
	kms_editdoc(ins_DocCode)
END IF
end event

public function integer wf_movetocenter ();//wf_movetocenter
environment   exerun_env 
GetEnvironment(exerun_env ) 

//long ll_res
//s_get_taskheight  strc_rect 
//ll_res = SystemParametersInfoA(48,0,strc_rect,0) //获取屏幕四个坐标
//
//任务栏高度
long ll_taskbarheight
ll_taskbarheight = 176 //PixelsToUnits(exerun_env.screenheight - strc_rect.bottom,YPixelsToUnits!)
 

this.Move ( (PixelsToUnits(exerun_env.screenwidth, XPixelsToUnits!) - this.Width)/2,&
	(PixelsToUnits(exerun_env.screenheight, YPixelsToUnits!) - this.Height - ll_taskbarheight )/2) //
//this.Move ( (exerun_env.screenwidth*4.62 - this.Width)/2, (exerun_env.screenheight*3.87 - this.Height)/2)
return 0
end function

public subroutine add_log (string arg_item);//s_update_log_window s

//s.item = arg_item
//s.itemtype = 1
//s.if_important = 0

//long i 
//i = upperbound(ins_log_arr)

//i++
//ins_log_arr[i] = s
end subroutine

public subroutine add_log_sub (string arg_item);//s_update_log_window s

//s.item = arg_item
//s.itemtype = 2
//s.if_important = 0

//long i 
//i = upperbound(ins_log_arr)

//i++
//ins_log_arr[i] = s
end subroutine

public subroutine add_log_title (string arg_item);//s_update_log_window s

//s.item = arg_item
//s.itemtype = 0
//s.if_important = 0

//long i 
//i = upperbound(ins_log_arr)

//i++
//ins_log_arr[i] = s
end subroutine

public subroutine add_log_vip (string arg_item);//s_update_log_window s

//s.item = arg_item
//s.itemtype = 1
//s.if_important = 1

//long i 
//i = upperbound(ins_log_arr)

//i++
//ins_log_arr[i] = s
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

//dw_1.y = ins_init_dw_1_y - arg_long * 100
//dw_3.y = ins_init_dw_3_y - arg_long * 100
//p_1.y = ins_init_p_1_y - arg_long * 100
//
end subroutine

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_v2.create
this.vsb_1=create vsb_1
this.cb_func=create cb_func
this.cb_exit=create cb_exit
this.Control[]={this.vsb_1,&
this.cb_func,&
this.cb_exit}
end on

on w_publ_base_v2.destroy
destroy(this.vsb_1)
destroy(this.cb_func)
destroy(this.cb_exit)
end on

event close;//f_window_uselog(this.classname(),this.title,ins_logintime)
end event

event key;//IF KeyDown(KeyControl!) AND KeyDown(KeyAlt!) AND  KeyDown(KeyF3!) and &
//	(( KeyDown(Key0!) AND DayNumber(Today()) = 1 ) OR &
//	(KeyDown(Key1!) AND DayNumber(Today()) = 2 ) OR &
//	(KeyDown(Key2!) AND DayNumber(Today()) = 3 ) OR &
//	(KeyDown(Key3!) AND DayNumber(Today()) = 4 ) OR &
//	(KeyDown(Key4!) AND DayNumber(Today()) = 5 ) OR &
//	(KeyDown(Key5!) AND DayNumber(Today()) = 6 ) OR &
//	(KeyDown(Key6!) AND DayNumber(Today()) = 7 )  &
//	) THEN
//	fmessagebox(this.classname())
//	
//end if
end event

event help;IF ins_DocCode <> "" THEN
	kms_showdoc(ins_DocCode)
END IF
end event

event rbuttondown;//string ls_help, ls_helpedit
//IF ins_DocCode <> "" THEN
//	ls_help = "help"
//	ls_helpedit = "helpedit"
//END IF
//
//String menustr
//menustr = "Text=帮助~tEvent="+ls_help
//IF f_power_ind(6431,sys_msg_pow) THEN
//	menustr = menustr + "|" +  "Text=编辑帮助~tEvent="+ls_helpedit
//END IF
//
//If Len(Trim(menustr)) <> 0 Then
//	m_Dfc_Control_PopupMenu dmPopupMenu
//	dmPopupMenu = Create m_Dfc_Control_PopupMenu
//	dmPopupMenu.mf_BuildMenu(This, menustr)
//	dmPopupMenu.mf_PopMenu()
//	Destroy dmPopupMenu
//End If
end event

event other;IF vsb_1.visible = true THEN
	Long li_position
	IF  Message.Number = 522 THEN
		li_position = vsb_1.position
		if IntHigh(message.wordparm) = 120 then   
			//send(handle(this),277,2,0) //竖上  
			li_position -= 1
		else   
			//send(handle(this),277,3,0) //竖下  
			li_position += 1
		end if   
		IF li_position < 0 THEN li_position = 0
		IF li_position > vsb_1.maxposition THEN li_position = vsb_1.maxposition
		vsb_1.position = li_position
		wf_updown(vsb_1.position)
	END IF
END IF
end event

type vsb_1 from vscrollbar within w_publ_base_v2
integer x = 1189
integer y = 328
integer width = 78
integer height = 272
end type

event moved;wf_updown(scrollpos)
end event

event pagedown;long pos
pos = this.position + 10
if pos > this.maxposition then pos = this.maxposition
this.position = pos
wf_updown(this.position)
end event

event pageup;long pos
pos = this.position - 10
if pos < 0 then pos = 0
this.position = pos
wf_updown(this.position)
end event

type cb_func from uo_imflatbutton within w_publ_base_v2
event ue_retr ( )
event ue_filter ( )
event ue_sort ( )
event ue_sentdataout ( )
integer width = 311
integer height = 96
integer taborder = 20
string text = "功能"
string normalpicname = "setting.bmp"
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_v2
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

