DataWindow Add Image Button End Column
Srouce Code
ou_dwcolumn_bmp from nonvisualobject
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 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 |
forward global type ou_dwcolumn_bmp from nonvisualobject end type end forward global type ou_dwcolumn_bmp from nonvisualobject event type integer pfc_lbuttonup ( ) event type integer pfc_dropdown ( ) event type integer pfc_changevisible ( string as_column ) end type global ou_dwcolumn_bmp ou_dwcolumn_bmp type variables String is_dwcolumns[] String is_imagepath[] String is_event[] //Used to save the event corresponding to the registration column String is_dwcolumnsexp[] //Save the original edit grid of each registered column Integer ii_bord[] //The border type of the picture (button) Integer ii_width[] //The width of the picture (button) ranges from 60 to 100. If it exceeds 100, take 100. If it is less than 60, take 60. datawindow idw_requestor end variables forward prototypes public function boolean of_isregistered (string as_dwcolumn) public function integer of_create_object (long al_current_note) public function integer of_resize () public function integer of_dropdown () public function integer of_changevisible (string as_column) public function integer of_register (string as_dwcolumn, string as_image_path) public function integer of_register (string as_dwcolumn, string as_image_path, string as_event) public function integer of_register (string as_dwcolumn, string as_image_path, string as_event, integer ai_bord) public function integer of_register (string as_dwcolumn, string as_image_path, string as_event, integer ai_bord, integer ai_width) public function integer of_setrequestor (datawindow adw_requestor) public function integer of_unregister (string as_dwcolumn) public function integer of_unregister () end prototypes event type integer pfc_lbuttonup();//When the left mouse button is released, reset the picture position return of_resize() end event event type integer pfc_dropdown(); return of_dropdown() end event event type integer pfc_changevisible(string as_column); return of_changevisible(as_column) end event public function boolean of_isregistered (string as_dwcolumn);//==================================================================== // Function: ou_dwcolumn_bmp.of_isregistered() //-------------------------------------------------------------------- // Description: This function is called to determine if the passed in column name has already been registered with the service. // Function is only valid when serving a DataWindow control. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn The registered column to search for. //-------------------------------------------------------------------- // Returns: boolean True or False depending if the column is already registered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_isregistered ( string as_dwcolumn ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== integer li_count integer li_i // Check arguments If IsNull(as_dwcolumn) Or Len(Trim(as_dwcolumn))=0 Then Return False End If // Validate the references. If IsNull(idw_requestor) or Not IsValid(idw_requestor) Then Return False End If // Trim and Convert to lower case. as_dwcolumn = Trim(Lower(as_dwcolumn)) // Find column name. li_count = upperbound(is_dwcolumns) For li_i=1 To li_count If is_dwcolumns[li_i] = as_dwcolumn THEN // Column name was found. Return True end if Next // Column name not found in array. Return False end function public function integer of_create_object (long al_current_note);//==================================================================== // Function: ou_dwcolumn_bmp.of_create_object() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value long al_current_note is registered at the current position in the array //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_create_object ( long al_current_note ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long ll_x, ll_y, ll_width, ll_height String ls_create_info String ls_rc String ls_dwcolumn If IsNull(al_current_note) Or al_current_note = 0 Then Return -1 If IsNull(is_dwcolumns) Or UpperBound(is_dwcolumns) < 1 Or al_current_note > UpperBound(is_dwcolumns) Then Return -1 ls_dwcolumn = is_dwcolumns[al_current_note] ll_x = Long( idw_requestor.Describe(ls_dwcolumn+".x") ) ll_y = Long( idw_requestor.Describe(ls_dwcolumn+".y") ) ll_width = Long( idw_requestor.Describe(ls_dwcolumn+".width") ) ll_height = Long( idw_requestor.Describe(ls_dwcolumn+".height") ) ll_x = ll_x + ll_width - ii_width[al_current_note] If ll_height >= 60 And ll_height <= 100 Then //When the column height is within the visible range, keep the width and height equal ii_width[al_current_note] = ll_height End If //create image ls_create_info = "create bitmap(band=detail filename='" + is_imagepath[al_current_note] + "'" + & "x='" + String(ll_x) + "'" + & " y='" + String (ll_y) + "' height='" + String (ll_height - 8 ) + "' width='" + String ( ii_width[al_current_note] -4 ) + "' border='" + String ( ii_bord[al_current_note] ) + "' name=p_" + ls_dwcolumn + " visible='1')" //create button //ls_create_info = "create button(band=detail text='' filename='" + is_bmp[al_current_note] + "'" + & // " enabled=yes action='0' border='1' color='33554432' x='" + String(ll_x) + "'" + " y='" + String (ll_y) + "' height= '" + String (ll_height) + "' width='" + String (il_widht + 4 ) + "'" + & // " vtextalign='0' htextalign='0' name=p_" + ls_dwcolumn + " visible='1' font.face='Arial' font.height='-8' font.weight='400' font. family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='67108864' )" ls_rc = idw_requestor.Modify(ls_create_info) If Len(ls_rc) > 0 Then Return -1 Return 1 end function public function integer of_resize ();//==================================================================== // Function: ou_dwcolumn_bmp.of_resize() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_resize ( ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_upperbound, li_cnt Long ll_x, ll_y, ll_width, ll_heigth String ls_rc String ls_dwcolumn // Get the upperbound of all registered columns. li_upperbound = UpperBound(is_dwcolumns) For li_cnt = 1 To li_upperbound ls_dwcolumn = is_dwcolumns[li_cnt] If IsNull(ls_dwcolumn) Or Len(Trim(ls_dwcolumn)) = 0 Then Continue ll_x = Long ( idw_requestor.Describe (ls_dwcolumn+".x") ) ll_y = Long ( idw_requestor.Describe (ls_dwcolumn+".y") ) ll_width = Long ( idw_requestor.Describe (ls_dwcolumn+".width") ) ll_heigth = Long ( idw_requestor.Describe (ls_dwcolumn+".height") ) ll_x = ll_x + ll_width - ii_width[li_cnt] ll_heigth = ll_heigth ls_rc = idw_requestor.Modify ('p_' + ls_dwcolumn + '.x = ' + String (ll_x) ) ls_rc = idw_requestor.Modify ('p_' + ls_dwcolumn + '.width = ' + String ( ii_width[li_cnt] -4 ) ) ls_rc = idw_requestor.Modify ('p_' + ls_dwcolumn + '.height = ' + String (ll_heigth -4 ) ) If Len(ls_rc) > 0 Then Continue Next Return 1 end function public function integer of_dropdown ();//==================================================================== // Function: ou_dwcolumn_bmp.of_dropdown() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_dropdown ( ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String ls_colname, ls_event Integer li_position, ll_i // Check the required references. If IsNull(idw_requestor) Or Not IsValid(idw_requestor) Then Return -1 End If // Get the current column name. ls_colname = idw_requestor.GetColumnName() // Check if column is in the search column array. If Not of_IsRegistered(ls_colname) Then Return 0 End If For ll_i = 1 To UpperBound(is_dwcolumns) If is_dwcolumns[ll_i] = ls_colname Then li_position = ll_i ls_event = is_event[ll_i] Exit End If Next If li_position > 0 Then If idw_requestor.TriggerEvent (ls_event, 2, ls_colname) = 1 Then Return 1 Else Return 0 End If Else Return 0 End If Return 1 end function public function integer of_changevisible (string as_column);//==================================================================== // Function: ou_dwcolumn_bmp.of_changevisible() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_column //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_changevisible ( string as_column ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_upperbound, li_cnt Long ll_x, ll_y, ll_width, ll_heigth String ls_rc String ls_dwcolumn // Get the upperbound of all registered columns. li_upperbound = UpperBound(is_dwcolumns) For li_cnt = 1 To li_upperbound ls_dwcolumn = is_dwcolumns[li_cnt] If as_column = ls_dwcolumn Then idw_requestor.Modify ('p_' + ls_dwcolumn + ".visible = '1~tif ( currentrow() =Getrow (), 1, 0)'") Else idw_requestor.Modify ('p_' + ls_dwcolumn + ".visible = 0") End If Next Return 1 end function public function integer of_register (string as_dwcolumn, string as_image_path);//==================================================================== // Function: ou_dwcolumn_bmp.of_register() //-------------------------------------------------------------------- // Description: The style of the registered column must be: 'ddlb' or 'edit' or 'editmask'. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn Column to register. // value string as_image_path The path of the image file //-------------------------------------------------------------------- // Returns: integer 1 if the column was added. 0 if the column was not added. -1 if an error is encountered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_register ( string as_dwcolumn, string as_image_path ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String ls_event ls_event = 'ue_find' //The data window ue_find event is triggered by default Return of_register(as_dwcolumn, as_image_path, ls_event) end function public function integer of_register (string as_dwcolumn, string as_image_path, string as_event);//==================================================================== // Function: ou_dwcolumn_bmp.of_register() //-------------------------------------------------------------------- // Description: The style of the registered column must be: 'ddlb' or 'edit' or 'editmask'. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn Column to register. // value string as_image_path The path of the image file // value string as_event The event when the clicked event . //-------------------------------------------------------------------- // Returns: integer 1 if the column was added. 0 if the column was not added. -1 if an error is encountered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_register ( string as_dwcolumn, string as_image_path, string as_event ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_bord li_bord = 6 //The border is 6 Return of_register(as_dwcolumn, as_image_path, as_event, li_bord) end function public function integer of_register (string as_dwcolumn, string as_image_path, string as_event, integer ai_bord);//==================================================================== // Function: ou_dwcolumn_bmp.of_register() //-------------------------------------------------------------------- // Description: The style of the registered column must be: 'ddlb' or 'edit' or 'editmask'. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn Column to register. // value string as_image_path The path of the image file // value string as_event The event when the clicked event . // value integer ai_bord the bord type of the picture(button) //-------------------------------------------------------------------- // Returns: integer 1 if the column was added. 0 if the column was not added. -1 if an error is encountered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_register ( string as_dwcolumn, string as_image_path, string as_event, integer ai_bord ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_width li_width = 75 Return of_register(as_dwcolumn, as_image_path, as_event, ai_bord, li_width) end function public function integer of_register (string as_dwcolumn, string as_image_path, string as_event, integer ai_bord, integer ai_width);//==================================================================== // Function: ou_dwcolumn_bmp.of_register() //-------------------------------------------------------------------- // Description: The style of the registered column must be: 'ddlb' or 'edit' or 'editmask'. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn Column to register. // value string as_image_path The path of the image file // value string as_event The event when the clicked event . // value integer ai_bord the bord type of the picture(button) // value integer ai_width the width of the picture(button), the height is the same to the row //-------------------------------------------------------------------- // Returns: integer 1 if the column was added. 0 if the column was not added. -1 if an error is encountered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_register ( string as_dwcolumn, string as_image_path, string as_event, integer ai_bord, integer ai_width ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_cnt, li_rc Integer li_availableentry Integer li_upperbound String ls_editstyle String ls_modexp String ls_descexp String ls_descret String ls_storemodify String ls_rc // Check the required reference. If IsNull(idw_requestor) Or Not IsValid(idw_requestor) Then Return -1 End If // Check arguments If (IsNull(as_dwcolumn) Or Len(Trim(as_dwcolumn)) = 0) Or & IsNull(idw_requestor) Or Not IsValid(idw_requestor) Then Return -1 End If // Trim and Convert to lower case. as_dwcolumn = Trim(Lower(as_dwcolumn)) // Check if the column is already registered. If of_IsRegistered(as_dwcolumn) Then Return 0 End If // Get the upperbound of all registered columns. li_upperbound = UpperBound(is_dwcolumns) // Find if there is an empty string in the array, if so, register the newly registered column to the string For li_cnt = 1 To li_upperbound If IsNull(is_dwcolumns[li_cnt]) Or Len(Trim(is_dwcolumns[li_cnt])) = 0 Then If li_availableentry = 0 Then //Get the first slot found li_availableentry = li_cnt Exit End If End If Next //If an available slot was not found then create a new entry If li_availableentry = 0 Then li_availableentry = li_upperbound + 1 End If // Add/Initilize the new entry. is_dwcolumns[li_availableentry] = as_dwcolumn is_imagepath[li_availableentry] = as_image_path is_event[li_availableentry] = as_event ii_bord[li_availableentry] = ai_bord ii_width[li_availableentry] = ai_width // Store the Modify expression needed to unregister the column. ls_editstyle = idw_requestor.Describe(as_dwcolumn+".Edit.Style") Choose Case Lower(ls_editstyle) Case 'edit' ls_descret = idw_requestor.Describe(as_dwcolumn+".Edit.Required") If ls_descret = 'yes' Or ls_descret = 'no' Then ls_storemodify += as_dwcolumn+".Edit.Required=" + ls_descret + " " ls_modexp = as_dwcolumn+".DDLB.Required=" + ls_descret + " " End If ls_descret = idw_requestor.Describe(as_dwcolumn+".Edit.NilIsNull") If ls_descret = 'yes' Or ls_descret = 'no' Then ls_storemodify += as_dwcolumn+".Edit.NilIsNull=" + ls_descret + " " ls_modexp += as_dwcolumn+".DDLB.NilIsNull=" + ls_descret + " " End If Case 'editmask' ls_descret = idw_requestor.Describe(as_dwcolumn+".EditMask.Mask") If ls_descret = '!' Or ls_descret = '?' Then ls_storemodify += as_dwcolumn+".EditMask.Mask='' " Else ls_storemodify += as_dwcolumn+".EditMask.Mask='" + ls_descret + "' " End If ls_descret = idw_requestor.Describe(as_dwcolumn+".EditMask.Required") If ls_descret = 'yes' Or ls_descret = 'no' Then ls_storemodify += as_dwcolumn+".EditMask.Required=" + ls_descret + " " ls_modexp = as_dwcolumn+".DDLB.Required=" + ls_descret + " " End If ls_descret = idw_requestor.Describe(as_dwcolumn+".EditMask.NilIsNull") If ls_descret = 'yes' Or ls_descret = 'no' Then ls_storemodify += as_dwcolumn+".EditMask.NilIsNull=" + ls_descret + " " ls_modexp += as_dwcolumn+".DDLB.NilIsNull=" + ls_descret + " " End If Case 'ddlb' ls_descret = idw_requestor.Describe(as_dwcolumn+".DDLB.useasborder") If ls_descret = 'yes' Or ls_descret = 'no' Then ls_storemodify = as_dwcolumn+".DDLB.useasborder=" + ls_descret + " " End If Case 'dddw' //Cannot support the following data window Return -1 Case Else // Not a valid original edit style. Return -1 End Choose // Store the Modify statement that allows unregister. is_dwcolumnsexp[li_availableentry] = ls_storemodify // Convert the current format to ddlb and limit the length to 0 to allow editing without drop-down arrov ls_modexp += as_dwcolumn+".DDLB.limit=0 " + & as_dwcolumn+".DDLB.AllowEdit=Yes " + as_dwcolumn+".DDLB.ShowList=no" ls_rc = idw_requestor.Modify(ls_modexp) If Len(ls_rc) > 0 Then Return -1 //create image (button) If of_create_object( li_availableentry ) <> 1 Then Return -1 // The column was registered. Return 1 end function public function integer of_setrequestor (datawindow adw_requestor);//==================================================================== // Function: ou_dwcolumn_bmp.of_setrequestor() //-------------------------------------------------------------------- // Description: Associates a datawindow control with a datawindow service NVO by setting the idw_Requestor instance variable. //-------------------------------------------------------------------- // Arguments: // value datawindow adw_requestor The datawindow requesting the service //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_setrequestor ( datawindow adw_requestor ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== If IsNull(adw_requestor) Or Not IsValid(adw_requestor) Then Return -1 End If idw_Requestor = adw_requestor Return 1 end function public function integer of_unregister (string as_dwcolumn);//==================================================================== // Function: ou_dwcolumn_bmp.of_unregister() //-------------------------------------------------------------------- // Description: UnRegisters the object from the service by the column name. Function is only valid when serving a DataWindow control. //-------------------------------------------------------------------- // Arguments: // value string as_dwcolumn The registered column to search for. //-------------------------------------------------------------------- // Returns: integer 1 successful. 0 not previously registered. -1 error. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_unregister ( string as_dwcolumn ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_upper Integer li_cnt String ls_rc Constant String EMPTY = '' // Check for a valid ID. If IsNull(as_dwcolumn) Or Len(Trim(as_dwcolumn)) = 0 Then Return -1 End If // Trim and Convert to lower case. as_dwcolumn = Trim(Lower(as_dwcolumn)) // Find the Column. li_upper = UpperBound(is_dwcolumns) For li_cnt = 1 To li_upper If as_dwcolumn = is_dwcolumns[li_cnt] Then // The entry has been found. // Clear out any attribute changes. If Len(is_dwcolumnsexp[li_cnt]) > 0 Then ls_rc = idw_requestor.Modify (is_dwcolumnsexp[li_cnt]) If Len(ls_rc) > 0 Then Return -1 End If End If // Perform the actual Unregister. is_dwcolumns[li_cnt] = '' is_imagepath[li_cnt] = '' is_dwcolumnsexp[li_cnt] = '' is_event[li_cnt] = '' //ii_dwcolumnstyle[li_cnt]= 0 Return 1 End If Next // The column was not found. Return 0 end function public function integer of_unregister ();//==================================================================== // Function: ou_dwcolumn_bmp.of_unregister() //-------------------------------------------------------------------- // Description: UnRegisters all registerd columns from the service. Function is only valid when serving a DataWindow control. //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: integer 1 successful. 0 nothing previously registered. //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: ou_dwcolumn_bmp.of_unregister ( ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Integer li_upper Integer li_cnt Integer li_unregistered = 0 // Loop around all registered columns. li_upper = UpperBound(is_dwcolumns) For li_cnt = 1 To li_upper If Len(is_dwcolumns[li_cnt]) > 0 Then If of_Unregister(is_dwcolumns[li_cnt]) = 1 Then li_unregistered ++ End If End If Next If li_unregistered > 0 Then Return 1 End If Return 0 end function on ou_dwcolumn_bmp.create call super::create TriggerEvent( this, "constructor" ) end on on ou_dwcolumn_bmp.destroy TriggerEvent( this, "destructor" ) call super::destroy end on event destructor;of_Unregister() end event |
u_dw from datawindow
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 |
forward global type u_dw from datawindow end type end forward global type u_dw from datawindow integer width = 686 integer height = 400 string title = "none" boolean livescroll = true borderstyle borderstyle = stylelowered! event ue_find ( ) event dropdown pbm_dwndropdown event ue_resize ( ) event lbuttonup pbm_lbuttonup event type integer ue_changevisible ( string as_column ) end type global u_dw u_dw type variables ou_dwcolumn_bmp inv_colun_bmp end variables forward prototypes public function integer of_setcolumnbmp (boolean ab_true) end prototypes event ue_find();String PassedString PassedString = String(Message.LongParm, "address") Choose Case PassedString Case 'comp_code' MessageBox('Warning', PassedString) //open(w_popo) Case 'comp_zip' MessageBox('Warning', PassedString) //open(w_response) Case Else MessageBox('','') End Choose end event event dropdown;If IsValid(inv_colun_bmp) Then // Check if this a column that has the column bmp associated to it. If inv_colun_bmp.Event pfc_dropdown() = 1 Then // Column is a bmp column. Prevent listbox from appearing. Return 1 End If End If end event event ue_resize();If IsValid (inv_colun_bmp) Then inv_colun_bmp.Event pfc_lbuttonup ( ) End If end event event lbuttonup;PostEvent ('ue_resize') end event event type integer ue_changevisible(string as_column);If IsValid(inv_colun_bmp) Then If inv_colun_bmp.Event pfc_changevisible(as_column) = 1 Then End If End If Return 1 end event public function integer of_setcolumnbmp (boolean ab_true);//==================================================================== // Function: u_dw.of_setcolumnbmp() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value boolean ab_true //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/02/20 //-------------------------------------------------------------------- // Usage: u_dw.of_setcolumnbmp ( boolean ab_true ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== If ab_true Then If Not IsValid (inv_colun_bmp) Then inv_colun_bmp = Create ou_dwcolumn_bmp End If inv_colun_bmp.of_setrequestor( This ) Else If IsValid(inv_colun_bmp) Then Destroy inv_colun_bmp Return 1 End If Return 0 End If Return 1 end function on u_dw.create end on on u_dw.destroy end on event constructor;//inv_colun_bmp.of_register( 'comp_code', 'pic\FIND_DW.BMP') //inv_colun_bmp.of_register( 'comp_zip', 'pic\test.gif') end event event destructor;//of_setcolumnbmp (False) end event event itemfocuschanged;If IsValid(inv_colun_bmp) Then // Check if this a column that has the bmp column associated to it. If inv_colun_bmp.Event pfc_changevisible(dwo.Name) = 1 Then // Column is a bmp column. Prevent listbox from appearing. End If End If end event |
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 |
forward global type w_main from window end type type dw_1 from u_dw within w_main end type end forward global type w_main from window integer width = 2843 integer height = 1224 boolean titlebar = true string title = "Add Image Button End Column" boolean controlmenu = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true dw_1 dw_1 end type global w_main w_main type variables end variables on w_main.create this.dw_1=create dw_1 this.Control[]={this.dw_1} end on on w_main.destroy destroy(this.dw_1) end on event open;dw_1.of_setcolumnbmp (True) // Register the column to trigger the data window ue_find event when the icon is clicked to process the relevant content in ue_find //You can also specify the width of the picture, the type of side width and the triggered event, etc. //Note that the style of the registered column must be: 'ddlb' or 'edit' or 'editmask' dw_1.inv_colun_bmp.of_register( 'comp_code', '.\pic\FIND.BMP') //dw_1.inv_colun_bmp.of_register( 'comp_zip', '.\pic\FIND_DW.BMP') dw_1.inv_colun_bmp.of_register( 'comp_zip', '.\pic\FIND_DW.BMP', 'ue_click') dw_1.inv_colun_bmp.of_register( 'comp_name', '.\pic\NAME.gif', 'ue_click') //Because the data window has no data source and does not require data retrieval, the itemfocuschanged event will not be triggered after opening // Therefore, we need to manually trigger the ue_changevisible event here, and this code is not needed in the data window with the data source dw_1.Event ue_changevisible('comp_code') end event event close;dw_1.of_setcolumnbmp (False) end event type dw_1 from u_dw within w_main event ue_click ( ) integer x = 55 integer y = 32 integer width = 2738 integer height = 1064 integer taborder = 10 string dataobject = "d_comp" boolean hscrollbar = true boolean vscrollbar = true end type event ue_click();String PassedString PassedString = String(Message.LongParm, "address") Choose Case PassedString Case "comp_name" MessageBox('Warning',This.GetItemString(This.GetRow(),"comp_name")) Case "comp_zip" MessageBox('Warning',This.GetItemString(This.GetRow(),"comp_zip")) open(w_response) Case Else MessageBox('','') End Choose end event |
w_response 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 |
forward global type w_response from window end type end forward global type w_response from window integer width = 1335 integer height = 896 boolean titlebar = true string title = "Untitled" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true end type global w_response w_response on w_response.create end on on w_response.destroy end on |
datawndow d_comp
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 |
release 10.5; datawindow(units=0 timer_interval=0 color=67108864 processing=1 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 grid.lines=0 selected.mouse=no ) header(height=84 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=76 color="536870912" ) table(column=(type=char(10) updatewhereclause=yes name=comp_code dbname="comp_code" ) column=(type=char(60) updatewhereclause=yes name=comp_name dbname="comp_name" ) column=(type=char(10) updatewhereclause=yes name=comp_zip dbname="comp_zip" ) column=(type=char(80) updatewhereclause=yes name=comp_address dbname="comp_address" ) sort="comp_code A " ) data("84","Vietnam","VN","Viet Nam","81","Japan","JP","Japan","1","United States","US","United States",) text(band=header alignment="2" text="Code" border="6" color="33554432" x="110" y="4" height="68" width="416" html.valueishtml="0" name=comp_code_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" ) text(band=header alignment="2" text="Name" border="6" color="33554432" x="535" y="4" height="68" width="654" html.valueishtml="0" name=comp_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" ) text(band=header alignment="2" text="Area Code" border="6" color="33554432" x="1198" y="4" height="68" width="347" html.valueishtml="0" name=comp_zip_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" ) text(band=header alignment="2" text="Address" border="6" color="33554432" x="1554" y="4" height="68" width="1024" html.valueishtml="0" name=comp_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" ) compute(band=header alignment="2" expression="RowCount()"border="6" color="33554432" x="5" y="4" height="68" width="96" format="[General]" html.valueishtml="0" name=page_2 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="0" color="33554432" x="110" y="4" height="68" width="416" format="[general]" html.valueishtml="0" name=comp_code visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no 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="0" color="33554432" x="535" y="4" height="68" width="654" format="[general]" html.valueishtml="0" name=comp_name visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no edit.autohscroll=yes 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="0" tabsequence=30 border="0" color="33554432" x="1198" y="4" height="68" width="347" format="[general]" html.valueishtml="0" name=comp_zip visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no edit.autohscroll=yes 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="0" color="33554432" x="1554" y="4" height="68" width="1024" format="[general]" html.valueishtml="0" name=comp_address visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no edit.autohscroll=yes font.face="Tahoma" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) compute(band=detail alignment="2" expression="GetRow()"border="6" color="33554432" x="5" y="4" height="68" width="96" format="[General]" html.valueishtml="0" name=page_1 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" ) 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!
Ciao.
pressing the up or down arrow in the bitmap column to move from row to row, clears the contents of the column