Question Dynamic Browse Widget in Class File

Hi.

Perhaps I am overlooking the obvious.

Thinking about migrating our procedural based that dynamically creates a browse widget.

If I create a browse widget in a class file, is there an equivalent to the PERSISTENT RUN statement that is used in a trigger? Or, does the entire trigger code need to be defined in the ON of the TRIGGERS block? Or something else?

Code:
CREATE BROWSE hBrowse
  ASSIGN
    ALLOW-COLUMN-SEARCHING = TRUE
    FRAME = phHostFrame
    ROW-MARKERS = plMarkers
    SENSITIVE = TRUE
    SEPARATORS = plSeparators
    MULTIPLE = plMultiple
    VISIBLE = TRUE

  TRIGGERS:
    ON ROW-LEAVE PERSISTENT RUN row_leave IN THIS-PROCEDURE.
    ON START-SEARCH RUN sort_browse IN THIS-PROCEDURE.
    ON VALUE-CHANGED PERSISTENT RUN value_changed IN THIS-PROCEDURE.
    ON MOUSE-SELECT-DBLCLICK PERSISTENT RUN dbl_click IN THIS-PROCEDURE.
  END TRIGGERS.
 
If I create a browse widget in a class file, is there an equivalent to the PERSISTENT RUN statement that is used in a trigger? Or, does the entire trigger code need to be defined in the ON of the TRIGGERS block? Or something else?

Per the doc you can for the RUN in any procedure handle. I would create a .P that takes THIS-OBJECT as a input parameter and use that to call back into the class.

Code:
class DynBrowser:
    def var hCallbackProc as handle.

    constructor DynBrowser():
       run callback.p persistent set hCallbackProc (this-object).
    end.

    method void handle CreateBrowser():
  
       triggers:
           on row-leave persistent run row_leave in hCallbackProc.
       end triggers.
    method.

    method public void RowLeave():
        message "Ponies have left the row ...".
    end method.
end class.

Code:
// callbackproc.p

def input param poBrowser as DynBrowser.

procedure row_leave:
   poBrowser:RowLeave().
end.
 
Back
Top