File: u_controls_tv.sru
Size: 4346
Date: Mon, 07 Apr 2008 21:32:57 +0200
$PBExportHeader$u_controls_tv.sru
forward
global type u_controls_tv from u_explorer
end type
type cb_5 from u_cb within u_controls_tv
end type
type cb_4 from u_cb within u_controls_tv
end type
type cb_3 from u_cb within u_controls_tv
end type
type cb_2 from u_cb within u_controls_tv
end type
type mle_1 from u_mle within u_controls_tv
end type
type cb_1 from u_cb within u_controls_tv
end type
type tv_1 from u_tv within u_controls_tv
end type
end forward

global type u_controls_tv from u_explorer
cb_5 cb_5
cb_4 cb_4
cb_3 cb_3
cb_2 cb_2
mle_1 mle_1
cb_1 cb_1
tv_1 tv_1
end type
global u_controls_tv u_controls_tv

on u_controls_tv.create
int iCurrent
call super::create
this.cb_5=create cb_5
this.cb_4=create cb_4
this.cb_3=create cb_3
this.cb_2=create cb_2
this.mle_1=create mle_1
this.cb_1=create cb_1
this.tv_1=create tv_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.cb_5
this.Control[iCurrent+2]=this.cb_4
this.Control[iCurrent+3]=this.cb_3
this.Control[iCurrent+4]=this.cb_2
this.Control[iCurrent+5]=this.mle_1
this.Control[iCurrent+6]=this.cb_1
this.Control[iCurrent+7]=this.tv_1
end on

on u_controls_tv.destroy
call super::destroy
destroy(this.cb_5)
destroy(this.cb_4)
destroy(this.cb_3)
destroy(this.cb_2)
destroy(this.mle_1)
destroy(this.cb_1)
destroy(this.tv_1)
end on

event ke_postopen;call super::ke_postopen;n_ds lds
n_svc_mgr lnv_svc
n_svc_tv lnv_tv
long ll_node

lds = CREATE n_ds
lds.of_SetDataobject("d_2tv")

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
lnv_tv.of_Convertdatastore(lnv_svc, &
                  lds, &
                  tv_1, &
                  "-1")
end event

type cb_5 from u_cb within u_controls_tv
integer x = 987
integer y = 432
integer width = 645
integer taborder = 60
string text = "Get Total Items"
boolean #anchorright = true
end type

event clicked;call super::clicked;n_svc_mgr lnv_svc
n_svc_tv lnv_tv

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
mle_1.text = "Total Items: " + STRING(lnv_tv.of_totalitems(tv_1))
end event

type cb_4 from u_cb within u_controls_tv
integer x = 987
integer y = 332
integer width = 645
integer taborder = 50
string text = "Select Item from Path"
boolean #anchorright = true
end type

event clicked;call super::clicked;n_svc_mgr lnv_svc
n_svc_tv lnv_tv
long ll_handle

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
ll_handle = lnv_tv.of_getitemfrompath(lnv_svc, tv_1, mle_1.text)
IF ll_handle > 0 THEN
   tv_1.SelectItem(ll_handle)
END IF
end event

type cb_3 from u_cb within u_controls_tv
integer x = 987
integer y = 232
integer width = 645
integer taborder = 40
string text = "Get Selected Path"
boolean #anchorright = true
end type

event clicked;call super::clicked;n_svc_mgr lnv_svc
n_svc_tv lnv_tv

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
mle_1.text = lnv_tv.of_getstringpath(tv_1, tv_1.FindItem(CurrentTreeItem!, 0))
end event

type cb_2 from u_cb within u_controls_tv
integer x = 987
integer y = 132
integer width = 645
integer taborder = 30
string text = "Uncheck All"
boolean #anchorright = true
end type

event clicked;call super::clicked;n_svc_mgr lnv_svc
n_svc_tv lnv_tv

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
lnv_tv.of_uncheckall(tv_1, TRUE)
end event

type mle_1 from u_mle within u_controls_tv
integer x = 37
integer y = 608
integer width = 905
integer taborder = 30
string text = ""
boolean #anchorleft = true
boolean #anchorright = true
boolean #anchorbottom = true
end type

type cb_1 from u_cb within u_controls_tv
integer x = 987
integer y = 32
integer width = 645
integer taborder = 20
string text = "Get Checked Items"
boolean #anchorright = true
end type

event clicked;call super::clicked;n_svc_mgr lnv_svc
n_svc_tv lnv_tv
treeviewitem ltvi[]
long ll_count, n

lnv_svc.of_LoadSvc(lnv_tv, CSvc.TV)
lnv_tv.of_GetSelectedItems(tv_1, ltvi)

mle_1.text = CString.EMPTY

ll_count = UPPERBOUND(ltvi)
FOR n = 1 to ll_count
   mle_1.text += ltvi[n].Label + CString.CR_NEWLINE
NEXT
end event

type tv_1 from u_tv within u_controls_tv
integer x = 37
integer y = 32
integer width = 905
integer height = 560
integer taborder = 10
boolean #standardimages = true
boolean #stateimages = true
boolean #anchortop = true
boolean #anchorleft = true
boolean #anchorright = true
boolean #anchorbottom = true
end type