$PBExportHeader$w_dropdown_dw_sort.srw forward global type w_dropdown_dw_sort from w_base_dropdown end type type st_3 from u_st within w_dropdown_dw_sort end type type st_2 from u_st within w_dropdown_dw_sort end type type st_1 from u_st within w_dropdown_dw_sort end type type cb_down from u_cb within w_dropdown_dw_sort end type type cb_up from u_cb within w_dropdown_dw_sort end type type cb_ok from u_cb within w_dropdown_dw_sort end type type cb_cancel from u_cb within w_dropdown_dw_sort end type type uo_panel_destination from u_borderpanel within w_dropdown_dw_sort end type type dw_1 from u_dwlv within w_dropdown_dw_sort end type type uo_panel_source from u_borderpanel within w_dropdown_dw_sort end type type uo_gradient from u_st_gradient within w_dropdown_dw_sort end type type dw_2 from u_dwlv within w_dropdown_dw_sort end type type uo_1 from u_st_gradient within w_dropdown_dw_sort end type end forward global type w_dropdown_dw_sort from w_base_dropdown integer width = 1664 integer height = 872 long backcolor = 67108864 st_3 st_3 st_2 st_2 st_1 st_1 cb_down cb_down cb_up cb_up cb_ok cb_ok cb_cancel cb_cancel uo_panel_destination uo_panel_destination dw_1 dw_1 uo_panel_source uo_panel_source uo_gradient uo_gradient dw_2 dw_2 uo_1 uo_1 end type global w_dropdown_dw_sort w_dropdown_dw_sort type variables Private: Datawindow idw end variables forward prototypes public subroutine of_addsortrow (readonly long al_row) public subroutine of_removesortrow (readonly long al_row) public subroutine of_sort () protected subroutine of_buttoncheck () protected subroutine of_moverow (readonly boolean ab_up) end prototypes public subroutine of_addsortrow (readonly long al_row);dw_1.SetRedraw(FALSE) dw_1.SetItem(al_row, "flag", 1) dw_1.SetItem(al_row, "sortascending", 1) dw_1.RowsMove(al_row, al_row, Primary!, dw_2, dw_2.RowCount() + 1, Primary!) dw_1.SetRedraw(TRUE) cb_ok.Enabled = TRUE of_buttoncheck() end subroutine public subroutine of_removesortrow (readonly long al_row);dw_2.SetRedraw(FALSE) dw_2.SetItem(al_row, "flag", 0) dw_2.RowsMove(al_row, al_row, Primary!, dw_1, 1, Primary!) dw_2.Sort() dw_2.SetRedraw(TRUE) cb_ok.Enabled = TRUE of_buttoncheck() end subroutine public subroutine of_sort ();long ll_count, n string ls_sort ll_count = dw_2.RowCount() FOR n = 1 to ll_count IF n > 1 THEN ls_sort += ", " ls_sort += dw_2.GetItemString(n, "colname") IF dw_2.GetItemNumber(n, "sortascending") = 1 THEN ls_sort += " A" ELSE ls_sort += " D" END IF NEXT idw.SetSort(ls_sort) idw.Sort() end subroutine protected subroutine of_buttoncheck ();long llc, llr llc = dw_2.Rowcount() IF llc <= 1 THEN cb_up.Enabled = FALSE cb_down.Enabled = FALSE RETURN END IF llr = dw_2.GetSelectedRow(0) IF llr <= 0 THEN cb_up.Enabled = FALSE cb_down.Enabled = FALSE RETURN END IF cb_up.Enabled = TRUE cb_down.Enabled = TRUE IF llr = 1 THEN cb_up.Enabled = FALSE END IF IF llr = llc THEN cb_down.Enabled = FALSE END IF end subroutine protected subroutine of_moverow (readonly boolean ab_up);long llc, llt llc = dw_2.GetSelectedRow(0) IF ab_up THEN llt = llc - 1 dw_2.RowsMove(llc, llc, Primary!, dw_2, llt, Primary!) ELSE llt = llc + 1 dw_2.RowsMove(llc, llc, Primary!, dw_2, llt + 1, Primary!) END IF dw_2.SelectRow(0, FALSE) dw_2.SelectRow(llt, TRUE) IF NOT cb_ok.Enabled THEN cb_ok.Enabled = TRUE of_Buttoncheck() end subroutine on w_dropdown_dw_sort.create int iCurrent call super::create this.st_3=create st_3 this.st_2=create st_2 this.st_1=create st_1 this.cb_down=create cb_down this.cb_up=create cb_up this.cb_ok=create cb_ok this.cb_cancel=create cb_cancel this.uo_panel_destination=create uo_panel_destination this.dw_1=create dw_1 this.uo_panel_source=create uo_panel_source this.uo_gradient=create uo_gradient this.dw_2=create dw_2 this.uo_1=create uo_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_3 this.Control[iCurrent+2]=this.st_2 this.Control[iCurrent+3]=this.st_1 this.Control[iCurrent+4]=this.cb_down this.Control[iCurrent+5]=this.cb_up this.Control[iCurrent+6]=this.cb_ok this.Control[iCurrent+7]=this.cb_cancel this.Control[iCurrent+8]=this.uo_panel_destination this.Control[iCurrent+9]=this.dw_1 this.Control[iCurrent+10]=this.uo_panel_source this.Control[iCurrent+11]=this.uo_gradient this.Control[iCurrent+12]=this.dw_2 this.Control[iCurrent+13]=this.uo_1 end on on w_dropdown_dw_sort.destroy call super::destroy destroy(this.st_3) destroy(this.st_2) destroy(this.st_1) destroy(this.cb_down) destroy(this.cb_up) destroy(this.cb_ok) destroy(this.cb_cancel) destroy(this.uo_panel_destination) destroy(this.dw_1) destroy(this.uo_panel_source) destroy(this.uo_gradient) destroy(this.dw_2) destroy(this.uo_1) end on event ke_initvalue;call super::ke_initvalue;idw = value n_svc_dw lnv_dw n_svc_mgr lnv_svc n_svc_isempty lnv_check n_svc_string lnv_str string ls_cols[], ls_sort[], ls_dir[] string ls_tmp long ll_count, n, ll_scount, m, ll_asc, ll_row boolean lb_found lnv_svc.of_LoadSvc(lnv_dw, CSvc.DW) lnv_svc.of_LoadSvc(lnv_check, CSvc.ISEMPTY) lnv_svc.of_LoadSvc(lnv_str, CSvc.STRING) ll_scount = lnv_dw.of_GetSort(lnv_svc, idw, ls_sort, ls_dir) FOR m = 1 to ll_scount dw_2.InsertRow(0) dw_2.SetItem(m, "colname", ls_sort[m]) dw_2.SetItem(m, "flag", 1) ls_tmp = idw.Describe(ls_sort[m] + "_t.Text") IF NOT lnv_dw.of_IsErrorstring(ls_tmp) THEN IF NOT lnv_check.of_IsEmpty(ls_tmp) THEN //remove special characters IF POS(ls_tmp, CString.CR_NEWLINE) > 0 THEN ls_tmp = lnv_str.of_GlobalReplace(ls_tmp, CString.CR_NEWLINE, CString.SPACE) END IF IF POS(ls_tmp, CString.NEWLINE) > 0 THEN ls_tmp = lnv_str.of_GlobalReplace(ls_tmp, CString.NEWLINE, CString.EMPTY) END IF IF POS(ls_tmp, CString.CR) > 0 THEN ls_tmp = lnv_str.of_GlobalReplace(ls_tmp, CString.CR, CString.EMPTY) END IF dw_2.SetItem(m, "colheader", ls_tmp) END IF END IF IF UPPER(ls_dir[m]) = "A" THEN ll_asc =1 ELSE ll_asc = 0 END IF dw_2.SetItem(m, "sortascending", ll_asc) NEXT ll_count = lnv_dw.of_GetVisiblecolumns(lnv_svc, idw, ls_cols, TRUE, FALSE) FOR n = 1 to ll_count lb_found = FALSE //check if sort col FOR m = 1 to ll_scount IF ls_cols[n] = ls_sort[m] THEN lb_found = TRUE EXIT END IF NEXT IF lb_found THEN CONTINUE ll_row = dw_1.InsertRow(0) dw_1.SetItem(ll_row, "colname", ls_cols[n]) ls_tmp = idw.Describe(ls_cols[n] + "_t.Text") IF NOT lnv_dw.of_IsErrorstring(ls_tmp) THEN IF NOT lnv_check.of_IsEmpty(ls_tmp) THEN dw_1.SetItem(ll_row, "colheader", ls_tmp) END IF END IF NEXT of_buttoncheck() end event event ke_preopen;call super::ke_preopen;uo_gradient.of_SetColor(CColor.ORANGE) uo_gradient.of_SetFontColor(CColor.BLACK) // uo_panel_source.uo_gradient.of_SetColor(CColor.GRAY) uo_panel_source.uo_gradient.of_SetFontColor(CColor.BLACK) uo_panel_destination.uo_gradient.of_SetColor(CColor.GRAY) uo_panel_destination.uo_gradient.of_SetFontColor(CColor.BLACK) end event type st_3 from u_st within w_dropdown_dw_sort integer x = 1335 integer y = 112 integer width = 174 string text = "ASC" boolean #transparent = true end type type st_2 from u_st within w_dropdown_dw_sort integer x = 713 integer y = 112 integer width = 357 string text = "Columns" boolean #transparent = true end type type st_1 from u_st within w_dropdown_dw_sort integer x = 55 integer y = 112 integer width = 384 string text = "Source Data" boolean #transparent = true end type type cb_down from u_cb within w_dropdown_dw_sort integer x = 1522 integer y = 360 integer width = 105 integer taborder = 50 integer textsize = -10 fontcharset fontcharset = symbol! fontfamily fontfamily = anyfont! string facename = "Marlett" string text = "u" boolean cancel = true boolean #anchorright = true end type event clicked;call super::clicked;of_MoveRow(FALSE) end event type cb_up from u_cb within w_dropdown_dw_sort integer x = 1522 integer y = 244 integer width = 105 integer taborder = 70 integer textsize = -10 fontcharset fontcharset = symbol! fontfamily fontfamily = anyfont! string facename = "Marlett" string text = "t" boolean cancel = true boolean #anchorright = true end type event clicked;call super::clicked;of_MoveRow(TRUE) end event type cb_ok from u_cb within w_dropdown_dw_sort integer x = 901 integer y = 736 integer taborder = 60 boolean enabled = false string text = "Apply" boolean default = true end type event clicked;call super::clicked;of_sort() inv_dropdown.of_setreturnvalue("1") end event type cb_cancel from u_cb within w_dropdown_dw_sort integer x = 1266 integer y = 736 integer taborder = 50 string text = "Cancel" boolean cancel = true end type event clicked;call super::clicked;IF ISVALID(inv_dropdown) THEN inv_dropdown.of_cancel() end event type uo_panel_destination from u_borderpanel within w_dropdown_dw_sort integer x = 695 integer y = 176 integer width = 805 integer height = 528 integer taborder = 30 long #sizeorder = -1 string #childobject = "dw_2" integer #headerheight = 72 integer #headerfontsize = 10 string #headertext = "Columns Asc" end type on uo_panel_destination.destroy call u_borderpanel::destroy end on type dw_1 from u_dwlv within w_dropdown_dw_sort integer x = 73 integer y = 272 integer width = 485 integer taborder = 30 string dataobject = "datawindow_sort_list" boolean hscrollbar = false boolean border = false borderstyle borderstyle = stylebox! long #sizeorder = -1 boolean #listviewstyle = false boolean #sortheaders = false end type event doubleclicked;call super::doubleclicked;IF row > 0 THEN of_AddSortRow(row) END IF end event type uo_panel_source from u_borderpanel within w_dropdown_dw_sort integer x = 37 integer y = 176 integer width = 622 integer height = 528 integer taborder = 20 long #sizeorder = -1 string #childobject = "dw_1" integer #headerheight = 72 integer #headerfontsize = 10 string #headertext = "Source Data" end type on uo_panel_source.destroy call u_borderpanel::destroy end on type uo_gradient from u_st_gradient within w_dropdown_dw_sort integer height = 92 integer taborder = 20 long #sizeorder = 1 boolean #dock = true long #docktype = 1 string #text = "Sort Data - Double-click columns to Set Sort" integer #fontsize = 12 boolean #fontbold = true end type on uo_gradient.destroy call u_st_gradient::destroy end on type dw_2 from u_dwlv within w_dropdown_dw_sort integer x = 841 integer y = 272 integer width = 485 integer taborder = 40 boolean bringtotop = true string dataobject = "datawindow_sort_list" boolean hscrollbar = false boolean border = false borderstyle borderstyle = stylebox! long #sizeorder = -1 boolean #listviewstyle = false boolean #sortheaders = false integer #selectionmode = 1 end type event doubleclicked;call super::doubleclicked;IF row > 0 THEN of_RemoveSortRow(row) END IF end event event itemchanged;call super::itemchanged;cb_ok.Enabled = TRUE end event event rowfocuschanged;call super::rowfocuschanged;of_buttoncheck() end event type uo_1 from u_st_gradient within w_dropdown_dw_sort integer y = 708 integer width = 1655 integer height = 172 integer taborder = 40 long #sizeorder = 2 boolean #dock = true long #docktype = 5 string #dock_control_top = "uo_gradient" string #text = "" integer #fontsize = 12 long #startcolor = 16119285 long #endcolor = 12632256 boolean #verticalgradient = true end type on uo_1.destroy call u_st_gradient::destroy end on
- Sources
- Kodigo
- OpenExplorer
- w_dropdown_dw_sort.srw
File: w_dropdown_dw_sort.srw
Size: 11834
Date: Mon, 07 Apr 2008 21:32:02 +0200
Size: 11834
Date: Mon, 07 Apr 2008 21:32:02 +0200
- w_base_dropdown w_dropdown_dw_sort(srw)
- of_addsortrow (readonly long al_row)
- of_buttoncheck ()
- of_moverow (readonly boolean ab_up)
- of_removesortrow (readonly long al_row)
- of_sort ()
- u_st st_3
- u_st st_2
- u_st st_1
- u_cb cb_down
- u_cb cb_up
- u_cb cb_ok
- u_cb cb_cancel
- u_borderpanel uo_panel_destination
- u_dwlv dw_1
- u_borderpanel uo_panel_source
- u_st_gradient uo_gradient
- u_dwlv dw_2
- u_st_gradient uo_1