Datawindow Dynamic Change Column Position
Source Example
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | forward global type w_main from window end type type cbx_print from checkbox within w_main end type type st_1 from statictext within w_main end type type cb_exit from commandbutton within w_main end type type cb_print from commandbutton within w_main end type type cb_down from commandbutton within w_main end type type cb_right from commandbutton within w_main end type type cb_left from commandbutton within w_main end type type cb_up from commandbutton within w_main end type type lb_1 from listbox 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 = 503 integer y = 212 integer width = 2912 integer height = 1588 boolean titlebar = true string title = "Dynamic Change Column Position" boolean controlmenu = true boolean minbox = true long backcolor = 79741120 cbx_print cbx_print st_1 st_1 cb_exit cb_exit cb_print cb_print cb_down cb_down cb_right cb_right cb_left cb_left cb_up cb_up lb_1 lb_1 dw_1 dw_1 end type global w_main w_main type variables integer yunit = 50 integer xunit = 50 end variables forward prototypes public subroutine wf_v_move (string acolumn, integer amoved) public subroutine wf_h_move (string acolumn, integer amoved) end prototypes public subroutine wf_v_move (string acolumn, integer amoved);Long oldy,newy dw_1.SetRedraw(False) oldy = Long(dw_1.Describe(acolumn + '.y')) newy = oldy + amoved dw_1.Modify(acolumn + ".y = '" + String(newy) + "'") dw_1.SetRedraw(True) end subroutine public subroutine wf_h_move (string acolumn, integer amoved);Long oldx,newx dw_1.SetRedraw(False) oldx = Long(dw_1.Describe(acolumn + '.x')) newx = oldx + amoved dw_1.Modify(acolumn + ".x = '" + String(newx) + "'") dw_1.SetRedraw(True) end subroutine on w_main.create this.cbx_print=create cbx_print this.st_1=create st_1 this.cb_exit=create cb_exit this.cb_print=create cb_print this.cb_down=create cb_down this.cb_right=create cb_right this.cb_left=create cb_left this.cb_up=create cb_up this.lb_1=create lb_1 this.dw_1=create dw_1 this.Control[]={this.cbx_print,& this.st_1,& this.cb_exit,& this.cb_print,& this.cb_down,& this.cb_right,& this.cb_left,& this.cb_up,& this.lb_1,& this.dw_1} end on on w_main.destroy destroy(this.cbx_print) destroy(this.st_1) destroy(this.cb_exit) destroy(this.cb_print) destroy(this.cb_down) destroy(this.cb_right) destroy(this.cb_left) destroy(this.cb_up) destroy(this.lb_1) destroy(this.dw_1) end on event open;String ls_objects,ls_obj Long ll_pos,ll_len lb_1.Reset() ls_objects = Trim(dw_1.Describe('datawindow.Objects')) Do While (Pos(ls_objects,"~t") > 0) ll_pos = Pos(ls_objects,"~t") ll_len = ll_pos - 1 ls_obj = Left(ls_objects,ll_len) ls_objects = Right(ls_objects,Len(ls_objects) - ll_pos) If Right(ls_obj,2) <> '_t' Then lb_1.AddItem(ls_obj + ' - ' + dw_1.Describe(ls_obj + '.tag')) End If Loop If Right(ls_objects,2) <> '_t' Then lb_1.AddItem(ls_objects + ' - ' + dw_1.Describe(ls_objects + '.tag')) End If dw_1.Object.datawindow.Print.Preview = True // Read information from the registry or ini file here and set the initial style end event type cbx_print from checkbox within w_main integer x = 2391 integer y = 1128 integer width = 302 integer height = 76 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Visible" boolean lefttext = true end type event clicked;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Then MessageBox("Note", "You did not select an object to set!") Return Else If IsNull(ls_Item) Then MessageBox("Note", "There is no settable object in the data window!") Return End If End If ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) If Checked Then dw_1.Modify(ls_Item + ".visible = '1'") Else dw_1.Modify(ls_Item + ".visible = '0'") End If end event type st_1 from statictext within w_main integer x = 2235 integer y = 60 integer width = 617 integer height = 56 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "Column DataWindow" boolean focusrectangle = false end type type cb_exit from commandbutton within w_main integer x = 2382 integer y = 1356 integer width = 334 integer height = 108 integer taborder = 70 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Exit" boolean cancel = true end type event clicked;// Read the data window information here and write it into the registry or ini file close(parent) end event type cb_print from commandbutton within w_main integer x = 2382 integer y = 1232 integer width = 334 integer height = 108 integer taborder = 60 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Print Page" end type event clicked;dw_1.print() end event type cb_down from commandbutton within w_main integer x = 2446 integer y = 996 integer width = 201 integer height = 108 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Down" end type event clicked;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Then MessageBox("Note", "You did not select an object to set!") Return Else If IsNull(ls_Item) Then MessageBox("Note", "There is no settable object in the data window!") Return End If End If ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) wf_v_move(ls_Item,yunit) end event type cb_right from commandbutton within w_main integer x = 2583 integer y = 876 integer width = 201 integer height = 108 integer taborder = 70 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Right" end type event clicked;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Then MessageBox("Note", "You did not select an object to set!") Return Else If IsNull(ls_Item) Then MessageBox("Note", "There is no settable object in the data window!") Return End If End If ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) wf_h_move(ls_Item,xunit) end event type cb_left from commandbutton within w_main integer x = 2309 integer y = 876 integer width = 201 integer height = 108 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Left" end type event clicked;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Then MessageBox("Note", "You did not select an object to set!") Return Else If IsNull(ls_Item) Then MessageBox("Note", "There is no settable object in the data window!") Return End If End If ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) wf_h_move(ls_Item,0 - xunit) end event type cb_up from commandbutton within w_main integer x = 2446 integer y = 756 integer width = 201 integer height = 108 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Up" end type event clicked;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Then MessageBox("Note", "You did not select an object to set!") Return Else If IsNull(ls_Item) Then MessageBox("Note", "There is no settable object in the data window!") Return End If End If ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) wf_v_move(ls_Item,0 - yunit) end event type lb_1 from listbox within w_main integer x = 2226 integer y = 140 integer width = 635 integer height = 604 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 boolean vscrollbar = true borderstyle borderstyle = stylelowered! end type event selectionchanged;String ls_Item ls_Item = lb_1.SelectedItem() If ls_Item = "" Or IsNull(ls_Item) Then Return End If String ls_print ls_Item = Left(ls_Item,Pos(ls_Item," ") - 1) ls_print = dw_1.Describe(ls_Item + ".visible") If ls_print = '1' Then cbx_print.Checked = True Else cbx_print.Checked = False End If end event type dw_1 from datawindow within w_main integer x = 32 integer y = 28 integer width = 2167 integer height = 1428 integer taborder = 10 string dataobject = "d_person" boolean livescroll = true borderstyle borderstyle = stylelowered! end type |
Datawindow d_person
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 | release 10.5; datawindow(units=3 timer_interval=0 color=16777215 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 635 print.margin.right = 635 print.margin.top = 635 print.margin.bottom = 635 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=4312 color="536870912" ) table(column=(type=char(18) updatewhereclause=yes name=id dbname="id" ) column=(type=char(10) updatewhereclause=yes name=name dbname="name" ) column=(type=date updatewhereclause=yes name=birthday dbname="birthday" ) column=(type=char(50) updatewhereclause=yes name=address dbname="address" ) ) data("3427010780101031", "Passwords", 1991-01-01, "Viet Nam", ) text(band=detail alignment="1" text="Id:" border="0" color="0" x="343" y="821" height="370" width="2301" html.valueishtml="0" name=id_t visible="1" font.face="Tahoma" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=1 alignment="0" tabsequence=10 border="1" color="0" x="2698" y="794" height="476" width="5027" format="[general]" html.valueishtml="0" name=id tag="ID number" visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Tahoma" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="1" text="Name:" border="0" color="0" x="1349" y="1747" height="370" width="1296" html.valueishtml="0" name=name_t visible="1" font.face="Tahoma" font.height="-9" 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="1" color="0" x="2698" y="1720" height="476" width="3333" format="[general]" html.valueishtml="0" name=name tag="Name" visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Tahoma" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="1" text="Birthday:" border="0" color="0" x="1322" y="2673" height="370" width="1322" html.valueishtml="0" name=birthday_t visible="1" font.face="Tahoma" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="2" tabsequence=30 border="1" color="0" x="2698" y="2646" height="476" width="3333" format="[general]" html.valueishtml="0" name=birthday tag="Birthday" visible="1" editmask.mask="yyyy/mm/dd" editmask.focusrectangle=no font.face="Tahoma" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="1" text="Address:" border="0" color="0" x="1270" y="3599" height="370" width="1375" html.valueishtml="0" name=address_t visible="1" font.face="Tahoma" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=40 border="1" color="0" x="2698" y="3572" height="476" width="7620" format="[general]" html.valueishtml="0" name=address tag="Address" visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Tahoma" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="2" text="The data window uses 1/1000cm units." border="0" color="0" x="1111" y="106" height="423" width="6720" html.valueishtml="0" name=caption tag="title" visible="1" font.face="Tahoma" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) 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!