Search code examples
powerbuilderright-clickdatawindow

Problems at inserting a new row powerbuider


I have a datawindow. And there I have an entry. I want to add a new entry, with rbuttondown, but it doesn't work. How can i do that? I wrote this, but it's wrong...

IF row > 0 THEN
    //This.SetRow(row)
    This.SelectRow(0, FALSE)
    This.SelectRow(row, TRUE)
    //this.ScrollToRow(row)
    parent.TriggerEvent("ue_agregar")
END IF

Thanks!


Solution

  • You need to define the menu with your 'New' option which should then trigger the insertrow method and whatever other code you wish to execute.

    You display the menu via the PopMenu method like this (From the PowerBuilder help):

    If the menu is associated with the window If the menu is currently associated with the window, you can simply call the PopMenu function.

    The following statement in a CommandButton script displays m_help as a pop-up menu at the current pointer position, assuming menu m_help is already associated with the window:

    m_help.PopMenu(PointerX(), PointerY())
    

    If the menu is not associated with the window If the menu is not already associated with the window, you must create an instance of the menu before you can display it as a pop-up menu.

    The following statements create an instance of the menu m_new, then pop up the menu m_new at the pointer location, assuming m_new is not associated with the window containing the script:

    m_new   mymenu
    mymenu = create m_new
    mymenu.PopMenu(PointerX(), PointerY())