NULLify field with not-editable DDDW

Share this topic:



Link to this posting

Postby Ursego » 16 Jun 2017, 13:39

How to allow user to delete current selection in not-editable DDDW using Delete key:

1. Create a user event in the datawindow control mapped to pbm_dwnkey.
2. Put the following code in the event:

Code: Select all
/**********************************************************************************************************************
Dscr:   Allows user to delete current selection in not-editable DDDW using Delete key
***********************************************************************************************************************
Log:   16jun2017 Michael Zuskin   <project name> (Initial version)
**********************************************************************************************************************/
string   ls_col_name
string   ls_null
long      ll_null
long      ll_row

if key <> KeyDelete! then return

ll_row = this.GetRow()
if ll_row < 1 then return

ls_col_name = this.GetColumnName()
if IsNull(ls_col_name) or ls_col_name = '' then return

if this.Describe(ls_col_name + ".Edit.Style") <> 'dddw' or this.describe(ls_col_name + ".DDDW.NilIsNull") <> 'yes' then return

if left(this.Describe(ls_col_name + ".coltype"), 4) = 'char' then
   SetNull(ls_null)
   this.SetItem(ll_row,ls_col_name, ls_null)
else
   SetNull(ll_null)
   this.SetItem(ll_row,ls_col_name, ll_null)
end if

return 0
User avatar
Ursego
Site Admin
 
Posts: 112
Joined: 19 Feb 2013, 20:33

Return to Tips and Tricks

Who is online

Users browsing this forum: Bing [Bot] and 1 guest


NULLify field with not-editable DDDW

Share this topic:


If you think that this site is not too bad, please LIKE it in Facebook. Thanks!





cron
free counters

eXTReMe Tracker