Great, thank you very much - i will try your ideas and give feedback.
The solution is quite trivial:
Several B4XPages call the same customlayoutdialog, which has many buttons to format a text in the SMMRicheditor inside the dialog.
Instead to define each button action on each page, I call a function in an external code module:
Dim re as SMMRicheditor
.....
Sub btnFormat_click
Dim btn = Sender As Button
Log("btn tag= "&btn.Tag)
functions.formatButton(re, btn.tag)
End Sub
In the functions module:
public Sub formatButton(re As SMMRichEditor, form As String)
Select form
Case "heading"
re.heading = 2
Case "bold"
re.setbold
......
What i was not aware of is that the "transferred" view "re" from the page can be altered by the commands in the functions module.
Maybe a very trivial post, but maybe helpful for some beginners like me.