Dialog box goes behind document

I am stuck.
Libreoffice 24.2.7.2 Ubuntu 24.04.2
I have xrayed the dialog box but cannot find a method of keeping the dialog box in front of the document after a button on the dialog box makes the document full screen. Perhaps it is not possible?
I hope someone can help.
How to get the dialog box to stay on top of the document after making the document full screen using a button in the dialog box

this is my macro
REM ***** BASIC *****

Dim TestD As Object
Dim Continue As Boolean

'*********************************************************************

Sub StartTestDialog

Dim Doc As Object
Dim Sheet As Object
Dim Controller As Object
Dim frame As Object

Dim TestListenerTop as object
'Dim SeasonBox As Object

Doc = ThisComponent
frame = doc.CurrentController.getFrame()

Continue = true

DialogLibraries.LoadLibrary(“Standard”)
’ load standard library

TestD = CreateUnoDialog(DialogLibraries.Standard.Test)

'xray Doc
'xray frame
'xray TestD
'xray Sheet

TestListenerTop=createUnoListener(“TopTestListen_”, “com.sun.star.awt.XTopWindowListener”)
TestD.addTopWindowlistener(TestListenerTop)

do while Continue
wait 20
TestD.setVisible(true)
loop
TestD.setVisible(false)

End Sub

'***********************************************************

Sub MakeFullScreen

Dim Doc As Object
Dim Sheet As Object
Dim Frame As Object
Dim Dispatcher As Object
Dim HelpTXT As Object

Doc = ThisComponent

frame = doc.CurrentController.getFrame()
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
dispatcher.executeDispatch(frame, “.uno:FullScreen”, “”, 0, Array())

’ Continue = False

End Sub

Sub Finished

Continue = false

End sub

'*****************************************************

sub TopTestListen_WindowClosing
Continue=false
end sub
sub TopTestListen_windowOpened
end sub
sub TopTestListen_windowClosed
end sub
sub TopTestListen_windowMinimized
end sub
sub TopTestListen_windowNormalized
end sub
sub TopTestListen_windowActivated
end sub
sub TopTestListen_windowDeactivated
end sub
sub TopTestListen_disposing
end sub

'*******************

firstly : Ask/Guide - How to use the Ask site - The Document Foundation Wiki #More_details

secondly : Ask/Guide - How to use the Ask site - The Document Foundation Wiki #Are_there_any_answers_to_my_question_yet


then, likely :
91797 – "Find & Replace" dialog doesnt open with shortcut in full screen mode
Writer : Find dialog not raising in Full Screen - #2 by RGB-es

I think you must to change your theme tag from Calc to Macros

Thank you for your help. I have now posted it to macros and calc, I hope?

Try this pencil: