PowerBuilder DropDown TreeView
Source Code Example
uo_treeview from userobject
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
forward global type uo_treeview from userobject end type type tv_1 from treeview within uo_treeview end type end forward global type uo_treeview from userobject integer width = 1029 integer height = 756 boolean border = true long backcolor = 67108864 long tabtextcolor = 33554432 long picturemaskcolor = 536870912 event ue_postopen ( ) event key pbm_keydown tv_1 tv_1 end type global uo_treeview uo_treeview type variables String is_id,is_label datawindow idw_request Long il_row String is_dwo end variables event ue_postopen();treeviewitem ltvi_root tv_1.DeleteItem(0) is_id = "" is_label = "" ltvi_root.Data = "root" ltvi_root.Label = "Root" ltvi_root.PictureIndex = 1 ltvi_root.SelectedPictureIndex = 2 ltvi_root.Children = True tv_1.InsertItemLast(0,ltvi_root) end event event key;If Key = keyescape! Then idw_request.SetItem(il_row,is_dwo,"") End If If Key = keyenter! Then idw_request.SetItem(il_row,is_dwo,is_id) End If This.Hide() idw_request.SetFocus() end event on uo_treeview.create this.tv_1=create tv_1 this.Control[]={this.tv_1} end on on uo_treeview.destroy destroy(this.tv_1) end on type tv_1 from treeview within uo_treeview integer x = 14 integer y = 4 integer width = 992 integer height = 732 integer taborder = 10 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 borderstyle borderstyle = stylelowered! boolean linesatroot = true string picturename[] = {"Custom039!","Custom050!"} long picturemaskcolor = 553648127 long statepicturemaskcolor = 536870912 end type event itempopulate;int i treeviewitem ltvi_new,ltvi_place if this.getitem(handle,ltvi_place)<1 then return choose case ltvi_place.level case 1 for i=1 to 5 ltvi_new.data="2"+string(i) ltvi_new.label="Second"+string(i) ltvi_new.pictureindex=1 ltvi_new.selectedpictureindex=2 ltvi_new.children=true this.insertitemlast(handle,ltvi_new) next case 2 for i=1 to 3 ltvi_new.data="3"+string(i) ltvi_new.label="Third"+string(i) ltvi_new.pictureindex=1 ltvi_new.selectedpictureindex=2 ltvi_new.children=false this.insertitemlast(handle,ltvi_new) next end choose end event event selectionchanged;treeviewitem ltvi_place if this.getitem(newhandle,ltvi_place)<1 then return is_id=ltvi_place.data is_label=ltvi_place.label idw_request.setitem(il_row,is_dwo,is_id) end event |
w_main from window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
forward global type w_main from window end type type uo_1 from uo_treeview within w_main end type type dw_1 from datawindow within w_main end type end forward global type w_main from window integer x = 823 integer y = 360 integer width = 1833 integer height = 1088 boolean titlebar = true string title = "dropdown TreeView" boolean controlmenu = true long backcolor = 80269524 uo_1 uo_1 dw_1 dw_1 end type global w_main w_main type variables long il_row end variables on w_main.create this.uo_1=create uo_1 this.dw_1=create dw_1 this.Control[]={this.uo_1,& this.dw_1} end on on w_main.destroy destroy(this.uo_1) destroy(this.dw_1) end on event open;uo_1.hide( ) Long ll_row ll_row = dw_1.InsertRow(0) dw_1.ScrollToRow(ll_row) dw_1.SetFocus() end event type uo_1 from uo_treeview within w_main integer x = 905 integer y = 196 integer taborder = 20 boolean border = false long backcolor = 80269524 end type on uo_1.destroy call uo_treeview::destroy end on type dw_1 from datawindow within w_main event ue_dropdown pbm_dwndropdown integer x = 14 integer y = 8 integer width = 1787 integer height = 880 integer taborder = 10 string dataobject = "d_test" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event ue_dropdown;String ls_column Long ll_pointx, ll_pointy ls_column = This.GetColumnName() Choose Case ls_column Case "one" , "two" ll_pointx = Long(This.Describe(ls_column + ".X")) + This.X ll_pointy = Long(This.Describe(ls_column + ".Y")) + Long(This.Describe(ls_column+ ".Height")) + 5 + This.Y uo_1.Move( ll_pointx ,ll_pointy) End Choose uo_1.idw_request = This uo_1.il_row = il_row uo_1.is_dwo = ls_column uo_1.TriggerEvent("ue_postopen") uo_1.Show() uo_1.SetFocus() Return 1 end event event rowfocuschanged;il_row=currentrow end event event clicked;uo_1.hide() end event |
datawindow d_test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
release 10.5; datawindow(units=0 timer_interval=0 color=80269524 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.preview.outline=yes hidegrayline=no ) header(height=0 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=356 color="536870912" ) table(column=(type=char(10) updatewhereclause=no name=one dbname="one" ) column=(type=char(10) updatewhereclause=no name=two dbname="two" ) column=(type=char(10) updatewhereclause=no name=three dbname="three" ) ) text(band=detail alignment="1" text="Two:" border="0" color="0" x="795" y="32" height="76" width="197" html.valueishtml="0" name=two_t visible="1" font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="0" tabsequence=20 border="5" color="0" x="1029" y="32" height="88" width="443" format="[general]" html.valueishtml="0" name=two visible="1" ddlb.limit=0 ddlb.allowedit=yes ddlb.case=any ddlb.useasborder=yes font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) column(band=detail id=1 alignment="0" tabsequence=10 border="5" color="0" x="270" y="36" height="88" width="453" format="[general]" html.valueishtml="0" name=one visible="1" ddlb.limit=0 ddlb.allowedit=yes ddlb.case=any ddlb.useasborder=yes font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) column(band=detail id=3 alignment="0" tabsequence=30 border="5" color="0" x="270" y="224" height="76" width="453" format="[general]" html.valueishtml="0" name=three visible="1" ddlb.limit=0 ddlb.allowedit=no ddlb.case=any font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) text(band=detail alignment="1" text="One:" border="0" color="0" x="37" y="36" height="76" width="197" html.valueishtml="0" name=one_t visible="1" font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="1" text="three:" border="0" color="0" x="37" y="220" height="76" width="197" html.valueishtml="0" name=t_1 visible="1" font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml() |
Find Projects On Github click here
Good Luck!
Subscribe
Login
0 Comments
Oldest