DEV Community

Venkatesh Jonnagadla
Venkatesh Jonnagadla

Posted on

PowerBuilder - Custom window for DW properties

If you are utilizing PFC or any custom datawindow object in your project, this will be extremely beneficial.

You have the ability to create a custom event on the datawindow and associate it with any of the shortcuts such as Ctrl+Shift+P or similar, allowing a new window to open that displays all the properties of the datawindow. The code I am presenting here is fundamental, but you can modify it to suit your requirements. Please note that you must create window based on the variables I used in the below code.

Initially, pass the datawindow for which you wish to display properties from an event or function as illustrated below -
openwithparm(w_dwproperties,this)

design w_dwproperties according to the variables in below code -

in the w_dwproperties open() event -

powerobject lpo_arg
datawindow ldw_arg
string ls_colcount,ls_colname,ls_concatstr
int li_counter

lpo_arg=Message.powerobjectparm

if lpo_arg.typeof( )=datawindow! then
    ldw_arg=lpo_arg
    sle_1.text=ldw_arg.dataobject
    sle_2.text=ldw_arg.classname( )
    mle_1.text=ldw_arg.describe('datawindow.table.select')
    ls_colcount=ldw_arg.describe( "DataWindow.Column.Count")
    for li_counter=1 to integer(ls_colcount)
            ls_concatstr='#'+string(li_counter)+'.name'
            ls_colname=ldw_arg.describe(ls_concatstr)
            ddlb_1.additem(ls_colname)
    next
else

end if
Enter fullscreen mode Exit fullscreen mode

Hope this helps!!!!!Thank you!!!!!!!!!!!

Top comments (0)