Ask Your Question
0

Star basic: passing sub/function as parameter to other sub/function

asked 2020-05-03 13:45:07 +0100

torreone gravatar image

updated 2020-05-03 13:46:29 +0100

Is it possible to pass sub /function A as parameter to other sub /function B as object to be reused in the function B called? Eg:

' MAIN PROGRAM

 display(dum)          ' pass dum to display per reused dum in display

' FUNCTION USED

function display (i)
  msgbox (i)
end function

function dum (oFn)
  oFN (0)   
  oFN (1)
end function

It's probably possible using javascript or python (but that's not my goal)

I believe that in star basic it cannot be done (in javascript yes, for example): calling a function B passing a function/sub A leads to execution of A in calling.
But I still ask for confirmation

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-05-03 17:52:08 +0100

JohnSUN gravatar image

You will not receive confirmation. The fact is that in StarBasic it can be done.

Try this C:\fakepath\MacroAsParameter.ods and read this and this

edit flag offensive delete link more

Comments

Fantastic !! Very thanks !!!

I vaguely knew macro uri, but I never thought it could be applied to this problem.

For a LO macro programmer is an important help

Thank you so much again

torreone gravatar imagetorreone ( 2020-05-03 20:01:57 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-05-03 13:45:07 +0100

Seen: 84 times

Last updated: May 03 '20