DEV Community

Venkatesh Jonnagadla
Venkatesh Jonnagadla

Posted on

PowerBuilder - Popup Menu

You will observe this on the data windows. By right-clicking on a data window, you will see options to insert or delete rows, as well as to trigger certain custom events within the data window. This functionality can also be applied to the windows. Here is an example.

1/ Create menu m_popupmenu
2/ If you are going to use it on datawindow then declare instance variable like below
protected:
datawindow idw_datawindow

in the menuitem's clicked event - modify accordingly
idw_datawindow.event dynamic ue_insert()

3/ On datawindow rbuttondown(map it accordingly)

m_popup lm_popup
lm_popup=create m_popup
lm_popup.idw_datawindow=this
lm_popup.popmenu( this.pointerx( )+10,this.pointery( )+10)
Enter fullscreen mode Exit fullscreen mode

you must have the ue_insert() created at dw level

int li_i

li_i=this.insertrow(0)
this.scrolltorow( li_i)
if li_i<0 then
    MessageBox("Error - Insert","Error is ~n"+SQLCa.sqlerrtext)
end if
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)