$PBExportHeader$u_dwlv.sru $PBExportComments$Datawindow Listview forward global type u_dwlv from u_dw_form end type end forward global type u_dwlv from u_dw_form boolean hscrollbar = true boolean vscrollbar = true boolean #autosizecolumns = false event ke_rowactivate ( readonly long row, readonly string dwoname ) event dwprocessenter pbm_dwnprocessenter event ke_headersizing ( readonly integer index ) event ke_dwmousemove pbm_dwnmousemove event ke_lbuttonup pbm_dwnlbuttonup event ke_lbuttondown pbm_lbuttondown event ke_timer pbm_timer end type global u_dwlv u_dwlv type variables Public: Boolean #RowSelection = TRUE Boolean #ListViewStyle = TRUE, #SortHeaders = TRUE Boolean #FixedHeaderHeight = TRUE integer #SelectionMode = CDWRowSelect.EXTENDED Boolean #AlternateRowColors, #UseThemeAlternateColor = TRUE long #AlternateColor = CColor.LINEN Protected: //Row Selection str_dwrowselect istr_rowselect Private: CONSTANT string ROWSELECTION_SVC = "n_svc_dw_rowselection" CONSTANT string DWLV_SVC = "n_svc_dwlv" long Anchorpoint, SizeIndex str_dwheader istr_headers[], LastHeader, istr_exclude[] Boolean MouseCaptured, MouseDown, MouseOut CONSTANT double INTERVAL = 0.1 Boolean SuspendSelection n_timing inv_timer integer ii_last_x, ii_last_y //new //string is_LastVisibleColumn end variables forward prototypes public subroutine of_setselectionmode (readonly integer ai_selectionmode) public subroutine of_excludecolumn (readonly string as_colname) public subroutine of_showsortarrows () public subroutine of_alternaterowcolors (readonly boolean ab_set) public subroutine of_editmode (readonly boolean ab_editmode) public function integer of_setdataobject (readonly string as_dataobjectname) public subroutine of_resizelines () public subroutine of_suspendselection (readonly boolean ab_suspend) protected subroutine of_firetimer () protected subroutine of_stoptimer () public subroutine of_initdwlv () public subroutine of_settheme (readonly str_theme astr) end prototypes event ke_rowactivate(readonly long row, readonly string dwoname);//triggered when row is doubleclicked or enter pressed end event event dwprocessenter;long ll_row ll_row = this.GetRow() IF ll_row > 0 THEN this.EVENT ke_rowactivate(ll_row, "") //prevent next row selection RETURN 1 end event event ke_headersizing(readonly integer index);// end event event ke_dwmousemove;call super::ke_dwmousemove;IF #ListViewStyle THEN IF ii_last_x <> xpos OR ii_last_y <> ypos THEN ii_last_x = xpos ii_last_y = ypos n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) lnv_dwlv.of_dwmousemove(lnv_svc, & this, & xpos, & ypos, & row, & STRING(dwo.name), & istr_headers, & istr_exclude, & MouseDown, & MouseCaptured, & #SortHeaders, & AnchorPoint, & SizeIndex) END IF END IF end event event ke_lbuttonup;IF #ListViewStyle THEN string ls n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv MouseDown = FALSE AnchorPoint = 0 lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) lnv_dwlv.of_dwmousemove(lnv_svc, this, xpos, ypos, row, STRING(dwo.name), istr_headers, istr_exclude, MouseDown, mousecaptured, #SortHeaders, anchorpoint, SizeIndex) lnv_dwlv.of_pressheader(this, LastHeader, FALSE) ls = GetObjectAtPointer() IF POS(ls, "~t") > 0 THEN ls = MID(ls, 1, POS(ls, "~t") - 1) IF ls = LastHeader.header AND Sizeindex <= 0 THEN IF lnv_dwlv.of_isinheader(this, xpos, ypos) THEN & lnv_dwlv.of_clicked(lnv_svc, this, ls, istr_headers, istr_exclude) END IF SetPointer(Arrow!) END IF end event event ke_lbuttondown;IF #ListViewStyle THEN IF NOT #SortHeaders THEN RETURN string ls n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv long ll_index ls = GetObjectAtPointer() ls = MID(ls, 1, POS(ls, "~t") - 1) lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) IF lnv_dwlv.of_isheader(ls, istr_headers) THEN IF SizeIndex <= 0 THEN ll_index = lnv_dwlv.of_GetHeaderIndex(ls, istr_headers) IF ll_index > 0 THEN LastHeader = istr_headers[ll_index] lnv_dwlv.of_PressHeader(this, LastHeader, TRUE) END IF END IF END IF END IF end event event ke_timer;of_StopTimer() of_ResizeLines() end event public subroutine of_setselectionmode (readonly integer ai_selectionmode);#SelectionMode = ai_selectionmode end subroutine public subroutine of_excludecolumn (readonly string as_colname);long ll ll = UPPERBOUND(istr_exclude) ll ++ istr_exclude[ll].header = as_colname + "_t" istr_exclude[ll].column = as_colname end subroutine public subroutine of_showsortarrows ();n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv IF #ListViewStyle THEN lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) //force mousemove to correct sort shade sizing lnv_dwlv.of_dwmousemove(lnv_svc, & this, & 0, & 0, & this.GetRow(), & STRING(""), & istr_headers, & istr_exclude, & MouseDown, & MouseCaptured, & #SortHeaders, & AnchorPoint, & SizeIndex) lnv_dwlv.of_ShowSortArrows(this, istr_headers) END IF end subroutine public subroutine of_alternaterowcolors (readonly boolean ab_set);n_svc_dwlv lnv_dw n_svc_mgr lnv_svc long ll_color #AlternateRowColors = ab_set lnv_svc.of_LoadSvc(lnv_dw, DWLV_SVC) IF #UseThemeAlternateColor THEN n_svc_theme lnv_t n_svc_color lnv_c str_theme lstr lnv_svc.of_LoadSvc(lnv_t, CSvc.THEME) lstr = lnv_t.of_GetTheme() ll_color = lstr.hotgradientstart lnv_svc.of_LoadSvc(lnv_c, CSvc.COLOR) ll_color = lnv_c.of_Lightencolor(lnv_svc, 30, ll_color) ELSE ll_color = #AlternateColor END IF lnv_dw.of_Alternaterowcolor(this, #AlternateRowColors, ll_color) end subroutine public subroutine of_editmode (readonly boolean ab_editmode);n_svc_mgr lnv_svc n_svc_dwlv lnv_f IF NOT INIT_EDITMODE THEN of_initeditmode() //IF IS_EDITMODE = ab_editmode THEN RETURN IS_EDITMODE = ab_editmode lnv_svc.of_LoadSvc(lnv_f, DWLV_SVC) lnv_f.of_EditMode(lnv_svc, this, is_taborders, is_validatecolumns, ab_editmode) end subroutine public function integer of_setdataobject (readonly string as_dataobjectname);IF SUPER::of_SetDataobject(as_dataobjectname) = CRet.FAILURE THEN & RETURN CREt.FAILURE of_InitDWLV() RETURN CRet.SUCCESS end function public subroutine of_resizelines ();IF UPPERBOUND(istr_headers) > 0 THEN n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) lnv_dwlv.of_ResizeLines(this, istr_headers) END IF end subroutine public subroutine of_suspendselection (readonly boolean ab_suspend);SuspendSelection = ab_suspend end subroutine protected subroutine of_firetimer ();IF NOT ISVALID(inv_timer) THEN inv_timer = CREATE n_timing inv_timer.event ke_setparent(this, "ke_timer") END IF inv_timer.Stop() inv_timer.Start(INTERVAL) end subroutine protected subroutine of_stoptimer ();IF ISVALID(inv_timer) THEN inv_timer.Stop() DESTROY inv_timer END IF end subroutine public subroutine of_initdwlv ();IF #ListViewStyle THEN n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) lnv_dwlv.of_makedwlv(lnv_svc, this, istr_headers) END IF end subroutine public subroutine of_settheme (readonly str_theme astr);n_svc_mgr lnv_svc n_svc_dwlv lnv_d lnv_svc.of_LoadSvc(lnv_d, DWLV_SVC) lnv_d.of_SetTheme(lnv_svc, this, istr_headers, astr) of_AlternateRowColors(#AlternateRowColors) end subroutine on u_dwlv.create call super::create end on on u_dwlv.destroy call super::destroy end on event rowfocuschanged;call super::rowfocuschanged;IF #Rowselection THEN IF SuspendSelection THEN RETURN n_svc_dw_rowselection lnv_dwrs n_svc_mgr lnv_svc lnv_svc.of_LoadSvc(lnv_dwrs, ROWSELECTION_SVC) lnv_dwrs.of_RowFocusChanged(this, #SelectionMode, currentrow, istr_rowselect) END IF end event event clicked;call super::clicked;n_svc_mgr lnv_svc n_svc_dwlv lnv_dwlv IF #ListViewStyle THEN lnv_svc.of_LoadSvc(lnv_dwlv, DWLV_SVC) IF lnv_dwlv.of_IsInHeader(this, xpos, ypos) THEN MouseDown = TRUE AnchorPoint = lnv_dwlv.of_MarkAnchor(this, xpos, ypos, istr_headers, istr_exclude) END IF END IF IF #Rowselection THEN n_svc_dw_rowselection lnv_dwrs lnv_svc.of_loadsvc(lnv_dwrs, ROWSELECTION_SVC) lnv_dwrs.of_clicked(this, row, #selectionmode, dwo, istr_rowselect) END IF end event event ke_preopen;call super::ke_preopen;IF #RowSelection THEN this.SetRowFocusIndicator(FocusRect!) END IF end event event doubleclicked;call super::doubleclicked;IF row > 0 THEN this.EVENT ke_rowactivate(row, STRING(dwo.name)) END IF end event event resize;call super::resize;IF #ListViewStyle THEN of_FireTimer() END IF end event
- Sources
- Kodigo
- OpenExplorer
- u_dwlv.sru
File: u_dwlv.sru
Size: 8895
Date: Mon, 07 Apr 2008 21:31:53 +0200
Size: 8895
Date: Mon, 07 Apr 2008 21:31:53 +0200
- u_dw_form u_dwlv(sru)
- clicked
- doubleclicked
- dwprocessenter
- ke_dwmousemove
- ke_headersizing(readonly integer index)
- ke_lbuttondown
- ke_lbuttonup
- ke_preopen
- ke_rowactivate(readonly long row, readonly string dwoname)
- ke_timer
- resize
- rowfocuschanged
- of_alternaterowcolors (readonly boolean ab_set)
- of_editmode (readonly boolean ab_editmode)
- of_excludecolumn (readonly string as_colname)
- of_firetimer ()
- of_initdwlv ()
- of_resizelines ()
- of_setdataobject (readonly string as_dataobjectname) returns integer
- of_setselectionmode (readonly integer ai_selectionmode)
- of_settheme (readonly str_theme astr)
- of_showsortarrows ()
- of_stoptimer ()
- of_suspendselection (readonly boolean ab_suspend)